taj-ny / kwin-gestures

Custom touchpad gestures for KDE Plasma 6
GNU General Public License v3.0
9 stars 0 forks source link
kde kde-plasma kde-plasma-6 kwin linux plasma plasma6 wayland

KWin Gestures

Custom touchpad gestures for Plasma 6.

Tested on 6.1.5 and 6.2. X11 is not supported.

Installation

NixOS (flakes)
``flake.nix``: ```nix { inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; kwin-gestures = { url = "github:taj-ny/kwin-gestures"; inputs.nixpkgs.follows = "nixpkgs"; }; }; } ``` ```nix { inputs, pkgs, ... }: { environment.systemPackages = [ inputs.kwin-gestures.packages.${pkgs.system}.default ]; } ```

Building from source

Dependencies

[!NOTE] The dependencies were copied from another project. Not all of them are necessary.

Arch Linux
``` sudo pacman -S base-devel git extra-cmake-modules qt6-tools ```
Debian-based (KDE Neon, Kubuntu, Ubuntu)
``` sudo apt install git cmake g++ extra-cmake-modules qt6-tools-dev kwin-dev libkf6configwidgets-dev gettext libkf6crash-dev libkf6globalaccel-dev libkf6kio-dev libkf6service-dev libkf6notifications-dev libkf6kcmutils-dev libkdecorations2-dev ```
Fedora
``` sudo dnf install git cmake extra-cmake-modules gcc-g++ kf6-kwindowsystem-devel plasma-workspace-devel libplasma-devel qt6-qtbase-private-devel qt6-qtbase-devel cmake kwin-devel extra-cmake-modules kwin-devel kf6-knotifications-devel kf6-kio-devel kf6-kcrash-devel kf6-ki18n-devel kf6-kguiaddons-devel libepoxy-devel kf6-kglobalaccel-devel kf6-kcmutils-devel kf6-kconfigwidgets-devel kf6-kdeclarative-devel kdecoration-devel kf6-kglobalaccel kf6-kdeclarative libplasma kf6-kio qt6-qtbase kf6-kguiaddons kf6-ki18n wayland-devel ```
openSUSE
``` sudo zypper in git cmake-full gcc-c++ kf6-extra-cmake-modules kcoreaddons-devel kguiaddons-devel kconfigwidgets-devel kwindowsystem-devel ki18n-devel kiconthemes-devel kpackage-devel frameworkintegration-devel kcmutils-devel kirigami2-devel "cmake(KF6Config)" "cmake(KF6CoreAddons)" "cmake(KF6FrameworkIntegration)" "cmake(KF6GuiAddons)" "cmake(KF6I18n)" "cmake(KF6KCMUtils)" "cmake(KF6KirigamiPlatform)" "cmake(KF6WindowSystem)" "cmake(Qt6Core)" "cmake(Qt6DBus)" "cmake(Qt6Quick)" "cmake(Qt6Svg)" "cmake(Qt6Widgets)" "cmake(Qt6Xml)" "cmake(Qt6UiTools)" "cmake(KF6Crash)" "cmake(KF6GlobalAccel)" "cmake(KF6KIO)" "cmake(KF6Service)" "cmake(KF6Notifications)" libepoxy-devel kwin6-devel ```

Building

git clone https://github.com/taj-ny/kwin-gestures
cd kwin-gestures
mkdir build
cd build
cmake ../ -DCMAKE_INSTALL_PREFIX=/usr
make
sudo make install

Remove the build directory when rebuilding the effect.

Usage

[!NOTE] If the effect stops working after a system upgrade, you will need to rebuild it.

  1. Install the plugin.
  2. Open the Desktop Effects page in System Settings.
  3. Enable the Gestures effect in the Tools category.

Configuration

There is currently no configuration UI and it may be a while before it's added. For now, you need to manually modify the ~/.config/kwingesturesrc file. The format may change at any time until 1.0.0 is released.

Run qdbus org.kde.KWin /Effects org.kde.kwin.Effects.reconfigureEffect kwin_gestures or toggle the effect in system settings after updating the file.

Configuration file structure

Example

[Gestures][Touchpad][Lock Screen]
Type=Pinch
Fingers=2
TriggerWhenThresholdReached=true
WindowRegex=plasmashell

[Gestures][Touchpad][Lock Screen][Pinch]
Direction=Contracting
Threshold=0.9

[Gestures][Touchpad][Lock Screen][Actions][0]
Type=GlobalShortcut

[Gestures][Touchpad][Lock Screen][Actions][0][GlobalShortcut]
Component=ksmserver
Shortcut=Lock Session

[Gestures][Touchpad][Close Window]
Type=Pinch
Fingers=2
TriggerWhenThresholdReached=true

[Gestures][Touchpad][Close Window][Pinch]
Direction=Contracting
Threshold=0.9

[Gestures][Touchpad][Close Window][Actions][0]
Type=GlobalShortcut

[Gestures][Touchpad][Close Window][Actions][0][GlobalShortcut]
Component=kwin
Shortcut=Window Close

[Gestures][Touchpad][Yakuake]
Type=Swipe
Fingers=4
TriggerWhenThresholdReached=true

[Gestures][Touchpad][Yakuake][Swipe]
Direction=Down
ThresholdY=10

[Gestures][Touchpad][Yakuake][Actions][0]
Type=GlobalShortcut

[Gestures][Touchpad][Yakuake][Actions][0][GlobalShortcut]
Component=yakuake
Shortcut=toggle-window-state

[Gestures][Touchpad][Firefox Back]
Type=Swipe
Fingers=3
TriggerWhenThresholdReached=true
WindowRegex=firefox

[Gestures][Touchpad][Firefox Back][Swipe]
Direction=Left
ThresholdX=10

[Gestures][Touchpad][Firefox Back][Actions][0]
Type=KeySequence

[Gestures][Touchpad][Firefox Back][Actions][0][KeySequence]
Sequence=press LEFTCTRL,press LEFTBRACE,release LEFTCTRL,release LEFTBRACE

[Gestures][Touchpad][Firefox Forward]
Type=Swipe
Fingers=3
TriggerWhenThresholdReached=true
WindowRegex=firefox

[Gestures][Touchpad][Firefox Forward][Swipe]
Direction=Right
ThresholdX=10

[Gestures][Touchpad][Firefox Forward][Actions][0]
Type=KeySequence

[Gestures][Touchpad][Firefox Forward][Actions][0][KeySequence]
Sequence=press LEFTCTRL,press RIGHTBRACE,release LEFTCTRL,release RIGHTBRACE

[Gestures][Touchpad][Krunner]
Type=Hold
Fingers=2
TriggerWhenThresholdReached=true

[Gestures][Touchpad][Krunner][Hold]
Threshold=100

[Gestures][Touchpad][Krunner][Actions][0]
Type=GlobalShortcut

[Gestures][Touchpad][Krunner][Actions][0][GlobalShortcut]
Component=org_kde_krunner_desktop
Shortcut=_launch

Credits