On Thu, 2008-04-10 at 08:09 +0000, Andrew Oakley wrote:
> Fair enough. The next best situation for Hardy, would be to perfect my
> workaround script /etc/acpi/local/lid.sh.pre (
> https://bugs.launchpad.net/ubuntu/+source/gnome-power-
> manager/+bug/41994/comments/21 )
>
> Currently the script detects the XAUTHORITY and DISPLAY environment
> variables in this manner:
>
> export XAUTHORITY=`ls -1 /home/*/.Xauthority`
> export DISPLAY=:0
>
> This is unreliable as I understand things (which may be wrong), since
> with multiple concurrent logged-on desktop users ("switch users"), there
> may be more than one .Xauthority file and more than one display.
>
> How, in a shell script or similar, can I detect the currently active
> console .Xauthority and currently active console display, even if there
> are multiple concurrent desktop users logged in?
using the dbus-send command line tools to query the current session and
figure out it's properties. This should work with fast-user switching
and other technologies.
On Thu, 2008-04-10 at 08:09 +0000, Andrew Oakley wrote: local/lid. sh.pre ( /bugs.launchpad .net/ubuntu/ +source/ gnome-power- +bug/41994/ comments/ 21 ) /.Xauthority`
> Fair enough. The next best situation for Hardy, would be to perfect my
> workaround script /etc/acpi/
> https:/
> manager/
>
> Currently the script detects the XAUTHORITY and DISPLAY environment
> variables in this manner:
>
> export XAUTHORITY=`ls -1 /home/*
> export DISPLAY=:0
>
> This is unreliable as I understand things (which may be wrong), since
> with multiple concurrent logged-on desktop users ("switch users"), there
> may be more than one .Xauthority file and more than one display.
>
> How, in a shell script or similar, can I detect the currently active
> console .Xauthority and currently active console display, even if there
> are multiple concurrent desktop users logged in?
You can use ConsoleKit:
http:// people. freedesktop. org/~mccann/ doc/ConsoleKit/ ConsoleKit. html
using the dbus-send command line tools to query the current session and
figure out it's properties. This should work with fast-user switching
and other technologies.