From 032239e4308687a8a2c121686113a62a75da6e5e Mon Sep 17 00:00:00 2001 From: Hyperling Date: Wed, 28 Oct 2026 20:50:06 -0700 Subject: [PATCH] i3, lock the session properly and have it call i3lock plus turn off the screen. --- files/settings/i3.config | 59 +++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/files/settings/i3.config b/files/settings/i3.config index 527bdfe..2eff50f 100644 --- a/files/settings/i3.config +++ b/files/settings/i3.config @@ -27,28 +27,6 @@ font pango:monospace 8 # text rendering and scalability on retina/hidpi displays (thanks to pango). #font pango:DejaVu Sans Mono 8 -# Start XDG autostart .desktop files using dex. See also -# https://wiki.archlinux.org/index.php/XDG_Autostart -exec --no-startup-id dex --autostart --environment i3 - -# The combination of xss-lock, nm-applet and pactl is a popular choice, so -# they are included here as an example. Modify as you see fit. - -# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the -# screen before suspend. Use loginctl lock-session to lock your screen. -exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork - -# NetworkManager is the most popular way to manage wireless networks on Linux, -# and nm-applet is a desktop environment-independent system tray GUI for it. -exec --no-startup-id nm-applet - -# Use pactl to adjust volume in PulseAudio. -set $refresh_i3status killall -SIGUSR1 i3status -#bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status -#bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status -#bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status -#bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status - # Use Mouse+$mod to drag floating windows to their wanted position floating_modifier $mod @@ -331,9 +309,11 @@ bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcu bindsym $mod+Shift+q exec "i3-msg exit" # lock -bindsym $ctrl+$alt+l exec "i3lock -c 000000 -e -f && sleep 1 && xset dpms force off" -bindsym $ctrl+$mod+l exec "i3lock -c 000000 -e -f && sleep 1 && xset dpms force off" -bindsym $shift+$mod+l exec "i3lock -c 000000 -e -f && sleep 1 && xset dpms force off" +#set $LOCK_CMD "i3lock -c 333333 -e -f && sleep 1 && xset dpms force off" +set $LOCK_CMD "loginctl lock-session" +bindsym $ctrl+$alt+l exec $LOCK_CMD +bindsym $ctrl+$mod+l exec $LOCK_CMD +bindsym $shift+$mod+l exec $LOCK_CMD # shutdown entire system. #bindsym $ctrl+$shift+q exec dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop @@ -433,3 +413,32 @@ exec_always --no-startup-id bash -c 'pkill -ef "bash `which battery_nag.sh`" >~/ #exec_always --no-startup-id "killall redshift-gtk; redshift-gtk" #exec_always --no-startup-id "killall redshift; redshift -l 35.19540:-111.65720 -t 6500K:1100K" exec_always --no-startup-id "killall redshift; killall redshift-gtk; sleep 1; redshift -x; redshift-gtk -l 35.19540:-111.65720 -t 6500K:1100K" + +# Allow locking the session. +#set $AGENT pkttyagent +set $AGENT lxqt-policykit-agent +exec_always --no-startup-id "killall $AGENT; $AGENT" + +# Start XDG autostart .desktop files using dex. See also +# https://wiki.archlinux.org/index.php/XDG_Autostart +exec --no-startup-id dex --autostart --environment i3 + +# The combination of xss-lock, nm-applet and pactl is a popular choice, so +# they are included here as an example. Modify as you see fit. + +# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the +# screen before suspend. Use loginctl lock-session to lock your screen. +#exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork +#exec_always --no-startup-id xss-lock --transfer-sleep-lock -- i3lock -c 111111 -e -f --nofork +exec_always --no-startup-id xss-lock --transfer-sleep-lock -- sh -c 'i3lock -c 111111 -e -f --nofork & sleep 1; xset dpms force off; wait' + +# NetworkManager is the most popular way to manage wireless networks on Linux, +# and nm-applet is a desktop environment-independent system tray GUI for it. +exec --no-startup-id nm-applet + +# Use pactl to adjust volume in PulseAudio. +set $refresh_i3status killall -SIGUSR1 i3status +#bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status +#bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status +#bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status +#bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status