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
|
||||
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*)
|
||||
|
|
Loading…
Reference in a new issue