#!/bin/bash
-. /usr/pandora/scripts/op_paths.sh
+. /usr/pandora/scripts/op_common.sh
+xfceuser=$(get_user)
+xfceuser_home=$(get_user_home)
# XXX: better use lockfile (or something), but it's not in current firmware
test -e /tmp/op_power.lock && exit 2
return 1 # 0 when debugging, 1 when not
}
-test -e $(grep /etc/passwd -e ^$(ps u -C xfce4-session | tail -n1 | awk '{print $1}'): | cut -f 6 -d ":")/.lidconfig && lidconfig=$(cat $(grep /etc/passwd -e ^$(ps u -C xfce4-session | tail -n1 | awk '{print $1}'): | cut -f 6 -d ":")/.lidconfig) # read lid conf. file if it exists
-
-#powerbuttonconfig=$(cat $(grep /etc/passwd -e ^$(ps u -C xfce4-session | tail -n1 | awk '{print $1}'): | cut -f 6 -d ":")/.powerbuttonconfig)
+test -e $xfceuser_home/.lidconfig && lidconfig=$(cat $xfceuser_home/.lidconfig) # read lid conf. file if it exists
if [ -e /tmp/powerstate ]; then
powerstate="$(cat /tmp/powerstate)"
show_message() {
# TODO: check if desktop is visible; maybe use layer3?
- xfceuser=$(ps u -C xfce4-session | tail -n1 | awk '{print $1}')
cmd="DISPLAY=:0.0 zenity --info --text \"$1\" --timeout 10"
su -c "$cmd" $xfceuser
}
}
shutdown(){ # warns the user and shuts the pandora down
- xfceuser=$(ps u -C xfce4-session | tail -n1 | awk '{print $1}')
time=5
countdown () {
for i in $(seq $time); do