op_xfcemenu.sh: Changed to bsp's script (slightly modified) which works with the...
authorbsp <bs@tkscript.de>
Tue, 5 Nov 2013 00:51:31 +0000 (01:51 +0100)
committerMichael Mrozek <EvilDragon@openpandora.org>
Tue, 5 Nov 2013 00:51:31 +0000 (01:51 +0100)
recipes/pandora-system/pandora-scripts/op_xfcemenu.sh [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 45d7fab..7af8ced
@@ -1,9 +1,31 @@
 #!/bin/bash
 #!/bin/bash
-POSMENU=`DISPLAY=:0.0 xwininfo -name xfce4-menu-plugin | egrep 'Absolute upper-left X|Absolute upper-left Y' | awk '{print $4}'`
-Xold=`DISPLAY=:0.0 xdotool getmouselocation | awk  '{print $1}' | sed 's/^..//'`
-Yold=`DISPLAY=:0.0 xdotool getmouselocation | awk  '{print $2}' | sed 's/^..//'`
-Xnew=`echo $POSMENU|awk '{print $1}'`
-Ynew=`echo $POSMENU|awk '{print $2}'`
-DISPLAY=:0.0 xdotool mousemove $Xnew $Ynew
-DISPLAY=:0.0 xdotool click 1
-DISPLAY=:0.0 xdotool mousemove $Xold $Yold
+
+#
+# Show or hide XFCE application/popup menu when Pandora key is pressed.
+# Enhanced by bsp
+#
+
+function loc_menu_show {
+  xfce4-popup-menu
+}
+
+function loc_menu_hide {
+  WINID=`xwininfo -name xfce4-menu-plugin|grep 'Window id:'|awk '{print $4}'`
+  xdotool keydown --window $WINID Escape
+}
+
+MENU_SY=`xwininfo -name xfce4-menu-plugin|grep Height|awk '{print $2}'`
+
+if [ 1 -eq $MENU_SY ]; then
+  # panel is in auto-hide mode and the menu is currently invisible
+  loc_menu_show
+else
+  # hack to determine whether the menu is visible, regardless of the panel auto-hide mode
+  NUM_MENU_WINDOWS=`xwininfo -tree -root | grep 'xfce4-menu-plugin' | wc -l`
+  echo $NUM_MENU_WINDOWS
+  if [ $NUM_MENU_WINDOWS -gt 4 ]; then
+    loc_menu_hide
+  else
+    loc_menu_show
+  fi
+fi