effigies
November 22nd, 2011, 04:50 AM
I have a script which grabs the DISPLAY my user is on, and runs `gnome-screensaver-command -d` as my user. When I plug my phone in to my computer, the script is run.
Unfortunately, there seems to be a disconnect between the gnome-screensaver run by hitting Ctrl-Alt-L and the one accessed by gnome-screensaver-command... except when run directly from a terminal in gnome.
I am running 11.10 (dist-upgraded from 11.04, which was a clean install), with classic GNOME. To reproduce:
$ gnome-screensaver-command -l && sleep 10s && gnome-screensaver-command -d
Running my script as root in the intervening 10 seconds does not work.
$ sudo su effigies
$ gnome-screensaver-command -l && sleep 10s && gnome-screensaver-command -d
Running my script as root in the intervening 10 seconds does work.
$ ps aux | grep gnome-screensaver
effigies 10167 0.0 0.3 290264 12896 ? Sl 20:27 0:00 /usr/bin/gnome-screensaver --no-daemon
effigies 30536 0.0 0.3 290208 13868 ? Sl 22:19 0:00 /usr/bin/gnome-screensaver --no-daemon
As you can see, there are multiple instances of gnome-screensaver, one which is accessible from the normal collection of terminals in my X session, and one which is accessible otherwise. Killing these processes or restarting the computer does not fix the problem.
The script in question is:
#!/bin/sh
export DISPLAY=`who | grep ^effigies | grep \(: | sed -e 's/.*(\(\:.*\)).*/\1/' | head -n 1`
sudo -u effigies gnome-screensaver-command -d
I have a suspicion that the problem lies in a dbus namespace or something of the sort, but that's a bit beyond my depth/spare time. Anybody have any insight?
Unfortunately, there seems to be a disconnect between the gnome-screensaver run by hitting Ctrl-Alt-L and the one accessed by gnome-screensaver-command... except when run directly from a terminal in gnome.
I am running 11.10 (dist-upgraded from 11.04, which was a clean install), with classic GNOME. To reproduce:
$ gnome-screensaver-command -l && sleep 10s && gnome-screensaver-command -d
Running my script as root in the intervening 10 seconds does not work.
$ sudo su effigies
$ gnome-screensaver-command -l && sleep 10s && gnome-screensaver-command -d
Running my script as root in the intervening 10 seconds does work.
$ ps aux | grep gnome-screensaver
effigies 10167 0.0 0.3 290264 12896 ? Sl 20:27 0:00 /usr/bin/gnome-screensaver --no-daemon
effigies 30536 0.0 0.3 290208 13868 ? Sl 22:19 0:00 /usr/bin/gnome-screensaver --no-daemon
As you can see, there are multiple instances of gnome-screensaver, one which is accessible from the normal collection of terminals in my X session, and one which is accessible otherwise. Killing these processes or restarting the computer does not fix the problem.
The script in question is:
#!/bin/sh
export DISPLAY=`who | grep ^effigies | grep \(: | sed -e 's/.*(\(\:.*\)).*/\1/' | head -n 1`
sudo -u effigies gnome-screensaver-command -d
I have a suspicion that the problem lies in a dbus namespace or something of the sort, but that's a bit beyond my depth/spare time. Anybody have any insight?