From 15babdfa8534e4cf45797ca138322d7e2292776f Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Fri, 20 Sep 2024 02:23:09 +0200 Subject: [PATCH] Configure Surface Touchpad by default --- scripts/Arch/Drivers/SurfaceBook2/main.fish | 1 + scripts/Common/Drivers/SurfaceBook2/main.fish | 13 +++++++++++++ scripts/Common/Software/KDE/input.fish | 19 +++++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 scripts/Common/Drivers/SurfaceBook2/main.fish create mode 100644 scripts/Common/Software/KDE/input.fish diff --git a/scripts/Arch/Drivers/SurfaceBook2/main.fish b/scripts/Arch/Drivers/SurfaceBook2/main.fish index 79185a03..8c11b875 100755 --- a/scripts/Arch/Drivers/SurfaceBook2/main.fish +++ b/scripts/Arch/Drivers/SurfaceBook2/main.fish @@ -16,6 +16,7 @@ begin "MODULES+=(pinctrl_sunrisepoint surface_dtx)" end | sudo tee /etc/mkinitcpio.conf.d/surface-book-2.conf > /dev/null + fish "$dir/../../../Common/Drivers/SurfaceBook2/main.fish" configure sudo systemctl enable surface-dtx-daemon.service sudo systemctl enable --global surface-dtx-userd.service end diff --git a/scripts/Common/Drivers/SurfaceBook2/main.fish b/scripts/Common/Drivers/SurfaceBook2/main.fish new file mode 100644 index 00000000..9a9abb27 --- /dev/null +++ b/scripts/Common/Drivers/SurfaceBook2/main.fish @@ -0,0 +1,13 @@ +#!/bin/env fish +begin + set -l dir (status dirname) + source "$dir/../../Scripts/software.fish" + + function configureSW -V dir + . "$dir/../../Software/KDE/input.fish" + addInputConfig 1118 2338 "Microsoft Surface Keyboard Touchpad" "NaturalScroll=true" + end + + runInstaller $argv + fish "$dir/../Surface/main.fish" $argv +end diff --git a/scripts/Common/Software/KDE/input.fish b/scripts/Common/Software/KDE/input.fish new file mode 100644 index 00000000..ac122195 --- /dev/null +++ b/scripts/Common/Software/KDE/input.fish @@ -0,0 +1,19 @@ +function addInputConfig -a vendorID productID name + set -l file /etc/xdg/kcminputrc + set -l statements $argv[4..] + + if [ -z "$statements" ] + set statements (cat) + end + + if not cat $file | grep "\\[$name\\]" > /dev/null 2>&1 + begin + printf %s\n \ + (if [ -f $file ] && [ -n (cat $file) ] + echo "" + end) \ + "[Libinput][$vendorID][$productID][$name]" \ + "$statements" + end | sudo tee $file > /dev/null + end +end