Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- terminal_wm_class="Terminal"
- terminal_exec="Terminal"
- # no terminal started, so start one
- if [ -z "`wmctrl -lx | grep Terminal`" ]; then
- $terminal_exec &
- else
- # search for existing terminals on current desktop
- current_desk=`wmctrl -d | grep '*' | cut -d ' ' -f 1`
- term_on_this_desk=`wmctrl -lx | grep "$current_desk[ ]*$terminal_wm_class" | cut -d ' ' -f 1`
- if [ -n "$term_on_this_desk" ]; then
- wmctrl -i -a $term_on_this_desk
- else
- # no terminals on current desktop, so just open a new one
- wmctrl -x -R $terminal_wm_class
- fi;
- fi;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement