From e9bc91147da59bffdbf07fc2915c6d3048791fed Mon Sep 17 00:00:00 2001 From: developomp Date: Sat, 21 May 2022 14:29:53 +0900 Subject: [PATCH] added open tablet driver setup to osu!lazer setup --- .../.config/OpenTabletDriver/settings.json | 61 +++++++++++++++++++ src/setup/apps/osu_lazer.py | 42 ++++++++++++- 2 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 home/pomp/.config/OpenTabletDriver/settings.json diff --git a/home/pomp/.config/OpenTabletDriver/settings.json b/home/pomp/.config/OpenTabletDriver/settings.json new file mode 100644 index 0000000..73da212 --- /dev/null +++ b/home/pomp/.config/OpenTabletDriver/settings.json @@ -0,0 +1,61 @@ +{ + "Profiles": [ + { + "Tablet": "Wacom CTL-472", + "OutputMode": { + "Path": "OpenTabletDriver.Desktop.Output.LinuxArtistMode", + "Settings": [], + "Enable": true + }, + "Filters": [], + "AbsoluteModeSettings": { + "Display": { + "Width": 1920.0, + "Height": 1080.0, + "X": 960.0, + "Y": 540.0, + "Rotation": 0.0 + }, + "Tablet": { + "Width": 75.0, + "Height": 42, + "X": 21.0, + "Y": 58.0, + "Rotation": 270.0 + }, + "EnableClipping": true, + "EnableAreaLimiting": false, + "LockAspectRatio": true + }, + "RelativeModeSettings": { + "XSensitivity": 10.0, + "YSensitivity": 10.0, + "RelativeRotation": 0.0, + "RelativeResetDelay": "00:00:00.1000000" + }, + "Bindings": { + "TipActivationThreshold": 0.0, + "TipButton": { + "Path": "OpenTabletDriver.Desktop.Binding.MouseBinding", + "Settings": [ + { + "Property": "Button", + "Value": "Left" + } + ], + "Enable": true + }, + "EraserActivationThreshold": 0.0, + "EraserButton": null, + "PenButtons": [null, null], + "AuxButtons": [], + "MouseButtons": [], + "MouseScrollUp": null, + "MouseScrollDown": null + } + } + ], + "LockUsableAreaDisplay": true, + "LockUsableAreaTablet": true, + "Tools": [] +} diff --git a/src/setup/apps/osu_lazer.py b/src/setup/apps/osu_lazer.py index 6b41cf8..085b344 100644 --- a/src/setup/apps/osu_lazer.py +++ b/src/setup/apps/osu_lazer.py @@ -1,6 +1,8 @@ from os.path import exists +from os import system -from src.util import flatpak_install, paru_install +from src.constants import content_dir, home_dir +from src.util import flatpak_install, paru_install, copy_file, silent_system from src.setup.system import system76_scheduler name = "osu!lazer" @@ -11,5 +13,43 @@ def setup(): A circle-clicking rhythm game. """ + # install the game flatpak_install("sh.ppy.osu") + + # give CPU scheduler priority system76_scheduler.setup() + + # + # set up tablet driver + # + + paru_install("opentabletdriver-git") + + # apply settings + copy_file( + f"{content_dir}{home_dir}/.config/OpenTabletDriver/settings.json", + "~/.config/OpenTabletDriver/settings.json", + ) + + # disable built-in kernel modules + modules_to_disable = [ + "wacom", + "wacom_i2c", + "wacom_w8001", + "hid_uclogic", + ] + + for name in modules_to_disable: + # Add blacklist rule if it does not exist + silent_system( + f'sudo grep -qxF "blacklist {name}" /etc/modprobe.d/blacklist.conf || echo "blacklist {name}" | sudo tee -a /etc/modprobe.d/blacklist.conf' + ) + + # remove module from kernel if it's loaded + silent_system(f"sudo rmmod {name}") + + # Reload the systemd user unit daemon + system("systemctl --user daemon-reload") + + # Enable and start the user service + system("systemctl --user enable opentabletdriver --now")