You are not logged in.
Hi all, does somebody know if there's a way to launch applications after starting compiz fusion (standalone), in a way similar to openbox's autostart.sh ?
I don't use a display manager (gdm, kdm, slim...), just run startx from console, and I don't want to use gnome-session or similar applications, I'd just like to execute a script after the window manager has loaded.
One reason for this is that I've noticed that if I start xscreensaver using ~/.xinitrc (forcedly before starting compiz) it doesn't use ~/.Xresources configuration, while if I launch it manually after compiz has loaded, ~/.Xresources is correctly read; in any case I think it's just more logical to launch X applications after the window manager, and not before.
This is my ~/.xinitrc in case you need it:
#!/bin/sh
xrdb -merge ~/.Xresources &
avant-window-navigator &
thunar --daemon &
xscreensaver -no-splash &
exec ck-launch-session fusion-icon
Thank you!
Offline
Hi, i have posted a possible answer in https://bbs.archlinux.org/viewtopic.php?id=109790 I think the third option is what you are looking for.
Last edited by singenbale (2011-01-11 22:41:04)
Offline
Actually your solution solves my problem, but more than that you've made me concentrate more on ~/.xinitrc, so I remembered an interesting piece of code at the bottom of this article https://wiki.archlinux.org/index.php/Xinitrc which I think is even more elegant.
Anyway, about the xscreensaver and ~/.Xresources problem, I've noticed a mistake in my code, in fact using "&" after "xrdb -merge ~/.Xresources" is wrong, as it's necessary to complete the merging before doing anything else. This is also an error at the beginning of this article https://wiki.archlinux.org/index.php/Xdefaults which I think should be corrected, if somebody can confirm this theory.
In the end, this is the (working though still improvable, see below) code I use now for my .xinitrc:
#!/bin/sh
xrdb -merge ~/.Xresources
ck-launch-session fusion-icon & wmpid=$!
avant-window-navigator &
thunar --daemon &
xscreensaver -no-splash &
wait $wmpid
I'm still not so sure about this line:
ck-launch-session fusion-icon & wmpid=$!
In fact I can't find a man page for ck-launch-session and I don't understand if fusion-icon is taken as an argument for it, or as a second command, and in the latter case I wouldn't understand what pid gets stored in wmpid.
Offline
I made script such us /usr/bin/fusion.sh which contains
#!/bin/bash
emerald &
#avant-window-navigator &
wicd-gtk &
nitrogen --restore &
udiskie &
#feh --bg-scale /home/tydell/share/wallpapers/enlightenment_2560x1440.jpg &
volwheel &
setxkbmap pl &
tint2 &
exec compiz ccp --replace --indirect-rendering
and my .xinitrc looks like this:
#!/bin/sh
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
#
exec ck-launch-session fusion.sh
and I have autostarted all applications listed in /usr/bin/fusion.sh
Offline
Hi tydell, thanks for answering, but I don't think yours is a good solution, in fact you're actually using two nested "exec" commands, which I don't think is such a good practice...
What's more you're still launching applications before the window manager, and not after.
Look at the solution I've posted at #3 and tell me what you think.
Offline
I've got a question, if running "xrdb -merge ~/.Xresources" in the background is the actual mistake than why would the solution posted at #2 solve it? I mean it would still be running in the background after say 5 or 10 seconds later when the xscreensaver command gets executed either manually or through the .xinitrc file. In spite of this argument i think the "&" shouldn't be there and as i checked it has already be removed in the wiki article.
@kynikos
Also thanks to you i read https://wiki.archlinux.org/index.php/Xinitrc and adopted that script which as you have stated is more elegant and it also removed some (minor) errors that i was getting at closing the window manager that i use. So i think its better that way.
and as for:
In fact I can't find a man page for ck-launch-session and I don't understand if fusion-icon is taken as an argument for it, or as a second command, and in the latter case I wouldn't understand what pid gets stored in wmpid.
Lol, I too don't know about it but i believe its the first case. Anyway further discussion about it would be a bit off-topic in this thread.
Offline
I've got a question, if running "xrdb -merge ~/.Xresources" in the background is the actual mistake than why would the solution posted at #2 solve it? I mean it would still be running in the background after say 5 or 10 seconds later when the xscreensaver command gets executed either manually or through the .xinitrc file.
Eh eh yeah you would be right if I sleep'd everything before the exec command; what I did instead was "sleeping" just xscreensaver, so the chain was still running xrdb first, then compiz and xscreensaver about 5 secs later.
In spite of this argument i think the "&" shouldn't be there and as i checked it has already be removed in the wiki article.
Right, in fact I did report the mistake in its discussion page.
@kynikos
Also thanks to you i read https://wiki.archlinux.org/index.php/Xinitrc and adopted that script which as you have stated is more elegant and it also removed some (minor) errors that i was getting at closing the window manager that i use. So i think its better that way.
If you (or anybody else reading) are still interested, this is a merge of your solution with the one posted in the article about .xinitrc, which, at least for me, happens to work particuarly well with compiz and avant window navigator, and also makes quite sure that everything really launches after the window manager has finished loading:
#!/bin/sh
# load .Xresources configuration
xrdb -merge ~/.Xresources
# launch the window manager
ck-launch-session fusion-icon & wmpid=$!
# wait 4 seconds to let the wm load in peace :)
# note: it could be possible to reduce this delay some more, I'm still testing it
sleep 4
## AUTOSTART SECTION
# put here all the applications you want to autosart followed by &
avant-window-navigator &
thunar --daemon &
xscreensaver -no-splash &
# wait for the wm to terminate before X
wait $wmpid
and as for:
kynikos wrote:In fact I can't find a man page for ck-launch-session and I don't understand if fusion-icon is taken as an argument for it, or as a second command, and in the latter case I wouldn't understand what pid gets stored in wmpid.
Lol, I too don't know about it but i believe its the first case. Anyway further discussion about it would be a bit off-topic in this thread.
Agree, let's leave this mysterious thing aside in this topic, somehow it just works
EDIT: just added some comments to the code
Last edited by kynikos (2011-01-14 10:42:37)
Offline