feat(hypr wim): hypridle -> acpid
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
bd5b0dcec8
commit
a72a054632
5 changed files with 62 additions and 35 deletions
BIN
flake.lock
BIN
flake.lock
Binary file not shown.
BIN
flake.nix
BIN
flake.nix
Binary file not shown.
|
@ -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";
|
||||||
|
|
|
@ -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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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,39 +46,40 @@ 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()'"
|
||||||
|
;;
|
||||||
|
|
||||||
|
*close*)
|
||||||
|
${runInDesktop}/bin/runInDesktop ${lockPkg}/bin/lock
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
logger -t lid-handler "Failed to detect lid state ($state)"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
in {
|
|
||||||
|
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 = [
|
||||||
|
|
Loading…
Reference in a new issue