From 9beb6dc055ba851e59246b77fb1a919f425ac3f6 Mon Sep 17 00:00:00 2001 From: Erich Blume Date: Thu, 19 Feb 2026 06:41:57 -0800 Subject: [PATCH] Add screen lock and idle management to ringtail Configure swayidle + swaylock for automatic screen locking after 15 minutes of inactivity and display power-off after 60 minutes. Swaylock uses Catppuccin Macchiato theme to match the existing Sway config. Also adds Mod4+l keybinding for manual lock and disables system suspend/hibernate entirely. Co-Authored-By: Claude Opus 4.6 --- .../feature-ringtail-screen-lock.feature.md | 1 + nixos/ringtail/configuration.nix | 60 +++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 docs/changelog.d/feature-ringtail-screen-lock.feature.md diff --git a/docs/changelog.d/feature-ringtail-screen-lock.feature.md b/docs/changelog.d/feature-ringtail-screen-lock.feature.md new file mode 100644 index 0000000..6a02bf8 --- /dev/null +++ b/docs/changelog.d/feature-ringtail-screen-lock.feature.md @@ -0,0 +1 @@ +Add screen lock, idle timeout, and sleep prevention to ringtail: swaylock locks after 15min, display powers off after 60min, machine never suspends. diff --git a/nixos/ringtail/configuration.nix b/nixos/ringtail/configuration.nix index d765a23..1282c11 100644 --- a/nixos/ringtail/configuration.nix +++ b/nixos/ringtail/configuration.nix @@ -53,6 +53,7 @@ in ]; }; security.polkit.enable = true; + security.pam.services.swaylock = {}; # Allow swaylock to authenticate security.sudo.wheelNeedsPassword = false; # Enable greetd as display manager for sway @@ -261,6 +262,7 @@ in "${mod}+d" = "exec wmenu-run"; "${mod}+space" = "exec fuzzel"; "${mod}+Shift+c" = "reload"; + "${mod}+l" = "exec swaylock -f"; "--locked XF86AudioMute" = "exec pactl set-sink-mute @DEFAULT_SINK@ toggle"; "--locked XF86AudioLowerVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ -5%"; "--locked XF86AudioRaiseVolume" = "exec pactl set-sink-volume @DEFAULT_SINK@ +5%"; @@ -273,6 +275,56 @@ in }; }; + programs.swaylock = { + enable = true; + settings = { + color = "24273a"; + font = "VictorMono Nerd Font"; + font-size = 24; + indicator-radius = 100; + indicator-thickness = 7; + inside-color = "24273a"; + inside-clear-color = "24273a"; + inside-ver-color = "24273a"; + inside-wrong-color = "24273a"; + key-hl-color = "8aadf4"; + bs-hl-color = "ed8796"; + ring-color = "363a4f"; + ring-clear-color = "f5a97f"; + ring-ver-color = "8aadf4"; + ring-wrong-color = "ed8796"; + line-color = "00000000"; + line-clear-color = "00000000"; + line-ver-color = "00000000"; + line-wrong-color = "00000000"; + separator-color = "00000000"; + text-color = "cad3f5"; + text-clear-color = "cad3f5"; + text-ver-color = "cad3f5"; + text-wrong-color = "ed8796"; + show-failed-attempts = true; + }; + }; + + services.swayidle = { + enable = true; + events = [ + { event = "before-sleep"; command = "${pkgs.swaylock}/bin/swaylock -f"; } + { event = "lock"; command = "${pkgs.swaylock}/bin/swaylock -f"; } + ]; + timeouts = [ + { + timeout = 900; # 15 minutes — lock screen + command = "${pkgs.swaylock}/bin/swaylock -f"; + } + { + timeout = 3600; # 60 minutes — turn off display + command = "${pkgs.sway}/bin/swaymsg 'output * dpms off'"; + resumeCommand = "${pkgs.sway}/bin/swaymsg 'output * dpms on'"; + } + ]; + }; + programs.fuzzel = { enable = true; settings = { @@ -419,6 +471,14 @@ in # Allow the runner's dynamic user to access the nix daemon nix.settings.trusted-users = [ "gitea-runner" ]; + # Prevent machine from sleeping (workstation should stay on) + systemd.sleep.extraConfig = '' + AllowSuspend=no + AllowHibernation=no + AllowHybridSleep=no + AllowSuspendThenHibernate=no + ''; + # NixOS release system.stateVersion = "25.11"; } -- 2.50.1 (Apple Git-155)