Lid Close Settings


HelenF

Very Active Member
Joined
Jun 22, 2013
Messages
615
Location
UK
I have a CC unit, did a fresh install of SZ 1.54, and upgraded to 1.55.

In Minimenu, Lid-Close-Settings starts up showing the "screen off" setting, and doesn't save changes. pndrun_op_lidsettings.out says,

cat: /.lidconfig: No such file or directory
/usr/pandora/scripts/op_lidsettings.sh: line 17: /.lidconfig: Permission denied"In Minimenu, the setting that was set in XFCE is also ignored when closing the lid.
op_lidsettings.sh refers to the config file as follows:

$(grep /etc/passwd -e $(ps u -C xfce4-session | tail -n1 | awk '{print $1}')| cut -f 6 -d ":")/.lidconfigThis seems to be a roundabout way of getting ~/.lidconfig in XFCE only.
Also, the settings box says "the opposite of the selected action is performed when opening the lid again". I wouldn't expect that to work for the "shut down" option; but it doesn't seem to work for the "low power" option either.
 
You could replace op_lidsettings.sh with an alternative:

Code:
#!/bin/bash

user=$(cat /tmp/currentuser)

# change what to do when the lid is closed/opened
case "$(cat /home/$user/.lidconfig)" in
"lowpower")
current="the Pandora goes into low power mode"
;;
"shutdown")
current="the Pandora is shut down"	
;;
*)
current="the screen is turned off"
;;
esac

sel=$(zenity --title="Lid settings" --height=250 --list --column "id" --column "Please select" --hide-column=1 --text="What should happen when you close the Pandora's lid?\n(the opposite of the selected action is performed when opening the lid again)\nAt the moment $current when you close the lid." "brightness" "Turn off the screen." "lowpower" "Go into low power mode (same as when pressing the
power button for less than 3 seconds)" "shutdown" "Shut the pandora down.") || exit
echo "$sel" > /home/$user/.lidconfig
(This is taken from switchgui: openbox, which has the same problem as minimenu, in that xfce4-session isn't running).
 
I guess I'd need to change that filepath in op_power.sh too.

In XFCE, is it normal that if I choose the "low power" option, opening the lid again doesn't wake the Pandora from low power mode? (Either it's not behaving as it should, or the description is incorrect.)

Also, I know the OS was configured so that PNDs don't accidentally use the home directory. But does that mean there isn't a standard way of referring to the home directory when it's really wanted?
 
1) Yep - you'd need to change op_power too (I forgot about that).

2) I think it's always been the case that waking from lowpower has required opening the lid + pressing a button (although it's not something I've used much).

3) It's not really to do with PNDs - the pandora scripts use a convoluted way of find the home directory because they're running as root. Every other program or script can just access the $HOME environment variable.
 
Oh well, I might just leave it alone then.

Lid-Close-Settings is a PND, and it's run as the current user. If I remember correctly, referencing the $HOME environment variable from a PND gives the PND's appdata directory, and this was done to avoid writing to NAND unintentionally (especially with ported apps).
 
Sorry. Yeah - you're right about op_lidsettings.sh. Since it's run from a PND, it doesn't really need to do either the "owner of xfce4-session" or "/tmp/currentuser" trick to find the user's home directory. Whilst the HOME environment variable does indeed refer to the PND's appdata directory (for the reason you said), it could use the REAL_HOME environment variable to get the directory on the NAND. It might be a historic thing then, as REAL_HOME is a relatively recent introduction to pnd_run.

Re: the owner being root: this is true for other scripts though (like op_power.sh), since they're triggered by a daemon that detects external events (like the lid being shut, or the power button being pressed). So they don't have a standard way of accessing the user's home directory, but for a different reason than PNDs used to.

If you still want to replace op_power.sh, there's a version here that should work when MiniMenu is running.
 
Thanks for the explanation.

I'm going to leave it alone because the Pandora doesn't wake up again when reopening the lid.

In future firmware versions, I think it would make sense to fix the setting so it works in Minimenu, and remove the text "the opposite of the selected action is performed when opening the lid again".
 
Back
Top