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
6 posts
• Page 1 of 1
-
Posts: 3
- Joined: 28 Oct 2015
-
Posts: 1,445
- Joined: 09 Feb 2012
#2
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.
The minumum delay must accommodate"how long does it take for Skype window to be realized, when launched?" and same for icedove.
sleep 3sleep 3
bash /home/kenji/wmctrl.sh
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.
In this context (many processes underway during startup), maybe a longer sleep delay is necessary.wmctrl -l | awk '/emacs/
The minumum delay must accommodate"how long does it take for Skype window to be realized, when launched?" and same for icedove.
-
Posts: 3
- 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.
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
- 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
- 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.
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
- 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...
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...