70 lines
2.2 KiB
Bash
Executable File
70 lines
2.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# 2022 R. Branten
|
|
# ----
|
|
# position windows
|
|
# ----
|
|
# get witdh of screen, not needed as percentages work just fine
|
|
|
|
# check if xdotool is installed
|
|
if ! command -v xdotool &> /dev/null
|
|
then
|
|
notify-send WindowManagement: "xdotool not installed"
|
|
exit
|
|
fi
|
|
|
|
SCREENWIDTH=$(xdpyinfo | awk '/dimensions/{print $2}' | grep -oE ^[[:digit:]]\+)
|
|
SCREENHEIGHT=$(xdpyinfo | awk '/dimensions/{print $2}' | grep -oE [[:digit:]]\+$)
|
|
PANELHEIGHT=$(xdotool getwindowgeometry $(xdotool search --onlyvisible --class 'panel') | awk '/Geometry/{print $2}' | grep -oE [[:digit:]]\+$)
|
|
HEIGHT=$SCREENHEIGHT-$PANELHEIGHT
|
|
|
|
# extract and set argument
|
|
case $1 in
|
|
center) # 100% window size centered
|
|
WIDTH=100%
|
|
HEIGHT=100%
|
|
XPOS=0%
|
|
;;
|
|
center50) # 50% window size smack in the middle
|
|
WIDTH=50%
|
|
XPOS=25%
|
|
;;
|
|
left25) # 25% window size left side of screen
|
|
WIDTH=25%
|
|
XPOS=0%
|
|
;;
|
|
right25) # 25% window size right side of screen
|
|
WIDTH=25%
|
|
XPOS=75%
|
|
;;
|
|
left50) # 25% window size left side of screen
|
|
WIDTH=50%
|
|
XPOS=0%
|
|
;;
|
|
right50) # 25% window size right side of screen
|
|
WIDTH=50%
|
|
XPOS=50%
|
|
;;
|
|
centerleft25) # 25% window size left side of center screen
|
|
WIDTH=25%
|
|
XPOS=25%
|
|
;;
|
|
centerright25) # 25% window size right side of center screen
|
|
WIDTH=25%
|
|
XPOS=50%
|
|
;;
|
|
*)
|
|
exit
|
|
;;
|
|
esac
|
|
|
|
# resize window
|
|
#xdotool getactivewindow windowsize $WIDTH $HEIGHT
|
|
xdotool getactivewindow windowsize $WIDTH 95%
|
|
|
|
# move window to location
|
|
xdotool getactivewindow windowmove $XPOS 0.1
|
|
|
|
# display alert window
|
|
notify-send WindowManagement: "${1}"
|