fix(acpid): make sure we run the command even if multiple sockets
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-06-12 12:56:11 -04:00
parent e8e534a4ad
commit 8ea8963d9c

View file

@ -20,12 +20,23 @@
agsPkg
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 = [
agsPkg
];
text = ''
ags -r 'Tablet.setLaptopMode()'
ags -b lockscreen -c /home/${mainUser}/.config/ags/lockscreen.js
@ -49,9 +61,11 @@ in {
services.acpid = mkIf isLaptop {
enable = true;
lidEventCommands = ''
lidEventCommands =
# bash
''
LID="/proc/acpi/button/lid/LID/state"
state=$(cat "$LID" | ${pkgs.gawk}/bin/awk '{print $2}')
state=$(${pkgs.gawk}/bin/awk '{print $2}' "$LID")
case "$state" in
*open*)