You are not logged in.
Pages: 1
Topic closed
Hi,
I want to start some programs in xmonad. I read that I have to write them in ~/.Xsession file. The problem is that they all wll be autostarted in my other WMs also. I am currently configuring / testing xmonad, so I don't want to affect the startup programs of other WMs I have. Is there any other way ?
regards,
Hardik
Offline
Use ~./xinitrc instead of ~/.Xsession. You can have a look at the .xsession of root for examples.
Offline
will ~/.xinitrc start programs also for the other WMs (like fluxbox, openbox etc), I have ?
Offline
You have at least two available options:
If you use Slim then it will send the session name as an argument to the .xinitrc/.xsession
which then can use the argument as follows to start apps depending on the session.
Edit: As an example my .xinitrc:
xmodmap .xmodmap
xsetroot -cursor_name left_ptr
##start terminal daemon #it requires no '&' at the end as it forks itself useing the -f switch
urxvtd -f -o -q
thunar --daemon&
xscreensaver -nosplash&
parcellite&
pidgin&
checkgmail&
#xcompmgr&
DEFAULT_SESSION=xmonad
case $1 in
xmonad)
nitrogen --restore
trayer --edge top --align right --expand true --SetDockType true --SetPartialStrut true --tint 0x000000 --alpha 0 --transparent true --height 17 --width 10 --margin 175&
exec xmonad
;;
awesome)
exec awesome
;;
*)
nitrogen --restore
trayer --edge top --align right --expand true --SetDockType true --SetPartialStrut true --tint 0x000000 --alpha 0 --transparent true --height 17 --width 10 --margin 175&
exec $DEFAULT_SESSION
;;
esac
The other option would be to use the startupHook in your xmonad.hs. I am using the first method though, so best ask someone on the xmonad channel on freenode how to use the startuphook.
Have fun
Last edited by Arien (2009-04-25 20:34:51)
Offline
Thanks Arien,
I am using kdm, does it send the session name as an argument ?
Offline
I'm using a startup hook in xmonad to do a few things. You could also use it to start applications. The main reason I don't is that I edit my xmonad.hs daily and each time I restarted xmonad the applications would be launched again. There is probably a way around this though and it may not make any difference to you while testing. Anyways...
Add to your config:
startupHook = startup
and then define the startup function:
startup :: X ()
startup = do
spawn "xterm"
spawn "xeyes"
...
the xmonad faq reccomends using .xinitrc for the above reason. More info here.
Last edited by mikesd (2009-04-25 21:54:02)
Offline
surely there's a way to use startupHook, but also tell it to only launch the required if not already running?
i'm looking to autostart tilda & conky.
...could probably even do this with a bash script...
get startupHook to launch the script, and have the script take care of the if and else.
... if it cant be done from within the config that is.
fave quote of the mo': "Man's reach should exceed his grasp, else what's a heaven for." - Robert Browning
Offline
I have things starting in my startup hook, but found away around mucking with your xinitrc or xsession file so much.
In my $PATH I have added ~/bin to the works, then in ~/bin, I have a file that I call xmonad-autostart (got the idea from awesome btw ).
Anyway, my xmonad-autostart has my programs that I want xmonad to start in the same format as xsession or xinitrc. In my ~/.xinitrc file, I have added one line:
xmonad-autostart &
. This line is right before the exec xmonad command.
Now, I start my X from the console, If I remember right, there are options for the various wm's in the startup managers, so all you would need would be to put your 'xmoand-autostart &' command in the then statement for xmoand.
HTH
Knute
Offline
well, a little fiddling n i think i've got mine sorted.
yet to restart xmonad to test though...
couple scripts to start each app.
using sox, i quickly did a "rec sounds/tildarunning.wav" and "rec sounds/conkyrunning.wav" speaking into the mic "tilda is already running" and "conky is already running" ... just to add some fun to it. (will probably remove this when it gets annoying after a few restarts)
#! /bin/bash
if [ "$(ps -C conky | tail --bytes=6)" = "conky" ]; then
play ~/sounds/conkyrunning.wav
else
conky
fi
# alternative methods suggested by guys in #bash on freenode
# if pgrep conky >/dev/null; then ...
# also said was:
# You possibly want -u "$USER" too
&
#! /bin/bash
if [ "$(ps -C tilda | tail --bytes=6)" = "tilda" ]; then
play ~/sounds/tildarunning.wav
else
tilda
fi
# alternative methods suggested by guys in #bash on freenode
# if pgrep tilda >/dev/null; then ...
# also said was:
# You possibly want -u "$USER" too
~edit
FAIL! XD still needs some work. XD
this inspired me to add a new line to my signature.
fave quote of the mo': "Man's reach should exceed his grasp, else what's a heaven for." - Robert Browning
... better to look a fool while trying, than to stay with noobuntu.
Last edited by Digit (2010-10-22 16:41:00)
fave quote of the mo': "Man's reach should exceed his grasp, else what's a heaven for." - Robert Browning
Offline
ugly!
import XMonad.Actions.WindowGo (runOrRaise)
--
-- with startupHook = startup
--
-- this is totally untested but i guess startup just needs to be :: X ()
-- which runOrRaise also happens to return...
startup :: X ()
startup = do
runOrRaise <String executable> (<Query Bool to find it>)
runOrRaise "chromium" (className =? "Chromium")
runOrRaise ...
This will run them if they're not there, or (I think) bring them into focus if they are. This may or may not be what you want, but you could probably hack the source for runOrRaise to prevent the raiseHook from running (which would leave the window where it was), call it runOrNot...
You can use xprop to find the class name of the the apps you want. any thing you can use in a manageHook can be used here.
//github/
Offline
Digit, start new threads, link to old ones. Read forum rules and please abide by them.
Closing...
There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !
Offline
Pages: 1
Topic closed