使用i3lock进行锁屏

我们使用的锁屏方案是3lock-fancy

安装

1
yay -S i3lock-fancy-git

设置休眠前锁屏

创建 /etc/systemd/system/[email protected]
写入:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
[Unit]
Description=User suspend actions
Before=sleep.target

[Service]
User=%I
Type=forking
Environment=DISPLAY=:0
ExecStart=/bin/i3lock-fancy
#ExecStartPost=/usr/bin/sleep 1

[Install]
WantedBy=sleep.target

生效:

1
systemctl enable suspend@storm

合盖睡眠

编辑/etc/systemd/logind.conf
HandleLidSwitch=suspend取消注释
修改为:

1
2
HandleLidSwitch=suspend
# 写入

完成!


附:电源管理

1
2
3
4
5
yay -S tlp tlp-rdw
sudo systemctl enable tlp
sudo systemctl enable NetworkManager-dispatcher
sudo systemctl mask systemd-rfkill.service
sudo systemctl mask systemd-rfkill.socket

/etc/tlp.conf写入:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
##下面的设置可以让设备在接入有线时关闭wifi
DEVICES_TO_DISABLE_ON_LAN_CONNECT="wifi wwan"
DEVICES_TO_DISABLE_ON_WIFI_CONNECT="wwan"
DEVICES_TO_DISABLE_ON_WWAN_CONNECT="wifi"
DEVICES_TO_ENABLE_ON_LAN_DISCONNECT="wifi wwan"
##自动设置CPU调速; 接入电源时设置为performance,
##使用电池时为powersave
CPU_SCALING_GOVERNOR_ON_AC=performance
CPU_SCALING_GOVERNOR_ON_BAT=powersave
#CPU_ENERGY_PERF_POLICY_ON_AC=blance_performance
#CPU_ENERGY_PERF_POLICY_ON_BAT=power
##设置充放电阈值
START_CHARGE_THRESH_BAT0=80
STOP_CHARGE_THRESH_BAT0=90
萌ICP备20241614号