initial commit

This commit is contained in:
Marco Realacci 2024-05-13 02:09:03 +02:00
parent d941326bc9
commit e28d9b4afa
8 changed files with 79 additions and 0 deletions

8
.idea/.gitignore vendored Normal file
View file

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View file

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

7
.idea/misc.xml Normal file
View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="Python 3.12 (plasma-mxmaster-fix)" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (plasma-mxmaster-fix)" project-jdk-type="Python SDK" />
</project>

8
.idea/modules.xml Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/plasma-mxmaster-fix.iml" filepath="$PROJECT_DIR$/.idea/plasma-mxmaster-fix.iml" />
</modules>
</component>
</project>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.venv" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

3
install.sh Executable file
View file

@ -0,0 +1,3 @@
mkdir /opt/plasma-mxmaster-fix
cp plasma-mxmaster-fix.py /opt/plasma-mxmaster-fix/plasma-mxmaster-fix.py
cp plasma-mxmaster-fix.service /etc/systemd/user/plasma-mxmaster-fix.service

26
plasma-mxmaster-fix.py Normal file
View file

@ -0,0 +1,26 @@
import subprocess
import time
firefox_mode = False
while True:
result = subprocess.run(['kdotool', 'getmouselocation'], stdout=subprocess.PIPE)
pointed_window = str(result.stdout).split("window:{")[1].split("}")[0]
result = subprocess.run(['qdbus', 'org.kde.KWin', '/KWin', 'org.kde.KWin.getWindowInfo', pointed_window],
stdout=subprocess.PIPE)
window_info = str(result.stdout)
window_title = window_info.split("resourceName: ")[1].split("\\n")[0]
if not firefox_mode and window_title == "firefox":
subprocess.run(
'dbus-send --type=method_call --dest=org.kde.KWin /org/kde/KWin/InputDevice/event11 org.freedesktop.DBus.Properties.Set string:"org.kde.KWin.InputDevice" string:"scrollFactor" variant:double:1',
shell=True)
firefox_mode = True
elif firefox_mode and window_title != "firefox":
subprocess.run(
'dbus-send --type=method_call --dest=org.kde.KWin /org/kde/KWin/InputDevice/event11 org.freedesktop.DBus.Properties.Set string:"org.kde.KWin.InputDevice" string:"scrollFactor" variant:double:0.1',
shell=True)
firefox_mode = False
time.sleep(0.5)

View file

@ -0,0 +1,11 @@
[Unit]
Description=Plasma MX Master 3S fix
After=multi-user.target
[Service]
Type=simple
Restart=always
ExecStart=/usr/bin/python3 /opt/plasma-mxmaster-fix/plasma-mxmaster-fix.py
[Install]
WantedBy=multi-user.target