2013-06-13 12:19:10 -04:00
|
|
|
# Gets the id of the current focused window.
|
|
|
|
#
|
|
|
|
# Authors:
|
|
|
|
# Alex Reece <awreece@gmail.com>
|
|
|
|
#
|
|
|
|
|
2013-06-13 16:22:53 -04:00
|
|
|
case "$OSTYPE" in
|
|
|
|
(darwin*)
|
2013-06-14 20:00:09 -04:00
|
|
|
osascript -e 'tell application (path to frontmost application as text) ¬' \
|
|
|
|
-e ' to get id of front window'
|
2013-06-13 16:22:53 -04:00
|
|
|
;;
|
|
|
|
(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
|