# Gets the id of the current focused window. # # Authors: # Alex Reece # case "$OSTYPE" in (darwin*) osascript -e 'tell application (path to frontmost application as text) ¬' \ -e ' to get id of front window' ;; (linux-gnu*) # http://stackoverflow.com/a/8688624/447288 xprop -root -f _NET_ACTIVE_WINDOW 0x ' $0' _NET_ACTIVE_WINDOW \ | awk '{print $2}' ;; (*) return 1 ;; esac