:: Re: [DNG] Question re: screen blank…
Page principale
Supprimer ce message
Répondre à ce message
Auteur: Olaf Meeuwissen
Date:  
À: onefang
CC: dng
Sujet: Re: [DNG] Question re: screen blanking and shutoff
Hi,

onefang writes:

> For what it's worth I just discovered that xscreensaver now has
> xscreensaver-systemd, and is running on my Chimaera desktop. "The
> xscreensaver-systemd program is a helper program to integrate
> xscreensaver with systemd(1)."
>
> I've been having problems with screen blanking / monitor power off
> recently. Can we blame systemd now?
>
> Soooo, I just want to be able to lock the screen manually, or have it
> lock after a configurable time out. Once locked, the monitors should
> be powered down after a short time out. No fancy OpenGL screen
> savers, just blanking, locking, and monitor power off. So waving my
> mouse around or hitting some random key should then bring up a
> password prompt so I can unlock it. Is there something that can do
> that which hasn't been infected with systemd?


I'm using slock (from suckless-tools) on Xfce4 and i3. On Xfce4 it is
executed via xflock4 (a shell script, attached, that also seems to
handle turning off the display's backlight. On i3 I just run it from
dmenu at the moment (still need to configure a keybinding).

slock does not respond to the mouse, only the keyboard. There's no
password dialog, you just start typing your password and the screen
turns blue. On a bad password the screen goes red (after you hit
return). In that case just start typing again.

I don't think it supports configuring an auto-lock time, at least not
with a recompile, but perhaps xss-lock can help with that. Haven't used
it myself (yet?) though. See the manual page at

https://bitbucket.org/raymonad/xss-lock/src/master/doc/xss-lock.1.rst.in

for details.

Hope this helps,
--
Olaf Meeuwissen.
#!/bin/sh
#
#  xfce4
#
#  Copyright (C) 1999, 2003 Olivier Fourdan (fourdan@???)
#  Copyright (C) 2011       Guido Berhoerster (guido+xfce.org@???)
#  Copyright (C) 2011       Jarno Suni (8@???)
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#


# First test for the command set in the session's xfconf channel
LOCK_CMD=$(xfconf-query -c xfce4-session -p /general/LockCommand)

# Lock by xscreensaver or gnome-screensaver, if a respective daemon is running
for lock_cmd in \
    "$LOCK_CMD" \
    "xfce4-screensaver-command --lock" \
    "xscreensaver-command -lock" \
    "light-locker-command --lock" \
    "gnome-screensaver-command --lock" \
    "mate-screensaver-command --lock"
do
    if [ ! -z "$lock_cmd" ]; then
        $lock_cmd >/dev/null 2>&1 && exit
    fi
done


# else run another access locking utility, if installed
for lock_cmd in \
  "xlock -mode blank" \
  "slock"
  do
    set -- $lock_cmd
    if command -v -- $1 >/dev/null 2>&1; then
        $lock_cmd >/dev/null 2>&1 &
    # turn off display backlight:
    xset dpms force off
        exit
    fi
done


# else access locking failed
exit 1