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";
|
jq = "${pkgs.jq}/bin/jq";
|
||||||
kill = "${pkgs.procps}/bin/kill";
|
kill = "${pkgs.procps}/bin/kill";
|
||||||
kitty = "${config.home-manager.users.${config.custom.username}.programs.kitty.package}/bin/kitty";
|
kitty = "${config.home-manager.users.${config.custom.username}.programs.kitty.package}/bin/kitty";
|
||||||
|
left = "~/.local/bin/left";
|
||||||
loginctl = "${pkgs.systemd}/bin/loginctl";
|
loginctl = "${pkgs.systemd}/bin/loginctl";
|
||||||
menu = "~/.local/bin/menu";
|
menu = "~/.local/bin/menu";
|
||||||
nautilus = "${pkgs.nautilus}/bin/nautilus";
|
nautilus = "${pkgs.nautilus}/bin/nautilus";
|
||||||
|
@ -127,7 +128,7 @@ in {
|
||||||
# TODO: Toggle trackball hand
|
# TODO: Toggle trackball hand
|
||||||
#// (key "Delete" "Super" "exec" "left")
|
#// (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" "movewindow" "d")
|
||||||
(key "Down" "Super+Shift" "movewindoworgroup" "d")
|
(key "Down" "Super+Shift" "movewindoworgroup" "d")
|
||||||
(key "Equal" "Super" "exec" "audio Normalizer")
|
(key "Equal" "Super" "exec" "audio Normalizer")
|
||||||
|
|
|
@ -9,6 +9,7 @@ with lib; let
|
||||||
firefox-esr = "${
|
firefox-esr = "${
|
||||||
config.home-manager.users.${config.custom.username}.programs.firefox.finalPackage
|
config.home-manager.users.${config.custom.username}.programs.firefox.finalPackage
|
||||||
}/bin/firefox-esr";
|
}/bin/firefox-esr";
|
||||||
|
left = "~/.local/bin/left";
|
||||||
pkill = "${pkgs.procps}/bin/pkill";
|
pkill = "${pkgs.procps}/bin/pkill";
|
||||||
rm = "${pkgs.coreutils}/bin/rm";
|
rm = "${pkgs.coreutils}/bin/rm";
|
||||||
sleep = "${pkgs.coreutils}/bin/sleep";
|
sleep = "${pkgs.coreutils}/bin/sleep";
|
||||||
|
|
|
@ -1,15 +1,27 @@
|
||||||
#! /usr/bin/env bash
|
#! /usr/bin/env bash
|
||||||
|
|
||||||
# Toggle left-handed mouse
|
# Toggle left-handed mouse
|
||||||
# TODO: Make device-specific when commit released
|
#?? left DEVICE
|
||||||
# https://github.com/hyprwm/hyprlang/commit/95471ec86f37acb8281062e54e2be99b24b50cd0
|
|
||||||
|
|
||||||
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 (("$#" == 0)); then
|
||||||
|
touch "$FILE"
|
||||||
if [[ "$(hyprctl getoption input:left_handed -j | jq '.int')" == 1 ]]; then
|
exit
|
||||||
notify-send '> left' 'Left-handed' --urgency low
|
fi
|
||||||
else
|
|
||||||
notify-send '> left' 'Right-handed' --urgency low
|
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
|
fi
|
||||||
|
|
Loading…
Reference in a new issue