You are not logged in.

#1 2022-08-29 22:49:34

salmon
Member
Registered: 2022-05-27
Posts: 42

exclude items from dmenu [solved]

this been asked before here but this is actually not a working answer. This excludes anything with that string of characters. So for instance if i wanted to exclude "Go" it would exclude say "google-chrome-stable" because it has "go" in it.
Is there a way to not do this, or better yet just exclude all non-gui applications?

Last edited by salmon (2022-08-30 15:59:14)

Offline

#2 2022-08-29 23:24:48

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: exclude items from dmenu [solved]

salmon wrote:

this been asked before here but this is actually not a working answer. This excludes anything with that string of characters. So for instance if i wanted to exclude "Go" it would exclude say "google-chrome-stable" because it has "go" in it.
Is there a way to not do this, or better yet just exclude all non-gui applications?

Just change the regex to include 'go$' but not 'go'?
Or just tell dmenu to only look at the desktop files in /usr/share/applications


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2022-08-29 23:44:58

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,496
Website

Re: exclude items from dmenu [solved]

Don't change the regex format - just don't do a regex match if that's not what you want.  Perhaps you want the -x flag to grep.

Of course if you do just want "gui applications" using desktop files will be a much better approach.

Last edited by Trilby (2022-08-29 23:46:49)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#4 2022-08-29 23:54:53

salmon
Member
Registered: 2022-05-27
Posts: 42

Re: exclude items from dmenu [solved]

Trilby wrote:

Perhaps you want the -x flag to grep.

That just removes all suggestions.

Ive tried using .desktops before, and it generally works. I have a ~/Bin dir in my path where i put all my shell scripts and stuff from projects on github, appimages, etc. Anything not from a package manager. Its just that that area changes so often that its kinda a pain to amange all those .desktops.

Offline

#5 2022-08-29 23:57:49

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,496
Website

Re: exclude items from dmenu [solved]

I gather you removed the -v flag from grep.  Don't flail, think about what the commands are doing.  Read the man page(s) to get what you actually want.

Last edited by Trilby (2022-08-29 23:58:03)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2022-08-30 00:15:26

salmon
Member
Registered: 2022-05-27
Posts: 42

Re: exclude items from dmenu [solved]

no i kept -v

grep -v -x -f

(same result with and without -v)

Offline

#7 2022-08-30 00:36:11

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,496
Website

Re: exclude items from dmenu [solved]

Post the full command / script used as well as the list file.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#8 2022-08-30 15:05:55

salmon
Member
Registered: 2022-05-27
Posts: 42

Re: exclude items from dmenu [solved]

Trilby wrote:

Post the full command / script used as well as the list file.

sorry went to bed

#!/bin/sh
dmenu_path | grep -v --file=/home/salmon/.config/dmenu/dmenu_exclude | dmenu "$@" | ${SHELL:-"/bin/sh"} &

// list of excludes. "not_exec" is just a test sh script in ~/Bin
not_exec
disco
go

Offline

#9 2022-08-30 15:27:05

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,223

Re: exclude items from dmenu [solved]

What's "dmenu_path" and where's the "-x"?

Offline

#10 2022-08-30 15:30:53

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,496
Website

Re: exclude items from dmenu [solved]

Seth, dmenu_path is an executable from the dmenu package that is used in the dmenu_run script.  It basically just lists all executables in $PATH (which is really silly as find will do this just fine on it's own).

Salmon, as noted above, the command you just posted is a bit different from what you claimed to not be working.  In any case, test one bit at a time in an interactive shell, e.g.:

dmenu_path | grep ...

Then you can see exactly what will / will not be included at polish your grep command and exclusion list as needed.

Last edited by Trilby (2022-08-30 15:32:15)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#11 2022-08-30 15:31:58

salmon
Member
Registered: 2022-05-27
Posts: 42

Re: exclude items from dmenu [solved]

seth wrote:

What's "dmenu_path"

$ cat $(which dmenu_path)
#!/bin/sh

cachedir="${XDG_CACHE_HOME:-"$HOME/.cache"}"
cache="$cachedir/dmenu_run"

[ ! -e "$cachedir" ] && mkdir -p "$cachedir"

IFS=:
if stest -dqr -n "$cache" $PATH; then
	stest -flx $PATH | sort -u | tee "$cache"
else
	cat "$cache"
fi

i removed -x cause removed all results. maybe its seeing smthn like "disco\n" instead of "disco"

Offline

#12 2022-08-30 15:35:04

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,496
Website

Re: exclude items from dmenu [solved]

I'm guessing you posted what you *see* in your exclude file.  I was asking for the actual file (e.g., on a file sharing site).  I'd guess there may be a blank line in it.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#13 2022-08-30 15:40:34

salmon
Member
Registered: 2022-05-27
Posts: 42

Re: exclude items from dmenu [solved]

 wget https://github.com/TH3-S4LM0N/AFishMadeThisWebsite/raw/main/dmenu_exclude 

just slapped it on my old website thing

Offline

#14 2022-08-30 15:47:17

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,496
Website

Re: exclude items from dmenu [solved]

That file works fine for me and I still get all the entries that don't match anything in that file.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#15 2022-08-30 15:52:23

salmon
Member
Registered: 2022-05-27
Posts: 42

Re: exclude items from dmenu [solved]

with "grep -v -f"?

Offline

#16 2022-08-30 15:58:23

salmon
Member
Registered: 2022-05-27
Posts: 42

Re: exclude items from dmenu [solved]

Oh i see.
"grep -v -x -f" works, thanks!

Offline

#17 2022-08-30 16:06:06

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,496
Website

Re: exclude items from dmenu [solved]

Yeah, what I suggested in post #3 and you confirmed that your were (allegedly) using in post #6 but apparently didn't really try until #16.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#18 2022-08-30 16:08:27

salmon
Member
Registered: 2022-05-27
Posts: 42

Re: exclude items from dmenu [solved]

yeah i think in 6 i did '-x -f'; my bad

Last edited by salmon (2022-08-30 16:08:42)

Offline

Board footer

Powered by FluxBB