This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If we're running in X, automatically alert when a command ends on another workspace | |
if [ -n "$WINDOWID" ]; then | |
function maybeAlert { | |
local icon=`[ $? = 0 ] && echo terminal || echo error` | |
local lastCommand=`history 1 | sed -e 's/^\s*[0-9]\+\s*//'` | |
local desktop=`xprop -id $WINDOWID _NET_WM_DESKTOP | cut -d ' ' -f 3` | |
local current=`xprop -root _NET_CURRENT_DESKTOP | cut -d ' ' -f 3` | |
if [ "$desktop" != "$current" ]; then | |
local message="On workspace $(($desktop+1))" | |
notify-send --urgency=low -i "$icon" "$lastCommand" "$message" |