Hyprlock on Niri
This commit is contained in:
parent
a86577bea3
commit
2a615b2145
4 changed files with 120 additions and 11 deletions
92
nixos/homes/kylekrein/hyprlock.nix
Normal file
92
nixos/homes/kylekrein/hyprlock.nix
Normal file
|
|
@ -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 = "<i>Input Password...</i>";
|
||||||
|
hide_input = false;
|
||||||
|
fade_on_empty = false;
|
||||||
|
fail_text = "<i>$FAIL <b>($ATTEMPTS)</b></i>";
|
||||||
|
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";
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
};
|
};
|
||||||
imports = [
|
imports = [
|
||||||
./waybar
|
./waybar
|
||||||
|
./hyprlock.nix
|
||||||
];
|
];
|
||||||
home.packages = with pkgs;[
|
home.packages = with pkgs;[
|
||||||
wlogout
|
wlogout
|
||||||
|
|
@ -20,7 +21,7 @@
|
||||||
waybar
|
waybar
|
||||||
swaybg
|
swaybg
|
||||||
libnotify
|
libnotify
|
||||||
swaylock
|
hyprlock
|
||||||
networkmanagerapplet
|
networkmanagerapplet
|
||||||
];
|
];
|
||||||
programs.niri = {
|
programs.niri = {
|
||||||
|
|
@ -216,7 +217,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
programs.swaylock = {
|
programs.swaylock = {
|
||||||
enable = true;
|
enable = false;
|
||||||
settings = {
|
settings = {
|
||||||
color = "808080";
|
color = "808080";
|
||||||
font-size = 24;
|
font-size = 24;
|
||||||
|
|
@ -228,9 +229,11 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
services.swayidle = let
|
services.swayidle = let
|
||||||
locking-script = pkgs.writeShellScript "locking-script" ''
|
niri = lib.getExe config.programs.niri.package;
|
||||||
pidof swaylock || "${pkgs.swaylock}/bin/swaylock -fF"
|
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" ''
|
suspendScript = pkgs.writeShellScript "suspend-script" ''
|
||||||
# check if any player has status "Playing"
|
# check if any player has status "Playing"
|
||||||
${lib.getExe pkgs.playerctl} -a status | ${lib.getExe pkgs.ripgrep} Playing -q
|
${lib.getExe pkgs.playerctl} -a status | ${lib.getExe pkgs.ripgrep} Playing -q
|
||||||
|
|
@ -244,23 +247,27 @@ in{
|
||||||
events = [
|
events = [
|
||||||
{
|
{
|
||||||
event = "before-sleep";
|
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";
|
event = "after-resume";
|
||||||
command = "niri msg action power-on-monitors";
|
command = "${niri} msg action power-on-monitors";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
event = "lock";
|
event = "lock";
|
||||||
command = "${locking-script}";
|
command = "${locking-script}";
|
||||||
}
|
}
|
||||||
|
#{
|
||||||
|
# event = "unlock";
|
||||||
|
# command = "${unlocking-script}";
|
||||||
|
#}
|
||||||
];
|
];
|
||||||
timeouts = let
|
timeouts = let
|
||||||
secondary = "systemctl suspend";
|
secondary = "${suspendScript}";
|
||||||
in[
|
in[
|
||||||
{
|
{
|
||||||
timeout = 30;
|
timeout = 30;
|
||||||
command = "pidof swaylock && ${secondary}";
|
command = "pidof hyprlock && ${secondary}";
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
timeout = 300;
|
timeout = 300;
|
||||||
|
|
@ -268,8 +275,16 @@ in{
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
timeout = 330;
|
timeout = 330;
|
||||||
command = "pidof swaylock && ${secondary}";
|
command = "pidof hyprlock && ${secondary}";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
services = {
|
||||||
|
mako = {
|
||||||
|
enable = false;
|
||||||
|
settings = {
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
BIN
nixos/homes/kylekrein/profile-image.png
Normal file
BIN
nixos/homes/kylekrein/profile-image.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 78 KiB |
|
|
@ -6,7 +6,9 @@
|
||||||
imports = [
|
imports = [
|
||||||
inputs.niri-flake.nixosModules.niri
|
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 = {
|
programs.niri = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.niri-unstable;
|
package = pkgs.niri-unstable;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue