From 2cb30e27cce69e5e133d34e9d1bdd7568820191f Mon Sep 17 00:00:00 2001
From: bilabila <bilabila@qq.com>
Date: Sat, 17 Dec 2022 23:58:19 +0800
Subject: [PATCH] Add a trick to increase scroll speed on some apps

---
 Tricks.md | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/Tricks.md b/Tricks.md
index e940e6e..15a618b 100644
--- a/Tricks.md
+++ b/Tricks.md
@@ -276,4 +276,27 @@ bindsym $mod+Shift+y     exec clipman clear -a
 bindsym $mod+Mod1+y      exec clipman clear --tool rofi
 # Empty the current clipping
 bindsym $mod+Ctrl+y      exec : | wl-copy -p
-```
\ No newline at end of file
+```
+
+# Increase scroll speed on some apps
+
+This script set 6x scroll speed only if app like chromium is focused, require https://github.com/acrisci/i3ipc-python.
+
+```python
+#!/usr/bin/env python
+import i3ipc, re
+r = re.compile(r'chrom|telegram|Master PDF Editor|typora',re.I)
+def on_window_focus(i3, e):
+    c = e.container.app_id
+    if not c:
+        return
+    v = 1
+    if r.search(c):
+        v = 6
+    i3.command(f"input type:pointer scroll_factor {v}")
+
+i3 = i3ipc.Connection()
+i3.on("window::focus", on_window_focus)
+i3.main()
+```
+