Posts: 3
Kenji
Joined: 28 Oct 2015
#1
Hello!

I'm trying to figure out how to run a script from the start-up tab displayed in"Geany", which I reach through"Menu"->"Control Panel"->"Session"->"Global desktop session" (my OS is in Swedish so I might have translated it to something else than what is written in English).

In this startup-tab/file I have the following defined

#!/bin/bash
volumeicon &

fbxkb &

search-bar-icon &

skype &

icedove &

emacs tips_and_tricks.txt &

wicd-client &

fdpowermon &

sleep 3
bash /home/kenji/wmctrl.sh


Where as my bash script looks like
#!/bin/bash
EMACS_ID=$(wmctrl -l | awk '/emacs/ {print $1}')
SKYPE_ID=$(wmctrl -l | awk '/Skype/ {print $1}')
ICEDOVE_ID=$(wmctrl -l | awk '/Icedove/ {print $1}')
echo $EMACS_ID
echo $SKYPE_ID
echo $ICEDOVE_ID
wmctrl -i -r $EMACS_ID -t 1
wmctrl -i -r $SKYPE_ID -t 1
wmctrl -i -r $ICEDOVE_ID -t 1


The intention of the script is to place emacs, skype and icedove on the 2nd workspace. When I run the script either from the terminal or through the line when I hit super+space (with bash /home/kenji/wmctrl.sh), it works fine and does what I expect it to do. But when I intend to call it automatically like this, the programs remains in the 1st workspace.

I'm wondering if I'm calling the script incorrectly, or if someone knows why it doesn't execute the script when I start the PC?

BR
/Kenji
Posts: 1,445
skidoo
Joined: 09 Feb 2012
#2
sleep 3
bash /home/kenji/wmctrl.sh
sleep 3
bash /home/kenji/wmctrl.sh &

For success, each line in the startfile must end with an ampersand character.
I'm uncertain whether that, alone, will fix.
wmctrl -l | awk '/emacs/
In this context (many processes underway during startup), maybe a longer sleep delay is necessary.
The minumum delay must accommodate"how long does it take for Skype window to be realized, when launched?" and same for icedove.
Posts: 3
Kenji
Joined: 28 Oct 2015
#3
Hello!

Thanks for your reply; I tried adding an ampersand (&)"bash /home/kenji/wmctrl.sh" with no change in the result. With the ampersand in place I also tried to increase the sleep to 20, with and without and ampersand there as well, but it didn't work either.

In the worst case scenario I'll just make it a habit to press super+space and write it manually once, but it feels like it's something that should work.
Posts: 1,062
Dave
Joined: 20 Jan 2010
#4
Try without bash in front of the script name and just put the script name/ path there itself. Also make sure that the script is marked executable. Chmod 755 script.
Posts: 3
Kenji
Joined: 28 Oct 2015
#5
Hello!

Thank you for your reply! I tried to change the rights like you said, as I had 744 before to 755

kenji@antix1:~
$ pwd
/home/kenji
kenji@antix1:~
$ ls -l wmctrl.sh
-rwxr-xr-x 1 kenji kenji 296 okt 28 20:13 wmctrl.sh

And also removed the bash infront of the script path but the results remained the same. It works however when I execute"wmctrl.sh" myself, without bash in the beginning.

I might try to put in a dummy script in the startup file to just open an application like leafpad, just to see that it's actually possible to execute scripts from there.
Posts: 1,062
Dave
Joined: 20 Jan 2010
#6
Could you post the file ~ / . desktop-session/log?

It should show us in there what desktop-session is running / starting / trying.

Running a script in there should be okay as desktop -session calls the startup file as a script...