This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

sway: fix force feedback notifier

+17 -7
+17 -7
2configs/desktops/sway/default.nix
··· 54 54 description = "Trigger rumble on urgent windows"; 55 55 partOf = [ "sway-session.target" ]; 56 56 wantedBy = [ "sway-session.target" ]; 57 - unitConfig = { 58 - ConditionPathExists = [ 59 - "/dev/input/event2" 60 - "/sys/class/input/event2/device/capabilities/ff" 61 - ]; 62 - }; 63 57 serviceConfig = { 64 58 Type = "simple"; 65 59 ExecStart = lib.getExe ( ··· 71 65 self.packages.${pkgs.system}.gpd-rumble 72 66 ]; 73 67 text = '' 68 + # Find first force-feedback capable device 69 + FF_DEVICE="" 70 + for ev in /sys/class/input/event*; do 71 + if [ -f "$ev/device/capabilities/ff" ] && [ "$(cat "$ev/device/capabilities/ff")" != "0" ]; then 72 + FF_DEVICE="/dev/input/''${ev##*/}" 73 + break 74 + fi 75 + done 76 + 77 + if [ -z "$FF_DEVICE" ]; then 78 + echo "No force-feedback device found, exiting" 79 + exit 0 80 + fi 81 + 82 + echo "Using force-feedback device: $FF_DEVICE" 83 + 74 84 swaymsg -t subscribe -m '["window"]' | \ 75 85 jq --unbuffered -r 'select(.change == "urgent" and .container.urgent == true) | "urgent"' | \ 76 86 while read -r _; do 77 - gpd-rumble 200 100 & 87 + gpd-rumble 200 100 "$FF_DEVICE" & 78 88 done 79 89 ''; 80 90 }