mirror of
https://github.com/nickolaj-jepsen/nixos.git
synced 2026-01-22 08:06:50 +01:00
feat: implement hyprlock and hypridle
This commit is contained in:
parent
870f8fdde5
commit
0d47ab58f5
4 changed files with 146 additions and 8 deletions
12
flake.lock
generated
12
flake.lock
generated
|
|
@ -448,11 +448,11 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1744117652,
|
"lastModified": 1744743431,
|
||||||
"narHash": "sha256-t7dFCDl4vIOOUMhEZnJF15aAzkpaup9x4ZRGToDFYWI=",
|
"narHash": "sha256-iyn/WBYDc7OtjSawbegINDe/gIkok888kQxk3aVnkgg=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "home-manager",
|
"repo": "home-manager",
|
||||||
"rev": "b4e98224ad1336751a2ac7493967a4c9f6d9cb3f",
|
"rev": "c61bfe3ae692f42ce688b5865fac9e0de58e1387",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
@ -984,11 +984,11 @@
|
||||||
"treefmt-nix": "treefmt-nix_3"
|
"treefmt-nix": "treefmt-nix_3"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1744739247,
|
"lastModified": 1744745313,
|
||||||
"narHash": "sha256-UAtagy5rLeiUMrGV+6VkXKyhKXf/NHRmKSJ2OobrocM=",
|
"narHash": "sha256-eSaXmBxjQSeHiBOxA7jcuwvumBsKI8YL1iMs8LX8dZM=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "NUR",
|
"repo": "NUR",
|
||||||
"rev": "6f7e7406290a793d1c9bff22d79d1b2b83d13084",
|
"rev": "e667247df0a6f9cf0e19e991939ce87ada422ffe",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,8 @@ in {
|
||||||
imports = [
|
imports = [
|
||||||
./hyprpolkitagent.nix
|
./hyprpolkitagent.nix
|
||||||
./hyprpaper.nix
|
./hyprpaper.nix
|
||||||
|
./hyprlock.nix
|
||||||
|
./hypridle.nix
|
||||||
];
|
];
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
|
@ -132,7 +134,10 @@ in {
|
||||||
)
|
)
|
||||||
config.monitors;
|
config.monitors;
|
||||||
|
|
||||||
exec = ["systemctl --user start hyprpaper"];
|
exec = [
|
||||||
|
"systemctl --user start hyprpaper"
|
||||||
|
"systemctl --user start hypridle"
|
||||||
|
];
|
||||||
|
|
||||||
input = {
|
input = {
|
||||||
# Most unknown keyboards will be of the DK layout, we set known keyboards to eu in `devices`
|
# Most unknown keyboards will be of the DK layout, we set known keyboards to eu in `devices`
|
||||||
|
|
@ -247,7 +252,7 @@ in {
|
||||||
"SUPER, BACKSPACE, killactive"
|
"SUPER, BACKSPACE, killactive"
|
||||||
"SUPER, SPACE, exec, astal launcher"
|
"SUPER, SPACE, exec, astal launcher"
|
||||||
"SUPER, semicolon, exec, astal launcher .e"
|
"SUPER, semicolon, exec, astal launcher .e"
|
||||||
"SUPER, p, exec, ${getExe config.programs.uwsm.package} app -- loginctl lock-session"
|
"SUPER, p, exec, ${getExe config.programs.uwsm.package} app -- ${pkgs.systemd}/bin/loginctl lock-session"
|
||||||
|
|
||||||
", Print, exec, ${lib.getExe pkgs.grimblast} save area - | ${lib.getExe pkgs.satty} -f -"
|
", Print, exec, ${lib.getExe pkgs.grimblast} save area - | ${lib.getExe pkgs.satty} -f -"
|
||||||
"SHIFT, Print, exec, ${lib.getExe pkgs.grimblast} --freeze save area - | ${lib.getExe pkgs.satty} -f -"
|
"SHIFT, Print, exec, ${lib.getExe pkgs.grimblast} --freeze save area - | ${lib.getExe pkgs.satty} -f -"
|
||||||
|
|
|
||||||
34
modules/desktop/hyprland/hypridle.nix
Normal file
34
modules/desktop/hyprland/hypridle.nix
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
sleep_cmd = "${config.programs.hyprland.package}/bin/hyprctl dispatch dpms off";
|
||||||
|
wake_cmd = "${config.programs.hyprland.package}/bin/hyprctl dispatch dpms on";
|
||||||
|
lock_cmd = "pidof ${pkgs.hyprlock}/bin/hyprlock || ${pkgs.hyprlock}/bin/hyprlock";
|
||||||
|
in {
|
||||||
|
config = {
|
||||||
|
fireproof.home-manager.services.hypridle = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
general = {
|
||||||
|
inherit lock_cmd;
|
||||||
|
before_sleep_cmd = "${pkgs.systemd}/bin/loginctl lock-session";
|
||||||
|
after_sleep_cmd = sleep_cmd;
|
||||||
|
};
|
||||||
|
listener = [
|
||||||
|
{
|
||||||
|
timeout = 60 * 5;
|
||||||
|
on-timeout = lock_cmd;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
timeout = 60 * 15;
|
||||||
|
on-timeout = sleep_cmd;
|
||||||
|
on-resume = wake_cmd;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
99
modules/desktop/hyprland/hyprlock.nix
Normal file
99
modules/desktop/hyprland/hyprlock.nix
Normal file
|
|
@ -0,0 +1,99 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
inputs,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
background = pkgs.stdenvNoCC.mkDerivation {
|
||||||
|
pname = "desktop-background";
|
||||||
|
version = "0.2";
|
||||||
|
|
||||||
|
src = lib.fileset.toSource {
|
||||||
|
root = ./.;
|
||||||
|
fileset = lib.fileset.unions [
|
||||||
|
./backgrounds/unknown.svg
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
nativeBuildInputs = [pkgs.inkscape];
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
inkscape -w 3840 -h 2160 backgrounds/unknown.svg -o unknown.png
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/share/backgrounds
|
||||||
|
cp *.svg *.png $out/share/backgrounds
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
# Re-use the same color scheme as in the main Hyprland config
|
||||||
|
color = {
|
||||||
|
bg = "rgb(28, 27, 26)";
|
||||||
|
ui = "rgb(52, 51, 49)";
|
||||||
|
fg = "rgb(218, 216, 206)";
|
||||||
|
transparent = "rgba(0, 0, 0, 0)";
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
config = {
|
||||||
|
fireproof.home-manager.programs.hyprlock = {
|
||||||
|
enable = true;
|
||||||
|
settings = {
|
||||||
|
general = {
|
||||||
|
disable_loading_bar = false;
|
||||||
|
grace = 0;
|
||||||
|
no_fade_in = false;
|
||||||
|
};
|
||||||
|
background = {
|
||||||
|
monitor = "";
|
||||||
|
color = color.bg;
|
||||||
|
path = background + "/share/backgrounds/unknown.png";
|
||||||
|
};
|
||||||
|
input-field = {
|
||||||
|
monitor = "";
|
||||||
|
size = "250, 60";
|
||||||
|
outline_thickness = 2;
|
||||||
|
dots_size = 0.2;
|
||||||
|
dots_spacing = 0.2;
|
||||||
|
dots_center = true;
|
||||||
|
outer_color = color.transparent;
|
||||||
|
inner_color = color.ui;
|
||||||
|
font_color = color.fg;
|
||||||
|
fade_on_empty = false;
|
||||||
|
font_family = "Hack Nerd Font";
|
||||||
|
placeholder_text = "";
|
||||||
|
hide_input = false;
|
||||||
|
position = "0, -35";
|
||||||
|
halign = "center";
|
||||||
|
valign = "center";
|
||||||
|
rounding = 8;
|
||||||
|
};
|
||||||
|
shape = [
|
||||||
|
{
|
||||||
|
monitor = "";
|
||||||
|
color = color.ui;
|
||||||
|
halign = "center";
|
||||||
|
valign = "center";
|
||||||
|
size = "150, 60";
|
||||||
|
position = "0, 35";
|
||||||
|
rounding = 8;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
label = [
|
||||||
|
{
|
||||||
|
monitor = "";
|
||||||
|
text = "cmd[update:1000] echo \"<span>$(date +\"%H:%M\")</span>\"";
|
||||||
|
color = color.fg;
|
||||||
|
font_size = 30;
|
||||||
|
font_family = "Hack Nerd Font";
|
||||||
|
position = "0, 35";
|
||||||
|
halign = "center";
|
||||||
|
valign = "center";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue