Advertisement
Guest User

toggle-xterm

a guest
Jan 7th, 2012
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.30 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # mfk
  4. #
  5. # usage: toggle-xterm COMMAND
  6. #
  7. # if COMMAND is running in an xterm close the term; otherwise start  COMMAND in
  8. # an xterm.
  9. #
  10. # requires wmctrl
  11.  
  12. title="|> $@ <|"
  13. if wmctrl -l | grep "$title" >/dev/null ; then
  14.     wmctrl -F -c "$title"
  15. else
  16.     xterm -T "$title" -e $@ &
  17. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement