From f759911783abfd380782af88ecad9a1e5e31d065 Mon Sep 17 00:00:00 2001 From: Youwen Wu Date: Fri, 9 Aug 2024 00:41:55 -0700 Subject: [PATCH] feat: add lock screen capability also switch to swaybg from swww because of instability --- users/youwen/linux/hyprland/common.nix | 67 ++++++++++++++++++- .../youwen/linux/packages/common-packages.nix | 2 +- 2 files changed, 67 insertions(+), 2 deletions(-) diff --git a/users/youwen/linux/hyprland/common.nix b/users/youwen/linux/hyprland/common.nix index f039625..7fedbe4 100644 --- a/users/youwen/linux/hyprland/common.nix +++ b/users/youwen/linux/hyprland/common.nix @@ -65,7 +65,9 @@ ''$mod, P, exec, grim -g "$(slurp)" - | swappy -f -'' # Screenshot - "$mod, Backspace, exec, wlogout" # Screenshot + "$mod, Backspace, exec, wlogout" # show logout menu + + "$mod, L, exec, hyprlock" ]; bindm = [ "$mod, mouse:272, movewindow" @@ -207,4 +209,67 @@ }; }; }; + + programs.hyprlock = { + enable = true; + settings = { + general = { + hide_cursor = true; + grace = 1; + }; + background = { + monitor = ""; + path = "screenshot"; + blur_passes = 3; + blur_size = 7; + noise = 1.17e-2; + contrast = 0.8916; + brightness = 0.8172; + vibrancy = 0.1696; + vibrancy_darkness = 0.0; + }; + input-field = { + monitor = ""; + size = "200, 50"; + outline_thickness = 3; + dots_size = 0.33; + dots_spacing = 0.15; + dots_center = false; + dots_rounding = -1; + outer_color = "rgb(151515)"; + inner_color = "rgb(200, 200, 200)"; + font_color = "rgb(10, 10, 10)"; + fade_on_empty = true; + fade_timeout = 1000; + placeholder_text = "Input Password..."; + hide_input = false; + rounding = -1; + check_color = "rgb(204, 136, 34)"; + fail_color = "rgb(204, 34, 34)"; + fail_text = "$FAIL ($ATTEMPTS)"; + fail_timeout = 2000; + fail_transition = 300; + capslock_color = -1; + numlock_color = -1; + bothlock_color = -1; + invert_numlock = false; + swap_font_color = false; + + position = "0, -20"; + halign = "center"; + valign = "center"; + }; + }; + }; + + services.hypridle = { + enable = true; + settings = { + 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. + }; + }; } diff --git a/users/youwen/linux/packages/common-packages.nix b/users/youwen/linux/packages/common-packages.nix index 2b2406a..9a6a7ff 100644 --- a/users/youwen/linux/packages/common-packages.nix +++ b/users/youwen/linux/packages/common-packages.nix @@ -27,8 +27,8 @@ with pkgs; [ slurp swappy pavucontrol - swww waypaper + swaybg # desktop apps dolphin