#!/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
APP=$(
IFS=:
if stest -dqr -n "$cache" $PATH; then
stest -flx $PATH | sort -u | tee "$cache" | dmenu "$@"
else
dmenu "$@" < "$cache"
fi
)
[[ ! `grep -w "$APP" ~/.config/dmenu/urxvt-list` ]] && echo $APP | ${SHELL:-"/bin/sh"} &
[[ `grep -w "$APP" ~/.config/dmenu/urxvt-list` ]] && urxvtc -e $APP &
BTW, thanks for pointing to urxvtc, I've switched to the daemon version of urxvt from the regular one.
]]>#!/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
APP=$(
IFS=:
if stest -dqr -n "$cache" $PATH; then
stest -flx $PATH | sort -u | tee "$cache" | dmenu "$@"
else
dmenu "$@" < "$cache"
fi
)
[[ `grep "$APP" ~/.dmenu_term` ]] && urxvtc -e $APP &
[[ ! `grep "$APP" ~/.dmenu_term` ]] && echo $APP | ${SHELL:-"/bin/sh"} &
Change urxvtc to your terminal of choice, and create a list of programs that need to start in a terminal in ~/.dmenu_term
]]>Sidenote: look at the Prompt modules for xmonad.
Thanks, I've just tried XMonad.Prompt.Shell as you suggested. It looks similar, but it doesn't open a new terminal. Do you know if there is any option to do it?
]]>Trilby wrote:beloglazov wrote:Hi Trilby, could you please explain how to add commants like "urxvt -e vim" into dmenu? Thanks!
I'm not sure I understand - you just type it in. This doesn't get the autocompletion option. I suppose you could script that into it, but I wouldn't see the point. When you type "urxvtc -e" it wouldn't really narrow down the list of possibilities.
let it autocomplete "urxvt" for you, then add the -e vim, then press shift-enter
Thank you guys for the replies. Actually, I didn't know that you type into dmenu a command with arguments Anyway, I've a made a small modification of dmenu_run that does what I wanted: you type in a command like bc or top; dmenu auto-completes it; and when you press enter, it runs "urxvt -e <your command>". This helps to avoid typing "urxvt -e" every time. Here is the code:
#!/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
if stest -dqr -n "$cache" $PATH; then
choice="$(stest -flx $PATH | sort -u | tee $cache | dmenu)"
else
choice="$(dmenu < $cache)"
fi
if [[ $choice ]]; then
urxvt -e $choice
fi
beloglazov wrote:Hi Trilby, could you please explain how to add commants like "urxvt -e vim" into dmenu? Thanks!
I'm not sure I understand - you just type it in. This doesn't get the autocompletion option. I suppose you could script that into it, but I wouldn't see the point. When you type "urxvtc -e" it wouldn't really narrow down the list of possibilities.
let it autocomplete "urxvt" for you, then add the -e vim, then press shift-enter
]]>Hi Trilby, could you please explain how to add commants like "urxvt -e vim" into dmenu? Thanks!
I'm not sure I understand - you just type it in. This doesn't get the autocompletion option. I suppose you could script that into it, but I wouldn't see the point. When you type "urxvtc -e" it wouldn't really narrow down the list of possibilities.
]]>you can put commants like "urxvt -e vim" right into dmenu.
You can then use manageHooks to determine which workspace that terminal should open in.
Hi Trilby, could you please explain how to add commants like "urxvt -e vim" into dmenu? Thanks!
]]>xvim somefilename.txt
Without $@ the filename or other arguments you want to pass to vim will be ignored.
]]>You can set up some wrapper scripts that can be launched from dmenu, for example i have a script called xvim in ~/bin/
#!/bin/bash xterm -class Gvim -e vim "$@"
that starts xterm with the same tags active as gvim. I'm using dwm but this should also work with xmonad, of course ~/bin has to be in $PATH.
If you make sure ~/bin comes first in $PATH, then you could just call the script 'vim' - although you'd then need to remember to type /usr/bin/vim if you're not in X for some reason.
]]>You can then use manageHooks to determine which workspace that terminal should open in.
]]>