Arch-Linux

Arch linux:i3wm 設置鎖定超時(xss-lock i3lock)

  • July 10, 2021

我將arch與i3wm一起使用。我在我的.config/i3/config

exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock

問題是我的電腦每 10 分鐘鎖定一次。如何設置兩小時鎖定超時?

這是我的xset q輸出:

Keyboard Control:
 auto repeat:  on    key click percent:  0    LED mask:  00000000
 XKB indicators:
   00: Caps Lock:   off    01: Num Lock:    off    02: Scroll Lock: off
   03: Compose:     off    04: Kana:        off    05: Sleep:       off
   06: Suspend:     off    07: Mute:        off    08: Misc:        off
   09: Mail:        off    10: Charging:    off    11: Shift Lock:  off
   12: Group 2:     off    13: Mouse Keys:  off
 auto repeat delay:  660    repeat rate:  25
 auto repeating keys:  00ffffffdffffbbf
                       fadfffefffedffff
                       9fffffffffffffff
                       fff7ffffffffffff
 bell percent:  50    bell pitch:  400    bell duration:  100
Pointer Control:
 acceleration:  2/1    threshold:  4
Screen Saver:
 prefer blanking:  yes    allow exposures:  yes
 timeout:  600    cycle:  600
Colors:
 default colormap:  0x22    BlackPixel:  0x0    WhitePixel:  0xffffff
Font Path:
 /usr/share/fonts/misc,/usr/share/fonts/TTF,/usr/share/fonts/OTF,/usr/share/fonts/100dpi,/usr/share/fonts/75dpi,built-ins
DPMS (Energy Star):
 Standby: 600    Suspend: 600    Off: 600
 DPMS is Enabled
 Monitor is On

我通過添加/etc/X11/xorg.conf.d/30-dpms.conf包含以下內容解決了這個問題:

Section "ServerFlags"
   Option "StandbyTime" "90"
   Option "SuspendTime" "90"
   Option "OffTime" "90"
   Option "BlankTime" "90"
EndSection

90代表90分鐘

實現它的一種方法是使用 xset 設置螢幕超時。

xset dpms 0 0 300

300等於五分鐘。

兩個小時7200

您可以將以下內容添加到 i3 配置文件的自動啟動部分,以便將螢幕時間設置為關閉並在發生時觸發 i3lock。

五分鐘不活動,關閉螢幕並鎖定:

always_exec --no-startup-id xset dpms 0 0 300 &
always_exec --no-startup-id xss-lock -- i3lock -n -i background_image.png &

如果要暫停電腦,請添加相應的參數。

注意:xss-lock當您的電腦休眠或掛起時也會觸發。

引用自:https://unix.stackexchange.com/questions/638744