Hello,
As promised the adjusted desktop script (~/.config/tint2/scripts/desktop).
This script does three things, give info (name) of desktop, provide current desktop number and switch between desktops with next/prev. The first and last option is invoked by the tint2 executor in Nordic tint2 panel. The info for the desktop name, executed every second. The next/prev on mouswheel turn on the desktop name label.
#!/bin/bash
function get_current_desktop {
DSK=($(wmctrl -d | grep \* | tr -s ' ' | cut -d' ' -f1,10))
CUR_DSK=${DSK[0]}
CUR_DSK_NAME=${DSK[1]}
}
function get_desktop_count {
MAX_DSK=$(wmctrl -d | wc -l)
}
function switch_desktop {
get_current_desktop
get_desktop_count
MAX_IDX=$((MAX_DSK-1))
# BootZ - 06 January 2023
# changed from CUR_DSK+1 to CUR_DSK+$1, desktop number now changes
# accordingly to wheel movement (up=+/down=-)
NEW_DSK=$((CUR_DSK+$1))
if [ "$NEW_DSK" -lt 0 ]; then
NEW_DSK=${MAX_IDX}
elif [ "$NEW_DSK" -gt "$MAX_IDX" ]; then
NEW_DSK=0
fi
wmctrl -s $NEW_DSK
}
case "$1" in
info)
get_current_desktop
echo "<small>$CUR_DSK_NAME</small>"
;;
number)
get_current_desktop
echo $CUR_DSK
;;
next)
switch_desktop 1
;;
prev)
switch_desktop -1
;;
*)
echo "WRONG INPUT"
;;
esac