From a689a00cb175fc94431881b0aab4e1879b8afb11 Mon Sep 17 00:00:00 2001 From: bsp Date: Tue, 5 Nov 2013 01:51:31 +0100 Subject: [PATCH] op_xfcemenu.sh: Changed to bsp's script (slightly modified) which works with the menu-button anywhere and hidden. --- .../pandora-scripts/op_xfcemenu.sh | 38 +++++++++++++++---- 1 file changed, 30 insertions(+), 8 deletions(-) mode change 100644 => 100755 recipes/pandora-system/pandora-scripts/op_xfcemenu.sh diff --git a/recipes/pandora-system/pandora-scripts/op_xfcemenu.sh b/recipes/pandora-system/pandora-scripts/op_xfcemenu.sh old mode 100644 new mode 100755 index 45d7fab..7af8ced --- a/recipes/pandora-system/pandora-scripts/op_xfcemenu.sh +++ b/recipes/pandora-system/pandora-scripts/op_xfcemenu.sh @@ -1,9 +1,31 @@ #!/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 -- 2.39.5