diff --git a/desktopenvs/hyprlua/hypr-usr/input.lua b/desktopenvs/hyprlua/hypr-usr/input.lua index 35efacc..08ab3b4 100644 --- a/desktopenvs/hyprlua/hypr-usr/input.lua +++ b/desktopenvs/hyprlua/hypr-usr/input.lua @@ -25,3 +25,19 @@ hl.device({ repeat_delay = 500, sensitivity = 0, }) +hl.device({ + name = "logitech-pro-2-mouse-1", + sensitivity = 0, + accel_profile = "", + left_handed = false, -- left-handed mode handled on the mouse's onboard memory + natural_scroll = false, + scroll_points = "", +}) +hl.device({ + name = "logitech-g903-ls-1", + sensitivity = 0, + accel_profile = "", + left_handed = false, + natural_scroll = false, + scroll_points = "", +}) diff --git a/desktopenvs/hyprlua/hypr-usr/mk-device-block.sh b/desktopenvs/hyprlua/hypr-usr/mk-device-block.sh index e68b5b7..aeba862 100755 --- a/desktopenvs/hyprlua/hypr-usr/mk-device-block.sh +++ b/desktopenvs/hyprlua/hypr-usr/mk-device-block.sh @@ -1,27 +1,40 @@ #!/usr/bin/env bash set -euo pipefail -keyboards=$(hyprctl devices -j | jq -r '.keyboards[].name') +devices=$(hyprctl devices -j) -if [[ -z "$keyboards" ]]; then - echo "No keyboard devices found" >&2 +# Tag each device with its type so the right block can be emitted on selection. +entries=$(jq -r ' + (.keyboards[]?.name | "keyboard\t" + .), + (.mice[]?.name | "mouse\t" + .) +' <<<"$devices") + +if [[ -z "$entries" ]]; then + echo "No keyboard or mouse devices found" >&2 exit 1 fi if command -v fzf &>/dev/null; then - selected=$(printf '%s\n' $keyboards | fzf --prompt="Select keyboard: " --height=~10) + selected=$(printf '%s\n' "$entries" | fzf --prompt="Select device: " --height=~10 --with-nth=2.. --delimiter='\t') else - echo "Select a keyboard device:" >&2 - select selected in $keyboards; do + echo "Select a device:" >&2 + IFS=$'\n' + select selected in $entries; do [[ -n "$selected" ]] && break done + unset IFS fi [[ -z "$selected" ]] && exit 1 -cat <