You are not logged in.

#1 2015-07-01 17:05:09

ryzion
Member
Registered: 2012-03-20
Posts: 95

[solved]omit dmenu items

Hi,

is there a way to create a filter list to prevent certain programs from showing up in dmenu or dmenu2?

Thanks smile

Last edited by ryzion (2015-07-01 20:47:06)

Offline

#2 2015-07-01 17:29:52

ayekat
Member
Registered: 2011-01-17
Posts: 1,633

Re: [solved]omit dmenu items

You may want to have a look at $HOME/.cache/dmenu_run


pkgshackscfgblag

Offline

#3 2015-07-01 18:03:07

ryzion
Member
Registered: 2012-03-20
Posts: 95

Re: [solved]omit dmenu items

isn't that file being overwritten regularly?

Offline

#4 2015-07-01 18:12:26

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

Re: [solved]omit dmenu items

dmenu is just a menu - the only things that show up are what is passed to dmenu via stdin.  Dmenu_run, however, is probably what you are talking about - and that is just a *very* short script.  Feel free to modify it (a `grep -v -f /path/to/your/excludes.file` would probably do it).


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

Online

#5 2015-07-01 19:28:53

ryzion
Member
Registered: 2012-03-20
Posts: 95

Re: [solved]omit dmenu items

cheers. probably a stupid question, but why doesn't that line work:

dmenu "$@" < "$cache" | grep -v -w -f $HOME/.scas/configs/user/dmenu_exclude

Offline

#6 2015-07-01 20:19:50

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

Re: [solved]omit dmenu items

You have to grep what goes into dmenu, not what comes out.  I don't know what that cache variable is, but here is the original dmenu_run:

dmenu_path | dmenu "$@" | ${SHELL:-"/bin/sh"} &

You could edit that as follows:

dmenu_path | grep -v -f /home/username/configs/user/dmenu_exclude | dmenu "$@" | ${SHELL:-"/bin/sh"} &

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

Online

#7 2015-07-01 20:45:39

ryzion
Member
Registered: 2012-03-20
Posts: 95

Re: [solved]omit dmenu items

Yep, funny enough I had it the line above.. my dmenu_run was a bit longer though. Here's the file if anyone else comes across this

#!/bin/sh
cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
if [ -d "$cachedir" ]; then
	cache=$cachedir/dmenu_run
else
	cache=$HOME/.dmenu_cache # if no xdg dir, fall back to dotfile in ~
fi
(
	IFS=:
	if stest -dqr -n "$cache" $PATH; then
		stest -flx $PATH | sort -u | tee "$cache" | grep -v -w -f $HOME/path/dmenu_exclude | dmenu "$@"
	else
		grep -v -w -f $HOME/path/dmenu_exclude "$cache" | dmenu "$@"
	fi
) | ${SHELL:-"/bin/sh"} &

Offline

Board footer

Powered by FluxBB