Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Will maximize the current window to a new desktop, or, if the window is not
- # Use your window manager's keybindings to attach this script to the key combination of your choice
- # Requires the following packages in Ubuntu:
- # xdotool x11-utils wmctrl
- function goFull() {
- echo $1
- DESKTOP=`wmctrl -d | cut -d \ -f 1 | tail -1`
- wmctrl -ir $1 -b add,fullscreen
- wmctrl -ir $1 -t $DESKTOP
- wmctrl -s $DESKTOP
- }
- function unFull() {
- wmctrl -ir $1 -b remove,fullscreen
- wmctrl -ir $1 -t 0
- wmctrl -s 0
- }
- WINDOW_ID="$(printf 0x%08x $(xdotool getactivewindow))"
- echo $WINDOW_ID
- IS_FULL="$(xprop -id $WINDOW_ID | grep '_NET_WM_STATE(ATOM)' | grep '_NET_WM_STATE_FULLSCREEN')"
- echo $IS_FULL
- if [[ -n "$IS_FULL" ]]; then
- unFull $WINDOW_ID
- else
- goFull $WINDOW_ID
- fi
Add Comment
Please, Sign In to add comment