From: Andrew Date: Thu, 21 Aug 2025 21:59:58 +0000 (-0400) Subject: hyprlock and hypridle added X-Git-Url: http://git.skullheadx.com/nixos/projects.html?a=commitdiff_plain;h=6b78f6b7976b880d44b52a2f7d0ad8cf37a9d652;p=nixos.git hyprlock and hypridle added --- diff --git a/; b/; new file mode 100644 index 0000000..243374a --- /dev/null +++ b/; @@ -0,0 +1,118 @@ +{ config, pkgs, ... }: +let + font = Monospace +in +{ + programs.hyprlock = { + enable = true; + settings = { + # sample hyprlock.conf + # for more configuration options, refer https://wiki.hyprland.org/Hypr-Ecosystem/hyprlock + # + # rendered text in all widgets supports pango markup (e.g. or tags) + # ref. https://wiki.hyprland.org/Hypr-Ecosystem/hyprlock/#general-remarks + # + # shortcuts to clear password buffer: ESC, Ctrl+U, Ctrl+Backspace + # + # you can get started by copying this config to ~/.config/hypr/hyprlock.conf + # + general = { + hide_cursor = false; + }; + + # uncomment to enable fingerprint authentication + # auth { + # fingerprint { + # enabled = true + # ready_message = Scan fingerprint to unlock + # present_message = Scanning... + # retry_delay = 250 # in milliseconds + # } + # } + + animations { + enabled = true; + bezier = "linear, 1, 1, 0, 0"; + animation = "fadeIn, 1, 5, linear"; + animation = "fadeOut, 1, 5, linear"; + animation = "inputFieldDots, 1, 2, linear"; + } + + background = { + monitor = ""; + path = "screenshot"; + blur_passes = 3; + blur_size = 8; + }; + + input-field = [ + { + monitor = ""; + size = "20, 5"; + outline_thickness = 3; + inner_color = "rgba(0, 0, 0, 0.0)"; # no fill + + outer_color = "rgba(33ccffee) rgba(00ff99ee) 45deg"; + check_color = "rgba(00ff99ee) rgba(ff6633ee) 120deg"; + fail_color = "rgba(ff6633ee) rgba(ff0066ee) 40deg"; + + font_color = "rgb(143, 143, 143)"; + fade_on_empty = false; + rounding = 15; + + font_family = "${font}"; + placeholder_text = "Input password..."; + fail_text = "$PAMFAIL"; + + # uncomment to use a letter instead of a dot to indicate the typed password + # dots_text_format = * + # dots_size = 0.4 + dots_spacing = 0.3; + + # uncomment to use an input indicator that does not show the password length (similar to swaylock's input indicator) + # hide_input = true + + position = "0, -20"; + halign = "center"; + valign = "center"; + } + ]; + + # TIME + label = [ + { + monitor = ""; + text = "$TIME"; # ref. https://wiki.hyprland.org/Hypr-Ecosystem/hyprlock/#variable-substitution + font_size = 90; + font_family = "${font}"; + + position = "-30, 0"; + halign = "right"; + valign = "top"; + } + + # DATE + { + monitor = ""; + text = "cmd[update:60000] date +'%A, %d %B %Y'"; # update every 60 seconds + font_size = 25; + font_family = "${font}"; + + position = "-30, -150"; + halign = "right"; + valign = "top"; + } + + { + monitor = ""; + text = "$LAYOUT[en,ru]" + font_size = 24; + onclick = "hyprctl switchxkblayout all next"; + + position = "250, -20"; + halign = "center"; + valign = "center"; + } + ]; + }; +} diff --git a/home.nix b/home.nix index 0bf3695..0905aad 100644 --- a/home.nix +++ b/home.nix @@ -11,6 +11,8 @@ ./sh.nix ./hyprland/hyprland.nix ./hyprpaper.nix + ./hypridle.nix + ./hyprlock.nix ./ghostty.nix ./obsidian.nix ./fastfetch.nix @@ -143,6 +145,7 @@ extraPortals = [ pkgs.xdg-desktop-portal-hyprland ]; }; + # Let Home Manager install and manage itself. programs.home-manager.enable = true; diff --git a/hypridle.nix b/hypridle.nix new file mode 100644 index 0000000..4747411 --- /dev/null +++ b/hypridle.nix @@ -0,0 +1,43 @@ +{ config, pkgs, ... }: + +{ + services.hypridle = { + enable = true; + settings = { + general = { + lock_cmd = "pidof hyprlock || hyprlock"; # avoid starting multiple hyprlock instances. + before_sleep_cmd = "loginctl lock-session"; # lock before suspend. + after_sleep_cmd = "hyprctl dispatch dpms on"; # to avoid having to press a key twice to turn on the display. + }; + + listener = [ + { + timeout = 150; # 2.5min. + on-timeout = "brightnessctl -s set 10"; # set monitor backlight to minimum, avoid 0 on OLED monitor. + on-resume = "brightnessctl -r"; # monitor backlight restore. + } + { + # turn off keyboard backlight, comment out this section if you dont have a keyboard backlight. + timeout = 150; # 2.5min. + on-timeout = "brightnessctl -sd rgb:kbd_backlight set 0"; # turn off keyboard backlight. + on-resume = "brightnessctl -rd rgb:kbd_backlight"; # turn on keyboard backlight. + } + { + timeout = 300; # 5min + on-timeout = "loginctl lock-session"; # lock screen when timeout has passed + } + + { + timeout = 330; # 5.5min + on-timeout = "hyprctl dispatch dpms off"; # screen off when timeout has passed + on-resume = "hyprctl dispatch dpms on && brightnessctl -r"; # screen on when activity is detected after timeout has fired. + } + + { + timeout = 1800; # 30min + on-timeout = "systemctl suspend"; # suspend pc + } + ]; + }; +}; +} diff --git a/hyprlock.nix b/hyprlock.nix new file mode 100644 index 0000000..f78131b --- /dev/null +++ b/hyprlock.nix @@ -0,0 +1,109 @@ +{ config, pkgs, lib, ... }: +let + font = "Monospace"; +in +{ + programs.hyprlock = { + enable = true; + settings = { + # sample hyprlock.conf + # for more configuration options, refer https://wiki.hyprland.org/Hypr-Ecosystem/hyprlock + # + # rendered text in all widgets supports pango markup (e.g. or tags) + # ref. https://wiki.hyprland.org/Hypr-Ecosystem/hyprlock/#general-remarks + # + # shortcuts to clear password buffer: ESC, Ctrl+U, Ctrl+Backspace + # + # you can get started by copying this config to ~/.config/hypr/hyprlock.conf + # + general = { + hide_cursor = false; + }; + + # uncomment to enable fingerprint authentication + # auth { + # fingerprint { + # enabled = true + # ready_message = Scan fingerprint to unlock + # present_message = Scanning... + # retry_delay = 250 # in milliseconds + # } + # } + + animations = { + enabled = true; + bezier = "linear, 1, 1, 0, 0"; + animation = ["fadeIn, 1, 5, linear" + "fadeOut, 1, 5, linear" + "inputFieldDots, 1, 2, linear" + ]; + }; + + background = { + monitor = ""; + path = "screenshot"; + blur_passes = 3; + blur_size = 8; + }; + + input-field = lib.mkForce [ + { + monitor = ""; + size = "20, 5"; + outline_thickness = 3; + inner_color = "rgba(0, 0, 0, 0.0)"; # no fill + + outer_color = "rgba(33ccffee) rgba(00ff99ee) 45deg"; + check_color = "rgba(00ff99ee) rgba(ff6633ee) 120deg"; + fail_color = "rgba(ff6633ee) rgba(ff0066ee) 40deg"; + + font_color = "rgb(143, 143, 143)"; + fade_on_empty = false; + rounding = 15; + + font_family = "${font}"; + placeholder_text = "Input password..."; + fail_text = "$PAMFAIL"; + + # uncomment to use a letter instead of a dot to indicate the typed password + # dots_text_format = * + # dots_size = 0.4 + dots_spacing = 0.3; + + # uncomment to use an input indicator that does not show the password length (similar to swaylock's input indicator) + # hide_input = true + + position = "0, -20"; + halign = "center"; + valign = "center"; + } + ]; + + # TIME + label = [ + { + monitor = ""; + text = "$TIME"; # ref. https://wiki.hyprland.org/Hypr-Ecosystem/hyprlock/#variable-substitution + font_size = 90; + font_family = "${font}"; + + position = "-30, 0"; + halign = "right"; + valign = "top"; + } + + # DATE + { + monitor = ""; + text = "cmd[update:60000] date +'%A, %d %B %Y'"; # update every 60 seconds + font_size = 25; + font_family = "${font}"; + + position = "-30, -150"; + halign = "right"; + valign = "top"; + } + ]; + }; +}; +}