fix(acpid): make sure we run the command even if multiple sockets
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
e8e534a4ad
commit
8ea8963d9c
1 changed files with 34 additions and 20 deletions
|
@ -20,12 +20,23 @@
|
||||||
agsPkg
|
agsPkg
|
||||||
hyprPkg
|
hyprPkg
|
||||||
];
|
];
|
||||||
text = ''
|
|
||||||
user="$(id -u ${mainUser})"
|
|
||||||
sig="$(ls "/run/user/$user/hypr/")"
|
|
||||||
export HYPRLAND_INSTANCE_SIGNATURE="$sig"
|
|
||||||
|
|
||||||
sudo -Eu ${mainUser} hyprctl dispatch exec "$@"
|
text = ''
|
||||||
|
params=( "$@" )
|
||||||
|
user="$(id -u ${mainUser})"
|
||||||
|
readarray -t SIGS <<< "$(ls "/run/user/$user/hypr/")"
|
||||||
|
|
||||||
|
run() {
|
||||||
|
export HYPRLAND_INSTANCE_SIGNATURE="$1"
|
||||||
|
sudo -Eu ${mainUser} hyprctl dispatch exec "''${params[@]}"
|
||||||
|
}
|
||||||
|
|
||||||
|
i=0
|
||||||
|
|
||||||
|
# FIXME: not sure if sudo passes the exit status to this
|
||||||
|
while ! run "''${SIGS[$i]}"; do
|
||||||
|
((i+=1))
|
||||||
|
done
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -34,6 +45,7 @@
|
||||||
runtimeInputs = [
|
runtimeInputs = [
|
||||||
agsPkg
|
agsPkg
|
||||||
];
|
];
|
||||||
|
|
||||||
text = ''
|
text = ''
|
||||||
ags -r 'Tablet.setLaptopMode()'
|
ags -r 'Tablet.setLaptopMode()'
|
||||||
ags -b lockscreen -c /home/${mainUser}/.config/ags/lockscreen.js
|
ags -b lockscreen -c /home/${mainUser}/.config/ags/lockscreen.js
|
||||||
|
@ -49,24 +61,26 @@ in {
|
||||||
services.acpid = mkIf isLaptop {
|
services.acpid = mkIf isLaptop {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
||||||
lidEventCommands = ''
|
lidEventCommands =
|
||||||
LID="/proc/acpi/button/lid/LID/state"
|
# bash
|
||||||
state=$(cat "$LID" | ${pkgs.gawk}/bin/awk '{print $2}')
|
''
|
||||||
|
LID="/proc/acpi/button/lid/LID/state"
|
||||||
|
state=$(${pkgs.gawk}/bin/awk '{print $2}' "$LID")
|
||||||
|
|
||||||
case "$state" in
|
case "$state" in
|
||||||
*open*)
|
*open*)
|
||||||
${runInDesktop}/bin/runInDesktop "ags -b lockscreen -r 'authFinger()'"
|
${runInDesktop}/bin/runInDesktop "ags -b lockscreen -r 'authFinger()'"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*close*)
|
*close*)
|
||||||
${runInDesktop}/bin/runInDesktop ${lockPkg}/bin/lock
|
${runInDesktop}/bin/runInDesktop ${lockPkg}/bin/lock
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
logger -t lid-handler "Failed to detect lid state ($state)"
|
logger -t lid-handler "Failed to detect lid state ($state)"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
home-manager.users.${mainUser} = {
|
home-manager.users.${mainUser} = {
|
||||||
|
|
Loading…
Reference in a new issue