21

xss-lock, systemd 实现自动锁屏和休眠

 3 years ago
source link: https://rapiz.me/2019/lock-and-suspend/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

xss-lock, systemd 实现自动锁屏和休眠

适用于无电源管理服务且运行 xorg 的环境

In ENV By Rapiz 2019-08-28 Linux i3,xss-lock,电源管理,自动休眠

Overview

i3wm 没有电源管理,在其他桌面环境中的自动锁屏、自动休眠等设置需要用户自己通过其他软件实现。

  1. 使用 systemd 执行挂起和自动挂起操作
  2. 使用 xss-lock 在挂起前运行锁屏脚本
  3. 使用 xset 禁用 DPMS

systemd

sudo systemctl suspend 挂起

logind

配置 logind 能够在空闲一定时间后执行指定操作。

/etc/systemd/login.conf

[Login]
IdleAction=suspend
IdleActionSec=10min

空闲 10 分钟后挂起

xss-lock

能够在 systemd suspend 前自动运行锁屏脚本,并在 xset 设置的时间 dim 屏幕

示例:xss-locker -n dim-screen.sh -- locker

启动 wm 时自动调用 xsetxss-lock

exec --no-startup-id xset s 60 60
exec --no-startup-id xset -dpms
exec --no-startup-id xss-lock -n ~/Source/cmdlet/dim-screen.sh -- locker
s

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK