Desktop Switch Notification Linux

From Hack Sphere Labs Wiki
Jump to: navigation, search

script


#!/bin/bash
#Description: Using notify-send, pop-up the current workspace number when changing workspaces
#Requires: xfce4-notifyd, libnotify, wmctrl

CURRENT_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))
while true
do
        sleep 1
        NEW_WORKSPACE=$(($(wmctrl -d | grep \* | cut -d' ' -f1)+1))
        if [ $CURRENT_WORKSPACE -ne $NEW_WORKSPACE ]; then
                notify-send -t 500 " workspace" "<b><span font='100'>$NEW_WORKSPACE</span></b>"
                CURRENT_WORKSPACE=$NEW_WORKSPACE
        fi
done
exit 0