feat(hypr wim): hypridle -> acpid
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
Updater 2024-05-29 12:30:14 -04:00
parent bd5b0dcec8
commit a72a054632
5 changed files with 69 additions and 122 deletions

View file

@ -467,7 +467,7 @@
}, },
"flake-utils_2": { "flake-utils_2": {
"inputs": { "inputs": {
"systems": "systems_7" "systems": "systems_5"
}, },
"locked": { "locked": {
"lastModified": 1710146030, "lastModified": 1710146030,
@ -815,37 +815,15 @@
"type": "github" "type": "github"
} }
}, },
"hypridle": {
"inputs": {
"hyprlang": "hyprlang",
"nixpkgs": [
"nixpkgs"
],
"systems": "systems_5"
},
"locked": {
"lastModified": 1716309977,
"narHash": "sha256-4jDQIcMDSFOOMBxVTEiC6Ck1vdc0kAFvv+StxnnE59Q=",
"owner": "hyprwm",
"repo": "hypridle",
"rev": "cb169c4e06cec9b4349e3668427e729d22328a54",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hypridle",
"type": "github"
}
},
"hyprland": { "hyprland": {
"inputs": { "inputs": {
"hyprcursor": "hyprcursor", "hyprcursor": "hyprcursor",
"hyprlang": "hyprlang_2", "hyprlang": "hyprlang",
"hyprwayland-scanner": "hyprwayland-scanner", "hyprwayland-scanner": "hyprwayland-scanner",
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"systems": "systems_6", "systems": "systems_4",
"xdph": "xdph" "xdph": "xdph"
}, },
"locked": { "locked": {
@ -892,28 +870,6 @@
} }
}, },
"hyprlang": { "hyprlang": {
"inputs": {
"nixpkgs": [
"hypridle",
"nixpkgs"
],
"systems": "systems_4"
},
"locked": {
"lastModified": 1713121246,
"narHash": "sha256-502X0Q0fhN6tJK7iEUA8CghONKSatW/Mqj4Wappd++0=",
"owner": "hyprwm",
"repo": "hyprlang",
"rev": "78fcaa27ae9e1d782faa3ff06c8ea55ddce63706",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprlang",
"type": "github"
}
},
"hyprlang_2": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"hyprland", "hyprland",
@ -1892,7 +1848,6 @@
"headscale": "headscale", "headscale": "headscale",
"home-manager": "home-manager", "home-manager": "home-manager",
"hypr-official-plugins": "hypr-official-plugins", "hypr-official-plugins": "hypr-official-plugins",
"hypridle": "hypridle",
"hyprland": "hyprland", "hyprland": "hyprland",
"jellyfin-flake": "jellyfin-flake", "jellyfin-flake": "jellyfin-flake",
"jellyfin-ultrachromic-src": "jellyfin-ultrachromic-src", "jellyfin-ultrachromic-src": "jellyfin-ultrachromic-src",
@ -2132,36 +2087,6 @@
} }
}, },
"systems_5": { "systems_5": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
}
},
"systems_6": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"type": "github"
}
},
"systems_7": {
"locked": { "locked": {
"lastModified": 1681028828, "lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
@ -2176,7 +2101,7 @@
"type": "github" "type": "github"
} }
}, },
"systems_8": { "systems_6": {
"locked": { "locked": {
"lastModified": 1689347949, "lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
@ -2308,7 +2233,7 @@
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs"
], ],
"systems": "systems_8" "systems": "systems_6"
}, },
"locked": { "locked": {
"lastModified": 1716199546, "lastModified": 1716199546,

View file

@ -1,4 +1,5 @@
# Do not modify! This file is generated. # Do not modify! This file is generated.
{ {
inputs = { inputs = {
Hyprspace = { Hyprspace = {
@ -116,12 +117,6 @@
repo = "hyprland-plugins"; repo = "hyprland-plugins";
type = "github"; type = "github";
}; };
hypridle = {
inputs.nixpkgs.follows = "nixpkgs";
owner = "hyprwm";
repo = "hypridle";
type = "github";
};
hyprland = { hyprland = {
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
submodules = true; submodules = true;
@ -339,4 +334,4 @@
}; };
}; };
outputs = inputs: inputs.flakegen ./flake.in.nix inputs; outputs = inputs: inputs.flakegen ./flake.in.nix inputs;
} }

View file

@ -142,11 +142,6 @@ let
repo = "Hyprspace"; repo = "Hyprspace";
}; };
hypridle = mkDep {
owner = "hyprwm";
repo = "hypridle";
};
grim-hyprland = mkDep { grim-hyprland = mkDep {
owner = "eriedaberrie"; owner = "eriedaberrie";
repo = "grim-hyprland"; repo = "grim-hyprland";

View file

@ -207,9 +207,10 @@ const on_finished = () => {
lock.connect('finished', on_finished); lock.connect('finished', on_finished);
if (Vars.hasFprintd) { if (Vars.hasFprintd) {
Utils.authenticate('') globalThis.authFinger = () => Utils.authenticate('')
.then(() => unlock()) .then(() => unlock())
.catch(logError); .catch(logError);
globalThis.authFinger();
} }

View file

@ -1,14 +1,44 @@
{ {
config, config,
hypridle,
lib, lib,
pkgs, pkgs,
... ...
}: let }: let
inherit (lib) mkIf optionals; inherit (lib) mkIf;
inherit (config.vars) mainUser; inherit (config.vars) mainUser;
isLaptop = config.services.logind.lidSwitch == "lock"; isLaptop = config.services.logind.lidSwitch == "lock";
hmCfg = config.home-manager.users.${mainUser};
agsPkg = hmCfg.programs.ags.finalPackage;
hyprPkg = hmCfg.wayland.windowManager.hyprland.finalPackage;
runInDesktop = pkgs.writeShellApplication {
name = "runInDesktop";
runtimeInputs = [
pkgs.sudo
agsPkg
hyprPkg
];
text = ''
user="$(id -u ${mainUser})"
sig="$(ls "/run/user/$user/hypr/")"
export HYPRLAND_INSTANCE_SIGNATURE="$sig"
sudo -Eu ${mainUser} hyprctl dispatch exec "$@"
'';
};
lockPkg = pkgs.writeShellApplication {
name = "lock";
runtimeInputs = [
agsPkg
];
text = ''
ags -r 'Tablet.setLaptopMode()'
ags -b lockscreen -c /home/${mainUser}/.config/ags/lockscreen.js
'';
};
in { in {
imports = [ imports = [
../greetd ../greetd
@ -16,40 +46,41 @@ in {
services.gnome.gnome-keyring.enable = true; services.gnome.gnome-keyring.enable = true;
home-manager.users.${mainUser} = let services.acpid = mkIf isLaptop {
hmCfg = config.home-manager.users.${mainUser}; enable = true;
lockPkg = pkgs.writeShellApplication {
name = "lock"; lidEventCommands = ''
runtimeInputs = [ LID="/proc/acpi/button/lid/LID/state"
hmCfg.programs.ags.finalPackage state=$(cat "$LID" | ${pkgs.gawk}/bin/awk '{print $2}')
];
text = '' case "$state" in
ags -r 'Tablet.setLaptopMode()' *open*)
ags -b lockscreen -c /home/${mainUser}/.config/ags/lockscreen.js ${runInDesktop}/bin/runInDesktop "ags -b lockscreen -r 'authFinger()'"
''; ;;
};
in { *close*)
${runInDesktop}/bin/runInDesktop ${lockPkg}/bin/lock
;;
*)
logger -t lid-handler "Failed to detect lid state ($state)"
;;
esac
'';
};
home-manager.users.${mainUser} = {
home.packages = [ home.packages = [
pkgs.gnome.seahorse pkgs.gnome.seahorse
lockPkg lockPkg
]; ];
services.hypridle = mkIf isLaptop {
enable = true;
package = hypridle.packages.${pkgs.system}.default;
settings.general.lock_cmd = "${lockPkg}/bin/lock";
};
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
settings = { settings = {
exec-once = exec-once = [
[ "gnome-keyring-daemon --start --components=secrets"
"gnome-keyring-daemon --start --components=secrets" "${pkgs.plasma5Packages.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1"
"${pkgs.plasma5Packages.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1" ];
]
++ optionals isLaptop [
"systemctl --user restart hypridle"
];
windowrule = [ windowrule = [
"float,^(org.kde.polkit-kde-authentication-agent-1)$" "float,^(org.kde.polkit-kde-authentication-agent-1)$"