From e1e64203a754f0f2b5a9396a9e44bcd25b34316d Mon Sep 17 00:00:00 2001 From: Grazvydas Ignotas Date: Sat, 2 Nov 2013 18:56:38 +0200 Subject: [PATCH] op_menu: try to be a bit more useful holding pandora key may be able to kill programs under xfce too --- .../pandora-system/pandora-scripts/op_menu.sh | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/recipes/pandora-system/pandora-scripts/op_menu.sh b/recipes/pandora-system/pandora-scripts/op_menu.sh index 8ec9fd8..b7c2dba 100644 --- a/recipes/pandora-system/pandora-scripts/op_menu.sh +++ b/recipes/pandora-system/pandora-scripts/op_menu.sh @@ -2,8 +2,30 @@ #actions done when the menu button is pressed #only argument is the time the button was pressed in seconds +if [ -x /usr/pandora/scripts/op_menu_custom.sh ]; then + exec /usr/pandora/scripts/op_menu_custom.sh "$@" +fi + +do_kill() +{ + for PID in "$@"; do + kill $PID + done + sleep 1 + for PID in "$@"; do + kill -9 $PID + done +} + if [ "$1" -ge "2" ]; then #button was pressed 3 sec or longer, show list of apps to kill instead of launcher killist=y + + # if something uses fb1 or SGX, try killing them instead + fb_users=`lsof -t /dev/fb1 /dev/pvrsrvkm` + if [ -n "$fb_users" ]; then + do_kill $fb_users + fi + exit 1 fi xpid=$(pidof xfce4-session) @@ -14,10 +36,7 @@ if [ $xpid ]; then if [ $killist ]; then echo "displaying kill list" pidlist=$(pstree -lpA | grep pnd_run.sh | sed -ne 's/.*-\(.*\)(\([0-9]\+\))/\2\n \1/p' | su -c 'DISPLAY=:0.0 zenity --list --multiple --column "pid" --column "name" --title "kill" --text "which apps should be killed"' - $xfceuser | sed 's/|/\n/') - for PID in $pidlist - do - kill -9 $PID - done + do_kill $pidlist else # echo "starting appfinder" # invoke the appfinder; nice app, but it takes a few seconds to come up @@ -28,8 +47,5 @@ if [ $xpid ]; then else echo "no x, killing all pnd aps so x or DE gets restarted" pidlist=$(pstree -lpA | grep pnd_run.sh | sed -ne 's/.*(\([0-9]\+\))/\1/p') - for PID in $pidlist - do - kill -9 $PID - done + do_kill $pidlist fi -- 2.39.2