prezto/modules/notify/functions/focused_window_id

21 lines
456 B
Text
Raw Normal View History

2013-06-13 12:19:10 -04:00
# Gets the id of the current focused window.
#
# Authors:
# Alex Reece <awreece@gmail.com>
#
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