I recently discovered that Linux Mint lets you use the Super/Win key plus left, right, up, down to control the current window size (window left, window right, maximize, unmaximize, respectively!), which is awesome. But I also like my windows centred with the old high resolution monitor. Hence…
This is a bash script to move and resize the active window to 65% of the screen width for anybody who might need it.
You’ll need xdotool
and wmctrl
installed.
#!/bin/sh Xaxis=$(xrandr --current | grep '*+' | uniq | awk '{print $1}' | cut -d 'x' -f1) Yaxis=$(xrandr --current | grep '*+' | uniq | awk '{print $1}' | cut -d 'x' -f2) WIDTH=$(echo "scale=0;$Xaxis*.65"|bc) HEIGHT=$Yaxis X=$(echo "scale=0;$Xaxis/2-$WIDTH/2"|bc) Y=0 WIN=`xdotool getactivewindow` echo Resolution: $Xaxis x $Yaxis echo New dimensions: $WIDTH x $HEIGHT echo New position: $X x $Y # unmaximize wmctrl -r :ACTIVE: -b remove,maximized_vert,maximized_horz xdotool windowmove $WIN $X $Y xdotool windowsize $WIN $WIDTH $HEIGHT
Thanks: