Skip to content

Instantly share code, notes, and snippets.

@SergKolo
Created September 30, 2017 16:57
Show Gist options
  • Save SergKolo/a072b4d49f90ee65beb4ef3b1a3d266e to your computer and use it in GitHub Desktop.
Save SergKolo/a072b4d49f90ee65beb4ef3b1a3d266e to your computer and use it in GitHub Desktop.
very old script, I wrote better code afterwards. This is kept just for nostalgic purposes
#!/bin/bash
get_screen_geometry()
{
xwininfo -root | awk '/-geometry/{gsub(/+|x/," ");print $2,$3}'
}
SCHEMA="org.compiz.core:/org/compiz/profiles/unity/plugins/core/"
read screen_width screen_depth <<< "$(get_screen_geometry)"
hsize=$(gsettings get $SCHEMA hsize)
vsize=$(gsettings get $SCHEMA vsize)
declare -a viewports
y=0
for vertical in $(seq 1 $vsize); do
x=0
for horizontal in $(seq 1 $hsize); do
viewports+=( $( echo $y:$x ) )
x=$(($x+$screen_width))
done
y=$(($y+$screen_depth))
done
i=1
while [ $i -le ${#viewports[@]} ];
do
echo "Viewport $i is ${viewports[$(($i-1))]}"
i=$(($i+1))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment