karpathy / ulogme

Automatically collect and visualize usage statistics in Ubuntu/OSX environments.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with xscreensaver

gmar5 opened this issue · comments

commented

Hi,

When I run logactivewin.sh in Xfce I get the following error: no saver status on root window., and only __LOCKEDSCREEN is logged.

I assume it is a problem of when it checks the screensaver (I had to install xscreensaver in the first place, as it wouldn't work otherwise; and I don't see why this should be required).

I have seen here a similar problem related to the gnome-screensaver: #24

I am not familiar with the language, so I'm not of much help. Does anybody know what needs to be fixed?
I assume it would be here?

do
    islocked=true
    # Try to figure out which Desktop Manager is running and set the
    # screensaver commands accordingly.
    if [[ $GDMSESSION == 'xfce' ]]; then
        # Assume XFCE folks use xscreensaver (the default).
        screensaverstate=$(xscreensaver-command -time | cut -f2 -d: | cut -f2-3 -d' ')
        if [[ $screensaverstate =~ "screen non-blanked" ]]; then islocked=false; fi
    elif [[ $GDMSESSION == 'ubuntu' || $GDMSESSION == 'ubuntu-2d' || $GDMSESSION == 'gnome-shell' || $GDMSESSION == 'gnome-classic' || $GDMSESSION == 'gnome-fallback' || $GDMSESSION == 'cinnamon' ]]; then
        # Assume the GNOME/Ubuntu/cinnamon folks are using gnome-screensaver.
        screensaverstate=$(gnome-screensaver-command -q 2>&1 /dev/null)
        if [[ $screensaverstate =~ .*inactive.* ]]; then islocked=false; fi
    elif [[ $XDG_SESSION_DESKTOP == 'KDE' ]]; then
        islocked=$(qdbus org.kde.screensaver /ScreenSaver org.freedesktop.ScreenSaver.GetActive)
    else
        # If we can't find the screensaver, assume it's missing.
        islocked=false
    fi

    if [ $islocked = true ]; then
        curtitle="__LOCKEDSCREEN"
    else 
        id=$(xdotool getactivewindow)
        curtitle=$(wmctrl -lpG | while read -a a; do w=${a[0]}; if (($((16#${w:2}))==id)) ; then echo "${a[@]:8}"; break; fi; done)
    fi

    perform_write=false

Here is xscreensaver-command as possible reference: https://github.com/danfuzz/xscreensaver/blob/master/driver/xscreensaver-command.c

Thank you!

commented

I have found out that the script runs without that error only after I turn the screensaver on and I manually make it start once. Any ideas on how to avoid this?

commented

Related to this (I think), it does not perceive when the system is suspended, as if there's no change in active window. Instead of the locked screen flag, it just doesn't break the block for the window that was active before suspend.

Sorry to insist. It would look like the problem should be common to all those using Xfce.

Potential necrobump...just encountering this today. XFCE as well however I think this (for me) has to do with multi GPU and xscreensaver is confused. I've tried launching specifying a GPU but no dice, everything returns "no saver status on root window."

When I add it to the xfce session it seems to work but running it after the session gives the error. Not sure why this is given it should be run as/for the same user and I can't suss out any special launch args in how the session launches it but I'm also not going to dig deep. Just frustrating fix one thing expose another.