Skip to content

Instantly share code, notes, and snippets.

@neowinx
Created August 16, 2018 19:20
Show Gist options
  • Save neowinx/4e119b066e393af494b7c7565e45cbd7 to your computer and use it in GitHub Desktop.
Save neowinx/4e119b066e393af494b7c7565e45cbd7 to your computer and use it in GitHub Desktop.
Move to next Desktop Geometry. Useful when assigned to a hotkey whitin XFCE desktop manager
#!/bin/bash
eval $(xdotool getwindowgeometry --shell $(xdotool getactivewindow))
eval $(xdotool getdisplaygeometry --shell)
GEOMETRIES=`xrandr | grep connected | grep -v dis | wc -l`
CURRENT_GEO=0
((CURRENT_MAX=CURRENT_GEO * WIDTH))
echo "$CURRENT_MAX $WIDTH $X"
while [ $X -ge $CURRENT_MAX ]; do
((CURRENT_GEO++))
echo $CURRENT_GEO
((CURRENT_MAX=CURRENT_GEO * WIDTH))
echo $CURRENT_MAX
# uncomment below if you want debug the loop
# sleep 1
done
if [ $CURRENT_GEO == $GEOMETRIES ]; then
CURRENT_GEO=0
fi
echo "NEWX=$CURRENT_GEO * $WIDTH"
((NEWX=CURRENT_GEO * WIDTH))
echo "xdotool windowmove $(xdotool getactivewindow) $NEWX 0"
xdotool windowmove $(xdotool getactivewindow) $NEWX 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment