ascii squares

■□

Should look like this with Cuprum font

image/svg+xml ■□

See ‘desktop pager with text’ example.

xprop

# current desktop
xprop -root | grep "CURRENT_DESKTOP(CARDINAL)

# how many are there
xprop -root | grep "NUMBER_OF_DESKTOPS(CARDINAL)"

-spy Examine window properties forever, looking for property change events.

continuous desktop spy

#!/bin/bash

# spyDesk 

# continuous desktop spy, to be used in tint2 
# executor scripts with 'execp_continuous = 1'

count=0

(xprop -root -spy _NET_CURRENT_DESKTOP)  | 
while read
do

    ((count+=1))

    read -r _ _ desk <<< $(xprop -root _NET_CURRENT_DESKTOP) && ((desk+=1))
    read -r _ _ num <<< $(xprop -root _NET_NUMBER_OF_DESKTOPS)
    
    >&2 echo "($count) desktop $desk / $num"
    
    # some real code here

done

Full example.

and similar resolution-change snifer

#!/bin/bash

# spyRes

count=0

(xprop -root -spy _NET_DESKTOP_GEOMETRY)  | 
while read
do
    ((count+=1))
    >&2 echo "($count) resolution changed"
    
    # however this fires a bit to often, so some sort of logic to limit that should be here.
    
done
about / github / jekyll