Advertisement
Guest User

urukrama

a guest
May 5th, 2008
788
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.58 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. thunar_wm_class="thunar"
  4. thunar_exec="thunar"
  5.  
  6. # no thunar started, so start one
  7. if [ -z "`wmctrl -lx | grep thunar`" ]; then
  8.     $thunar_exec &
  9. else
  10.     # search for existing thunars on current desktop
  11.     current_desk=`wmctrl -d | grep '*' | cut -d ' ' -f 1`
  12.     thunar_on_this_desk=`wmctrl -lx | grep "$current_desk[ ]*$thunar_wm_class" | cut -d ' ' -f 1`
  13.     if [ -n "$thunar_on_this_desk" ]; then
  14.         wmctrl -i -a $thunar_on_this_desk
  15.     else
  16.         # no thunars on current desktop, so open a new one
  17.         wmctrl -x -R $thunar_wm_class
  18.     fi;
  19. fi;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement