From e659bd2a66d23f2dae543006b40c77d58322c475 Mon Sep 17 00:00:00 2001 From: Jordan Atwood Date: Tue, 3 Jan 2023 15:43:03 -0800 Subject: [PATCH] Add libinput-gestures config This commit also adds an old script used for facilitating browser navigation backwards with a 4-finger swipe, as Firefox previously was not handling overscroll navigation correctly. It is no longer in use as the fix in the comments of these files made precise scrolling work, which in turn made overscroll navigation work as well. --- src/.bin/libinput-gestures-browser-back.sh | 23 ++++++++++++++++++++++ src/.config/libinput-gestures.conf | 22 +++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100755 src/.bin/libinput-gestures-browser-back.sh create mode 100644 src/.config/libinput-gestures.conf diff --git a/src/.bin/libinput-gestures-browser-back.sh b/src/.bin/libinput-gestures-browser-back.sh new file mode 100755 index 0000000..921c77b --- /dev/null +++ b/src/.bin/libinput-gestures-browser-back.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +### +### An xdotools composing script to detect whether the active window is a +### browser (tested against Firefox and Chromium) and, if so, send a Backspace +### to it to attempt to navigate to the previous page. +### This is no longer used as activating precise scrolling via adding +### `MOZ_USE_XINPUT2=1` to `/etc/environment` fixes 2-finger scrolling +### activating previous and next page behavior in Firefox. +### See: https://askubuntu.com/a/1149543/464000 +### + +wid="$( + comm -12 \ + <(xdotool getactivewindow) \ + <(cat \ + <(xdotool search --classname Navigator) \ + <(xdotool search --classname chromium) \ + | sort) +)" +if [ -n "$wid" ]; then + xdotool key --window "$wid" BackSpace +fi diff --git a/src/.config/libinput-gestures.conf b/src/.config/libinput-gestures.conf new file mode 100644 index 0000000..fb98b15 --- /dev/null +++ b/src/.config/libinput-gestures.conf @@ -0,0 +1,22 @@ +# 3-finger swipe left/right to switch to left/right desktop +gesture swipe left 3 qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Switch One Desktop to the Left" +gesture swipe right 3 qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Switch One Desktop to the Right" + +# 3-fnger swipe up or down to toggle KDE Plasma overview (similar to MacOS +# "Mission Control") +# Ideally I'd like to only toggle it with 3-finger swipe up, however then it +# could only be de-activated by 3-finger swiping up again which is very +# counter-intuitive. Hence, giving the same behavior to both makes it feel +# right. +gesture swipe up 3 qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Overview" +gesture swipe down 3 qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "Overview" + +# 4-finger pinch in shows KDE Plasma desktop grid (shows all virtual desktops +# at once) +gesture pinch in 4 qdbus org.kde.kglobalaccel /component/kwin invokeShortcut "ShowDesktopGrid" + +# Deprecated: 4-finger swipe left triggers browser back +# This is no longer needed as adding `MOZ_USE_XINPUT2=1` to `/etc/environment` +# fixes 2-finger left/right swiping functioning as back and forward. +# See: https://askubuntu.com/a/1149543/464000 +#gesture swipe left 4 ~/.bin/libinput-gestures-browser-back.sh