Skip to content

Instantly share code, notes, and snippets.

@murarisumit
Last active August 29, 2015 14:16
Show Gist options
  • Save murarisumit/683e29ce8d2781953e6b to your computer and use it in GitHub Desktop.
Save murarisumit/683e29ce8d2781953e6b to your computer and use it in GitHub Desktop.
Move windows side by side xfce. Vertically Maximized xfce
#!/bin/bash
# resizes the window to full height and 50% width and moves into upper right corner
#define the height in px of the top system-bar:
TOPMARGIN=27
#sum in px of all horizontal borders:
RIGHTMARGIN=10
# get width of screen and height of screen
SCREEN_WIDTH=$(xwininfo -root | awk '$1=="Width:" {print $2}')
SCREEN_HEIGHT=$(xwininfo -root | awk '$1=="Height:" {print $2}')
# new width and height
W=$(( $SCREEN_WIDTH / 2 - $RIGHTMARGIN ))
H=$(( $SCREEN_HEIGHT - 2 * $TOPMARGIN ))
# X, change to move left or right:
# moving to the right half of the screen:
#X=$(( $SCREEN_WIDTH / 2 ))
# moving to the left:
X=0;
Y=$TOPMARGIN
wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz && wmctrl -r :ACTIVE: -e 0,$X,$Y,$W,$H
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment