lock Screen using i3

I use i3 for a short time now (hosted by ArcoLinux) and it’s great. It’s fast – even on older hardware – and after a while easy to use. One thing that’s not working out of the box is to lock the screen after a specific time of inactivity. That’s how I did it…

First I installed xautolock and i3lock:

pacman -S xautolock i3lock

Afterwards the configuration of i3 – located in ~/.config/i3/config – had to be modified:

#Press $mod (super) and X to exit - check toolbar for next choices
bindsym $mod+X mode "$mode_system"
bindsym control+mod1+Delete mode "$mode_system"

set $Locker i3lock --color=000000 && sleep 1

set $mode_system System (k) lock, (l) logout, (u) suspend, (h) hibernate, (r) reboot, (s) shutdown
mode "$mode_system" {
bindsym k exec --no-startup-id $Locker, mode "default"
bindsym l exec --no-startup-id ~/.config/i3/scripts/i3exit.sh logout, mode "default"
bindsym u exec --no-startup-id ~/.config/i3/scripts/i3exit.sh suspend, mode "default"
bindsym h exec --no-startup-id ~/.config/i3/scripts/i3exit.sh hibernate, mode "default"
bindsym r exec --no-startup-id ~/.config/i3/scripts/i3exit.sh reboot, mode "default"
bindsym s exec --no-startup-id ~/.config/i3/scripts/i3exit.sh shutdown, mode "default"

# back to normal: Enter or Escape
bindsym Return mode "default"
bindsym Escape mode "default"

exec --no-startup-id xautolock -time 5 -locker 'i3lock --color=000000' -corners +00-

The bold text are modified lines. These settings activates the screenlock by hitting MOD+x k or automatically after five minutes of inactivity.

There’s one question left: How am I able to restart xautolock daemon without restarting my PC?

Ein Gedanke zu „lock Screen using i3“

  1. I didn‘ test this case, but maybe you can use
    ‚exec_always [command]‘
    instead of
    ‚exec [command]‘
    So everytime i3wm gets restartet by a re-login, its gonna be executed (by exec_always).

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.