left: fix left-handed toggle script
Signed-off-by: Myned <dev@bjork.tech>
This commit is contained in:
parent
880deccb75
commit
ef7763bfbc
3 changed files with 24 additions and 10 deletions
|
@ -16,6 +16,7 @@ with lib; let
|
|||
jq = "${pkgs.jq}/bin/jq";
|
||||
kill = "${pkgs.procps}/bin/kill";
|
||||
kitty = "${config.home-manager.users.${config.custom.username}.programs.kitty.package}/bin/kitty";
|
||||
left = "~/.local/bin/left";
|
||||
loginctl = "${pkgs.systemd}/bin/loginctl";
|
||||
menu = "~/.local/bin/menu";
|
||||
nautilus = "${pkgs.nautilus}/bin/nautilus";
|
||||
|
@ -127,7 +128,7 @@ in {
|
|||
# TODO: Toggle trackball hand
|
||||
#// (key "Delete" "Super" "exec" "left")
|
||||
|
||||
(key "Delete" "Super+Shift" "exec" "vrr")
|
||||
(key "Delete" "Super+Shift" "exec" "${left} kensington-orbit-wireless-tb-mouse")
|
||||
(key "Down" "Super" "movewindow" "d")
|
||||
(key "Down" "Super+Shift" "movewindoworgroup" "d")
|
||||
(key "Equal" "Super" "exec" "audio Normalizer")
|
||||
|
|
|
@ -9,6 +9,7 @@ with lib; let
|
|||
firefox-esr = "${
|
||||
config.home-manager.users.${config.custom.username}.programs.firefox.finalPackage
|
||||
}/bin/firefox-esr";
|
||||
left = "~/.local/bin/left";
|
||||
pkill = "${pkgs.procps}/bin/pkill";
|
||||
rm = "${pkgs.coreutils}/bin/rm";
|
||||
sleep = "${pkgs.coreutils}/bin/sleep";
|
||||
|
|
|
@ -1,15 +1,27 @@
|
|||
#! /usr/bin/env bash
|
||||
|
||||
# Toggle left-handed mouse
|
||||
# TODO: Make device-specific when commit released
|
||||
# https://github.com/hyprwm/hyprlang/commit/95471ec86f37acb8281062e54e2be99b24b50cd0
|
||||
#?? left DEVICE
|
||||
|
||||
left=$(("$(hyprctl getoption input:left_handed -j | jq '.int')" - 1))
|
||||
# BUG: New hyprctl syntax does not support per-device getoption
|
||||
# https://github.com/hyprwm/hyprlang/issues/43
|
||||
# HACK: Condition based on file presence, requires creation at login to set state
|
||||
#?? exec-once = left
|
||||
FILE=/tmp/left
|
||||
|
||||
hyprctl keyword input:left_handed ${left#-}
|
||||
|
||||
if [[ "$(hyprctl getoption input:left_handed -j | jq '.int')" == 1 ]]; then
|
||||
notify-send '> left' 'Left-handed' --urgency low
|
||||
else
|
||||
notify-send '> left' 'Right-handed' --urgency low
|
||||
if (("$#" == 0)); then
|
||||
touch "$FILE"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ -f "$FILE" ]]; then
|
||||
hyprctl keyword "device[$1]:left_handed" false
|
||||
hyprctl keyword "device[$1]:natural_scroll" false
|
||||
rm --force "$FILE"
|
||||
notify-send "> left" "Right-handed" --urgency low
|
||||
else
|
||||
hyprctl keyword "device[$1]:left_handed" true
|
||||
hyprctl keyword "device[$1]:natural_scroll" true
|
||||
touch "$FILE"
|
||||
notify-send "> left" "Left-handed" --urgency low
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue