Skip to content

Instantly share code, notes, and snippets.

@jstaursky
Last active December 13, 2022 13:59
Show Gist options
  • Save jstaursky/29ae4f1f24cb9976839dd99721e54165 to your computer and use it in GitHub Desktop.
Save jstaursky/29ae4f1f24cb9976839dd99721e54165 to your computer and use it in GitHub Desktop.
bash/zsh scripts to resize and move window apps.
#!/usr/bin/env zsh
# get size and position of window - terminal command: xwininfo
screen_width=3440
screen_height=1411
widthOneThird=$((screen_width/3))
# ### window position ###
# ______+x
# |
# |
# y+
top_window_edge=24
left_window_edge=$((0 * ${widthOneThird}))
# window position = Absolute upper-left X, Absolute upper-left Y
xdotool windowmove $(xdotool getwindowfocus) ${left_window_edge} ${top_window_edge}
# ### window size ###
# Need to take into account system menu bar
height=$((${screen_height} - ${top_window_edge}))
xdotool windowsize $(xdotool getwindowfocus) ${widthOneThird} ${height}
#!/usr/bin/env zsh
# get size and position of window - terminal command: xwininfo
screen_width=3440
screen_height=1411
widthOneThird=$((screen_width/3))
# ### window position ###
# ______+x
# |
# |
# y+
top_window_edge=24
left_window_edge=$((1 * ${widthOneThird}))
# window position = Absolute upper-left X, Absolute upper-left Y
xdotool windowmove $(xdotool getwindowfocus) ${left_window_edge} ${top_window_edge}
# ### window size ###
# Need to take into account system menu bar
height=$((${screen_height} - ${top_window_edge}))
xdotool windowsize $(xdotool getwindowfocus) ${widthOneThird} ${height}
#!/usr/bin/env zsh
# get size and position of window - terminal command: xwininfo
screen_width=3440
screen_height=1411
widthOneThird=$((screen_width/3))
# ### window position ###
# ______+x
# |
# |
# y+
top_window_edge=24
left_window_edge=$((2 * ${widthOneThird}))
# window position = Absolute upper-left X, Absolute upper-left Y
xdotool windowmove $(xdotool getwindowfocus) ${left_window_edge} ${top_window_edge}
# ### window size ###
# Need to take into account system menu bar
height=$((${screen_height} - ${top_window_edge}))
xdotool windowsize $(xdotool getwindowfocus) ${widthOneThird} ${height}
#!/usr/bin/env zsh
#!/usr/bin/env zsh
# get size and position of window - terminal command: xwininfo
screen_width=3440
screen_height=1411
windowWidth=$((screen_width/2))
# ### window position ###
# ______+x
# |
# |
# y+
top_window_edge=24
left_window_edge=$((screen_width/4))
# window position = Absolute upper-left X, Absolute upper-left Y
xdotool windowmove $(xdotool getwindowfocus) ${left_window_edge} ${top_window_edge}
# ### window size ###
# Need to take into account system menu bar
height=$((${screen_height} - ${top_window_edge}))
xdotool windowsize $(xdotool getwindowfocus) ${windowWidth} ${height}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment