Guest User

Untitled

a guest
Nov 18th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Will maximize the current window to a new desktop, or, if the window is not
  4. # Use your window manager's keybindings to attach this script to the key combination of your choice
  5. # Requires the following packages in Ubuntu:
  6. # xdotool x11-utils wmctrl
  7.  
  8. function goFull() {
  9. echo $1
  10. DESKTOP=`wmctrl -d | cut -d \ -f 1 | tail -1`
  11. wmctrl -ir $1 -b add,fullscreen
  12. wmctrl -ir $1 -t $DESKTOP
  13. wmctrl -s $DESKTOP
  14. }
  15. function unFull() {
  16. wmctrl -ir $1 -b remove,fullscreen
  17. wmctrl -ir $1 -t 0
  18. wmctrl -s 0
  19. }
  20. WINDOW_ID="$(printf 0x%08x $(xdotool getactivewindow))"
  21. echo $WINDOW_ID
  22. IS_FULL="$(xprop -id $WINDOW_ID | grep '_NET_WM_STATE(ATOM)' | grep '_NET_WM_STATE_FULLSCREEN')"
  23. echo $IS_FULL
  24. if [[ -n "$IS_FULL" ]]; then
  25. unFull $WINDOW_ID
  26. else
  27. goFull $WINDOW_ID
  28. fi
Add Comment
Please, Sign In to add comment