diff options
-rw-r--r-- | gui/conf/touchegg.conf | 18 | ||||
-rwxr-xr-x | gui/pkgs/bin/uictrl.sh | 16 | ||||
-rw-r--r-- | gui/pkgs/uictrl.nix | 9 | ||||
-rw-r--r-- | gui/touchegg.nix | 18 |
4 files changed, 42 insertions, 19 deletions
diff --git a/gui/conf/touchegg.conf b/gui/conf/touchegg.conf deleted file mode 100644 index 2afb98b..0000000 --- a/gui/conf/touchegg.conf +++ /dev/null @@ -1,18 +0,0 @@ -<touchégg> - -<application name="All"> - -<gesture type="DRAG" fingers="3" direction="LEFT"> - <action type="SEND_KEYS">Control+j</action> -</gesture> - -<gesture type="DRAG" fingers="3" direction="RIGHT"> - <action type="SEND_KEYS">Control+k</action> -</gesture> - -<gesture type="TAP" fingers="2"> - <action type="MOUSE_CLICK">BUTTON=3</action> -</gesture> - -</application> -</touchégg> diff --git a/gui/pkgs/bin/uictrl.sh b/gui/pkgs/bin/uictrl.sh new file mode 100755 index 0000000..46c7219 --- /dev/null +++ b/gui/pkgs/bin/uictrl.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env fish + +function cycle + set nsp_ws (wmctrl -d | awk '{if ($9 == "NSP") {print $1}}') + set current_ws (wmctrl -d | awk '{if ($2 == "*") {print $1}}') + + wmctrl -l | awk -v current_ws=$current_ws -v nsp_ws=$nsp_ws '{if ($2 > current_ws && $2 != nsp_ws) {print $2}}' | uniq + wmctrl -l | awk -v current_ws=$current_ws -v nsp_ws=$nsp_ws '{if ($2 < current_ws && $2 != nsp_ws) {print $2}}' | uniq +end + +switch $argv[1] + case next + wmctrl -s (cycle)[1] + case prev + wmctrl -s (cycle | tac)[1] +end diff --git a/gui/pkgs/uictrl.nix b/gui/pkgs/uictrl.nix new file mode 100644 index 0000000..0c965ad --- /dev/null +++ b/gui/pkgs/uictrl.nix @@ -0,0 +1,9 @@ +{ stdenv, pkgs, ... }: + +pkgs.writeTextFile { + name = "uictrl"; + executable = true; + destination = "/bin/uictrl"; + + text = builtins.readFile ./bin/uictrl.sh; +} diff --git a/gui/touchegg.nix b/gui/touchegg.nix index 1455da8..fee4344 100644 --- a/gui/touchegg.nix +++ b/gui/touchegg.nix @@ -1,7 +1,23 @@ { pkgs, ... }: { - home.file.".config/touchegg/touchegg.conf".source = ./conf/touchegg.conf; + home.file.".config/touchegg/touchegg.conf".lines = let + uictrl = pkgs.lib.callPackageWith pkgs ./pkgs/uictrl.nix { }; + in '' + <touchégg> + <application name="All"> + <gesture type="DRAG" fingers="3" direction="LEFT"> + <action type="RUN_COMMAND">${uictrl}/bin/uictrl prev</action> + </gesture> + <gesture type="DRAG" fingers="3" direction="RIGHT"> + <action type="RUN_COMMAND">${uictrl}/bin/uictrl next</action> + </gesture> + <gesture type="TAP" fingers="2"> + <action type="MOUSE_CLICK">BUTTON=3</action> + </gesture> + </application> + </touchégg> + ''; systemd.user.services.touchegg = { Unit = { |