Skip to content

Instantly share code, notes, and snippets.

@iberianpig
Last active May 1, 2023 23:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iberianpig/6e7049a02489950f570b4a27cff8df5e to your computer and use it in GitHub Desktop.
Save iberianpig/6e7049a02489950f570b4a27cff8df5e to your computer and use it in GitHub Desktop.
Change finger count for default gestures in Gnome Wayland (require login/logout after executing this script.)
function gnome-wayland-change-finger-count() {
local finger_count=$1
case "${finger_count}" in
3|4|5)
echo "changing finger count to ${finger_count}"
# check if the file we want to customize is in the gresource list
if gresource list /usr/lib/gnome-shell/libgnome-shell.so | grep -q 'swipetracker.js'; then
# create a folder to hold your custom overlays
mkdir -p ~/.gnome-shell-custom-overlays/ui
# extract the file we want to customize
gresource extract /usr/lib/gnome-shell/libgnome-shell.so /org/gnome/shell/ui/swipetracker.js > ~/.gnome-shell-custom-overlays/ui/swipetracker.js
# change the gesture_finger_count value
sed -i "s:const gesture_finger_count = [[:digit:]];:const gesture_finger_count = ${finger_count};:" ~/.gnome-shell-custom-overlays/ui/swipetracker.js
# set the g_resource_overlays environment variable in ~/.config/environment.d/gnome-shell-overlay.conf
mkdir -p ~/.config/environment.d
echo 'g_resource_overlays="/org/gnome/shell/ui/swipetracker.js=$home/.gnome-shell-custom-overlays/ui/swipetracker.js"' > ~/.config/environment.d/gnome-shell-overlay.conf
else
echo "swipetracker.js not found in libgnome-shell.so" > /tmp/swipetracker.log
fi
;;
*)
echo "usage: $0 [3|4|5]"
esac
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment