summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2023-01-23 16:11:54 +0100
committertv <tv@krebsco.de>2023-01-23 16:11:54 +0100
commitd809b984649771425a5355b60208fdf42c611991 (patch)
tree87b46564459ae5ddce2bed4ed558c176b0e85b5f /config
parent77357335a3a88a4b93f91a46ab939a1a9b192977 (diff)
tv config: scroll linewise when TOUCHSCREEN==1
Diffstat (limited to 'config')
-rw-r--r--config/tv.hs14
1 files changed, 12 insertions, 2 deletions
diff --git a/config/tv.hs b/config/tv.hs
index f7bdd90..2d57678 100644
--- a/config/tv.hs
+++ b/config/tv.hs
@@ -12,6 +12,8 @@ import Much.Core
import Much.State
import Much.TreeView
import Scanner
+import System.Environment (getEnv)
+import System.IO.Unsafe (unsafePerformIO)
import Text.Hyphenation
import Text.LineBreak
import qualified Data.Tree as Tree
@@ -19,6 +21,14 @@ import qualified Data.Tree.Zipper as Z
import qualified Much.API
import qualified Notmuch.Message as Notmuch
+
+scrollLines :: Int
+scrollLines =
+ if unsafePerformIO (getEnv "TOUCHSCREEN") == "1" then
+ 1
+ else
+ 3
+
main :: IO ()
main =
mainWithState def
@@ -110,7 +120,7 @@ myKeymap s = displayKey s
myMousemap :: Scan -> State -> IO State
myMousemap ScanMouse{mouseButton=1,mouseY=y} = defaultMouse1Click y
myMousemap ScanMouse{mouseButton=3,mouseY=y} = \q -> defaultMouse1Click y q >>= toggleFold
-myMousemap ScanMouse{mouseButton=4} = moveTreeDown 3
-myMousemap ScanMouse{mouseButton=5} = moveTreeUp 3
+myMousemap ScanMouse{mouseButton=4} = moveTreeDown scrollLines
+myMousemap ScanMouse{mouseButton=5} = moveTreeUp scrollLines
myMousemap ScanMouse{mouseButton=0} = return
myMousemap info = displayMouse info