Starting GUI on specific workspace from CLI or shell script
Is it possible to launch an app via CLI or a shell script and tell it to open on a specific workspace??
I am trying to write a script that will launch several apps after boot/login and place them each on different workspaces. The script looks like:- Code:
#!/bin/sh It seems to be doing what I want, if I run:- Code:
$ bash -x ./startuptasks.sh Code:
+ conky -c /home/gregg/.conky/conkyrc_grey |
The answer is yes, but it's not as simple as you might imagine. In a Gnome2 or Gnome3 fallback environment, you can easily switch to specific workspaces.
I use this script, called 'desktop' to select the workspace: Code:
#!/bin/bash You also have the issue of synchronizing applications launched as background tasks. For example, Firefox can take a long time to launch. As a result, you need to wait for the window to actually appear. For example: Code:
/usr/bin/firefox "$@" & Code:
/usr/bin/wmctrl -s `/usr/bin/wmctrl -d | /usr/bin/tail -n1 | /bin/awk '{print $1}'` |
I am using Unity on Ubuntu 11.04, so would either of the above work???
|
Sorry, I haven't tried Ubuntu Unity. There's no harm in trying them out. If Unity gives you preallocated workspaces, try the 'desktop' script. If it dynamically allocates them, try the wmctrl. If neither work, then Unity isn't a EWMH (Extended Window Manager Hints) compatible X Window Manager.
|
OK, too tired to try now but will have a go another day and see what happens.
I'll try the gnome shell script first as I believe Unity works in a similar way(?) Do i just insert that bit of code before/after the line that launches the app in my script?? |
Yes, if you have preallocated workspaces, you can do something like:
Code:
# application1 on first workspace |
All times are GMT -5. The time now is 07:13 AM. |