| Author |
Message |
sazeile
Joined: 05 Jan 2006 Posts: 41
|
Posted: Wed 30 Dec 2009, 14:32 Post subject:
Auto Start an Application in a Different Virtual Desktop Subject description: Auto Start How To Question |
|
I'm in the process of converting the in-laws from Windows to Puppy Linux. After getting over the "it's different" learning curve they really like it, especially the virtual desktops. "It's like having multiple computers". They also like the quick boot time and I'm looking forward to not spending my holidays chasing viruses.
To automatically start applications for them I created a shell script in /root/Startup with lines like:
nohup skype &
nohup pidgin &
nohup firefox &
It works fine but the desktop is crowded.
Is there a way to specify in which virtual desktop the app should start so that I can spread them out across the virtual desktops?
Thanks,
Steve
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6180 Location: Auckland, New Zealand
|
Posted: Wed 06 Jan 2010, 09:36 Post subject:
|
|
You can make a program always start on a particular desktop, which is not exactly what you're asking:
Look at the "Group" settings in http://joewing.net/programs/jwm/config.shtml
You'll want to edit ~/jwm/jwmrc-personal
_________________ DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
|
|
Back to top
|
|
 |
sazeile
Joined: 05 Jan 2006 Posts: 41
|
Posted: Wed 06 Jan 2010, 23:24 Post subject:
Background Type of "Command" sort of works |
|
Disciple,
Thanks for the reply.
You're right, it's not quite what I'm looking for.
I also discovered in desktops that you can specify a different background for each desktop. If I set the background type to "command" and then specify the app that I want then that app will start when I go to that desktop.
What is doesn't do is auto start that app on that desktop without going to that desktop.
However, I think that will be good enough.
Thanks again,
Steve Z.
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6180 Location: Auckland, New Zealand
|
Posted: Thu 07 Jan 2010, 00:40 Post subject:
|
|
A clever misuse of that feature
You should suggest in the JWM improvement thread a feature to have separate startup commands for each desktop http://www.murga-linux.com/puppy/viewtopic.php?p=379081#379081
There is probably a "better" way to do what you want, but you can do it by inserting lines in your startup script that switch between the desktops by using xte, (which might actually be included in Puppy now, I can't remember) to send whatever keystrokes are bound in your JWM configuration for desktop switching. If you do this I imagine you'll see the screen flicker briefly at startup while it cycles through the desktops.
_________________ DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
|
|
Back to top
|
|
 |
sazeile
Joined: 05 Jan 2006 Posts: 41
|
Posted: Fri 08 Jan 2010, 02:23 Post subject:
Xte Worked! |
|
Disciple,
Turns out there was a minor problem with my "clever misuse".
Everytime you go to a desktop with a background="command" that command gets executed.
I was able to set up a function key to toggle between desktops and then I used xte in my startup script and it did the trick.
Thanks for the link to xte. It isn't in 4.3.1.
I had to add some "sleep" steps to allow the apps to get started before toggling to the next desktop.
Otherwise the app will land on the next desktop if it hasn't had time to get started.
I wasn't able to figure out how to use the "desktop#" key action to go to a specific desktop.
That would be better then toggling through all of the desktops.
Do you know what Joe means by:
desktop# Key to switch to a specific desktop. To use this, # must be specified in the key section.
Then numbers from 1 to the number of desktops configured are substituted for #.
I tried:
<Key key="F1">desktop#</Key>
<Key key="F2">desktop#</Key>
<Key key="F3">desktop#</Key>
<Key key="F4">desktop#</Key>
No errors on "jwm -p" but all four keys just toggle to the next desktop instead of going to a specific desktop.
Thanks,
Steve Z.
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6180 Location: Auckland, New Zealand
|
Posted: Sun 10 Jan 2010, 03:58 Post subject:
|
|
Hmmm.
I've never tried it before - it isn't actually what I thought. The default Puppy configuration includes
| Code: | | <Key mask="A" key="#">desktop#</Key> |
If I hold down "Alt" and press "#" ("Shift" + "3" on my keyboard) then "2" it switches to desktop 2. That might not be as useful as what I thought it was. Maybe another feature suggestion is in order... and some rewording of the documentation
_________________ DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
|
|
Back to top
|
|
 |
sazeile
Joined: 05 Jan 2006 Posts: 41
|
Posted: Sun 10 Jan 2010, 22:42 Post subject:
Xte can now change to a specific virtual desktop |
|
Disciple,
Thanks for the explanation.
I now have a startup script that looks like:
| Code: |
# Switch to desktop 2
xte "keydown Alt_L" "keydown #" "key 2" "keyup Alt_L" "keyup #"
# Start Firefox at Google
/root/firefox/firefox -new-window 'www.google.com' &
# Wait for Firefox and Internet Connection to get started
sleep 10
# Switch to desktop 3
xte "keydown Alt_L" "keydown #" "key 3" "keyup Alt_L" "keyup #"
# Start AOL
/root/firefox/firefox -new-window 'www.aol.com' &
sleep 5
# Switch to desktop 1
xte "keydown Alt_L" "keydown #" "key 1" "keyup Alt_L" "keyup #" |
While it does the trick, there's a bit of flashing. I'll leave a suggested improvement for JWM to allow the "StartupCommand" to be run within "Desktop". No doubt a lot easier to suggest than implement.
Thanks again,
Steve Z.
|
|
Back to top
|
|
 |
DanYHKim

Joined: 14 Sep 2008 Posts: 103
|
Posted: Mon 11 Jan 2010, 19:07 Post subject:
Switching a virtual desktop Subject description: This might be of use - Uses virtual keyboard somehow |
|
I haven't done this. I was just looking for clues about using VMware Tools. On a page about setting up VMware Tools, there are some instructions found at "Step Six" of the list showing a script that invokes the XVKBD virtual keyboard to switch desktops.
Someone smarter than me will have to look at it and see if it makes sense.
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6180 Location: Auckland, New Zealand
|
Posted: Wed 13 Jan 2010, 04:02 Post subject:
|
|
Alternatively if you don't mind a program always starting on a particular desktop (not just at when jwm starts) you could use groups in the jwm config to make them do that.
| Quote: | Always start Firefox maximized on the second desktop:2 and without a title bar
| Code: | <Group>
<Class>Firefox</Class>
<Option>maximized</Option>
<Option>desktop:2</Option>
<Option>notitle</Option>
</Group> |
|
_________________ DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6180 Location: Auckland, New Zealand
|
Posted: Wed 13 Jan 2010, 04:20 Post subject:
|
|
If you do mind it always applying, you might find a better solution using wmctrl or devilspie or something...
_________________ DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
|
|
Back to top
|
|
 |
disciple
Joined: 20 May 2006 Posts: 6180 Location: Auckland, New Zealand
|
Posted: Thu 28 Jan 2010, 05:15 Post subject:
|
|
Ah, a slightly better approach would be to just open the programs on whatever desktop you are on, then use the tiny xdotool to move them to the right desktop e.g.
| Code: | | xcalc & ./xdotool set_desktop_for_window `./xdotool search --class xcalc` 1 |
Note that the first desktop is 0, not 1.
xdotool is included in the pastecolour http://www.murga-linux.com/puppy/viewtopic.php?t=45477 and pastelist http://www.murga-linux.com/puppy/viewtopic.php?t=45327 packages.
You can get documentation here http://www.semicomplete.com/projects/xdotool/xdotool
_________________ DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
|
|
Back to top
|
|
 |
sazeile
Joined: 05 Jan 2006 Posts: 41
|
Posted: Sun 31 Jan 2010, 23:25 Post subject:
Xdotool Works and It Makes it Faster |
|
Disciple,
The xdotool makes sending it to another desktop easier and it provided me a way to know when the application has launched and can then be moved.
Here's the code that I added to my startup.sh script in /root/Startup
| Code: |
#Ping Google
ping -c1 www.google.com >& /dev/ping_google.txt
cat /dev/ping_google.txt |
awk ' BEGIN {connection=0}
$0 ~ /1 packets received/{connection=1}
END {print connection}' > /dev/ping_google_ind.txt
#Wait for Google Ping to Suceed
while [ `cat /dev/ping_google_ind.txt` -ne 1 ]
do
ping -c1 www.google.com >& /dev/ping_google.txt
cat /dev/ping_google.txt |
awk ' BEGIN {connection=0}
$0 ~ /1 packets received/{connection=1}
END {print connection}' > /dev/ping_google_ind.txt
done
# Start Firefox at Google
/root/firefox/firefox -new-window 'www.google.com' &
#Wait for Google Window to be Created
while [`xdotool search --title google` = ""]
do
sleep 0.001 #Recheck Quickly
done
#Send Google Window to Desktop 1
xdotool set_desktop_for_window `xdotool search --title google` 1
#Ping Yahoo
ping -c1 www.yahoo.com >& /dev/ping_yahoo.txt
cat /dev/ping_yahoo.txt |
awk ' BEGIN {connection=0}
$0 ~ /1 packets received/{connection=1}
END {print connection}' > /dev/ping_yahoo_ind.txt
#Wait for Yahoo Ping to Suceed
while [ `cat /dev/ping_yahoo_ind.txt` -ne 1 ]
do
ping -c1 www.yahoo.com >& /dev/ping_yahoo.txt
cat /dev/ping_yahoo.txt |
awk ' BEGIN {connection=0}
$0 ~ /1 packets received/{connection=1}
END {print connection}' > /dev/ping_yahoo_ind.txt
done &&
#Start Firefox at Yahoo
/root/firefox/firefox -new-window 'www.yahoo.com' &
#Wait for Yahoo Window to be Created
while [`xdotool search --title yahoo` = ""]
do
sleep 0.001 #Recheck Quickly
done
#Send Yahoo Window to Desktop 2
xdotool set_desktop_for_window `xdotool search --title yahoo` 2
|
It waits for Google and Yahoo to be connected before launch.
Thanks!
Steve Z.
|
|
Back to top
|
|
 |
|