pandora-scripts: try to fix currentuser/home mess
[openpandora.oe.git] / recipes / pandora-system / pandora-scripts / op_menu.sh
index 43e3c41..e8ebf36 100644 (file)
@@ -1,11 +1,14 @@
 #!/bin/bash
-#actions done when the menu button is pressed
-#only argument is the time the button was pressed in  seconds
+# 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
 
+. /usr/pandora/scripts/op_common.sh
+xfceuser=$(get_user)
+
 do_kill()
 {
   for PID in "$@"; do
@@ -31,8 +34,6 @@ fi
 xpid=$(pidof xfce4-session)
 if [ $xpid ]; then
   echo "xfce4 is running"
-  # note: max username length ps can output is 19, otherwise it prints uid
-  xfceuser=$(ps -o user:20= -C xfce4-session | tail -n1 | awk '{print $1}')
   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/')