diff --git a/nixos/homes/kylekrein/hyprlock.nix b/nixos/homes/kylekrein/hyprlock.nix new file mode 100644 index 0000000..18b6824 --- /dev/null +++ b/nixos/homes/kylekrein/hyprlock.nix @@ -0,0 +1,92 @@ +{ pkgs, lib, hwconfig, ... }: +let + profile-image = ./profile-image.png; + battery-level = (import ./battery-status.nix {inherit pkgs; inherit hwconfig;}).labelPercent; +in +{ + programs.hyprlock = { + enable = true; + settings = { + general = { + #enable_fingerprint = true; + disable_loading_bar = true; + hide_cursor = true; + no_fade_in = false; + grace = 10; + }; + background = { + path = "${../../modules/hyprland/wallpaper.jpg}"; + blur_passes = 1; + blur_size = 7; + noise = 0.0117; + contrast = 0.8916; + brightness = 0.8172; + vibrancy = 0.1696; + vibrancy_darkness = 0.0; + }; + image = { + path = "${profile-image}"; + size = 150; + border_size = 4; + #border_color = "rgb(0C96F9)"; + rounding = -1; # Negative means circle + position = "0, 220"; + halign = "center"; + valign = "center"; + }; + input-field = { + size = "600, 100"; + outline_thickness = 3; + dots_size = 0.33; + dots_spacing = 0.15; + dots_center = true; + dots_rounding = -1; + dots_fade_time = 200; + placeholder_text = "Input Password..."; + hide_input = false; + fade_on_empty = false; + fail_text = "$FAIL ($ATTEMPTS)"; + fail_timeout = 2000; + fail_transition = 300; + position = "0, -20"; + halign = "center"; + valign = "center"; + }; + label = [ + { + text = "$USER"; + font_family = "Fira Code"; + font_size = 56; + position = "0, 100"; + halign = "center"; + valign = "center"; + } + { + text = "$TIME"; + font_family = "Roboto"; + font_size = 72; + position = "-40, -40"; + halign = "right"; + valign = "top"; + } + { + text = "$LAYOUT"; + font_family = "JetBrains Mono"; + font_size = 28; + position = "-20, 20"; + halign = "right"; + valign = "bottom"; + } + ] ++ lib.optional (hwconfig.isLaptop) ( + { + text = ''cmd[update:10000] ${battery-level}''; + font_family = "JetBrains Mono"; + font_size = 28; + position = "20, 20"; + halign = "left"; + valign = "bottom"; + }); + }; + }; +} + diff --git a/nixos/homes/kylekrein/niri.nix b/nixos/homes/kylekrein/niri.nix index afa579c..c51c5e4 100644 --- a/nixos/homes/kylekrein/niri.nix +++ b/nixos/homes/kylekrein/niri.nix @@ -12,6 +12,7 @@ }; imports = [ ./waybar + ./hyprlock.nix ]; home.packages = with pkgs;[ wlogout @@ -20,7 +21,7 @@ waybar swaybg libnotify - swaylock + hyprlock networkmanagerapplet ]; programs.niri = { @@ -216,7 +217,7 @@ }; programs.swaylock = { - enable = true; + enable = false; settings = { color = "808080"; font-size = 24; @@ -228,9 +229,11 @@ }; services.swayidle = let - locking-script = pkgs.writeShellScript "locking-script" '' -pidof swaylock || "${pkgs.swaylock}/bin/swaylock -fF" -''; + niri = lib.getExe config.programs.niri.package; + loginctl = "${pkgs.systemd}/bin/loginctl"; + locking-script = "pidof hyprlock || ${lib.getExe pkgs.hyprlock}"; + #locking-script = "${pkgs.swaylock}/bin/swaylock --daemonize"; + #unlocking-script = "pkill -SIGUSR1 swaylock"; suspendScript = pkgs.writeShellScript "suspend-script" '' # check if any player has status "Playing" ${lib.getExe pkgs.playerctl} -a status | ${lib.getExe pkgs.ripgrep} Playing -q @@ -244,23 +247,27 @@ in{ events = [ { event = "before-sleep"; - command = "${locking-script};niri msg action power-off-monitors"; + command = "pidof hyprlock || ${loginctl} lock-session;${niri} msg action power-off-monitors"; } { event = "after-resume"; - command = "niri msg action power-on-monitors"; + command = "${niri} msg action power-on-monitors"; } { event = "lock"; command = "${locking-script}"; } + #{ + # event = "unlock"; + # command = "${unlocking-script}"; + #} ]; timeouts = let - secondary = "systemctl suspend"; + secondary = "${suspendScript}"; in[ { timeout = 30; - command = "pidof swaylock && ${secondary}"; + command = "pidof hyprlock && ${secondary}"; } { timeout = 300; @@ -268,8 +275,16 @@ in{ } { timeout = 330; - command = "pidof swaylock && ${secondary}"; + command = "pidof hyprlock && ${secondary}"; } ]; }; + services = { + mako = { + enable = false; + settings = { + + }; + }; + }; } diff --git a/nixos/homes/kylekrein/profile-image.png b/nixos/homes/kylekrein/profile-image.png new file mode 100644 index 0000000..571410a Binary files /dev/null and b/nixos/homes/kylekrein/profile-image.png differ diff --git a/nixos/modules/niri/default.nix b/nixos/modules/niri/default.nix index d3e8306..d1d126b 100644 --- a/nixos/modules/niri/default.nix +++ b/nixos/modules/niri/default.nix @@ -6,7 +6,9 @@ imports = [ inputs.niri-flake.nixosModules.niri ]; - security.pam.services.swaylock = {}; + security.pam.services.hyprlock = {}; + systemd.user.extraConfig = '' DefaultEnvironment="PATH=/run/wrappers/bin:/etc/profiles/per-user/%u/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:$PATH" + ''; programs.niri = { enable = true; package = pkgs.niri-unstable;