浏览代码

Fix for OS X when no window id is returned (like on the desktop)

Tim O'Brien 10 年之前
父节点
当前提交
98fc8dd91a
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      plugins/bgnotify/bgnotify.plugin.zsh

+ 1 - 1
plugins/bgnotify/bgnotify.plugin.zsh

@@ -24,7 +24,7 @@ currentWindowId () {
   if hash notify-send 2>/dev/null; then #ubuntu!
   if hash notify-send 2>/dev/null; then #ubuntu!
     xprop -root | awk '/NET_ACTIVE_WINDOW/ { print $5; exit }'
     xprop -root | awk '/NET_ACTIVE_WINDOW/ { print $5; exit }'
   elif hash osascript 2>/dev/null; then #osx
   elif hash osascript 2>/dev/null; then #osx
-    osascript -e 'tell application (path to frontmost application as text) to id of front window' 2&> /dev/null
+    osascript -e 'tell application (path to frontmost application as text) to id of front window' 2&> /dev/null || echo "0"
   else
   else
     echo $EPOCHSECONDS #fallback for windows
     echo $EPOCHSECONDS #fallback for windows
   fi
   fi