You are not logged in.
Pages: 1
Hi,
I am just getting started with xmonad and I really like it, but I have one problem. If I try to launch any console applications from dmenu (vim, for instance), they don't show up. When I quit xmonad I find that they have actually started back in the original terminal, and sometimes render it unusable. Is there some way to launch console applications as their own windows and processes, seperate from the original terminal? If not, do you just start them from a terminal and then move them to the correct workspace?
For example, I put anything code that I am working on in workspace 2, but regular terminal sessions in workspace 4. Is there a way that I can launch vim from dmenu and have it automatically moved to workspace 2, like I have done with gVim?
Offline
I don't think this is possible with dmenu (anyone feel free to correct me if I'm wrong). It has no way of knowing wich terminal if has to launch the application with.
The way I have it configured is to simply have a shortcut assigned in my .xmonad.hs which indicates which terminal the application should be launched with. So for example to open vim in urxvt:
, ((modMask, xK_v), spawn "urxvt -e vim")
Burninate!
Offline
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.
Offline
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.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
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.
Offline
Thanks everyone, those ideas work great. Now, the only thing I'm wondering is what does the "$@" at the end of portix's command do?
Offline
$@ expands the scripts arguments, you can then call the script with
xvim somefilename.txt
Without $@ the filename or other arguments you want to pass to vim will be ignored.
Offline
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!
Offline
Why not just use gvim? Disable the menu and scrollbar etc and it won't take more space, but it will look nicer and behave better
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
vim was just an example, I'd like to use this for some other programs like bc, etc.
Offline
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.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
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
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
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
Offline
Sidenote: look at the Prompt modules for xmonad.
Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest
Offline
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?
Offline
beloglazov, I think you'll love this. My edit to the dmenu_run script:
#!/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
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
Trilby, nice, thanks! I've made a couple of changes: changed the order (first try to run a program in a normal way), and added the -w option to grep to avoid matching substrings:
#!/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.
Offline
Nice, I'll definitely add the -w switch. BTW, that should have been directed to aquamongoose. I was confused about who the OP was. In any case, it's for anyone who may find it useful.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
Pages: 1