From 65c68092cbccc2c54ea792b6d09f643edbebd4de Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Thu, 2 Apr 2026 18:54:41 -0600 Subject: Commits specific to my yoga thinkpad. --- src/Main.hs | 11 +++++++++++ src/Rahm/Desktop/Keys.hs | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) (limited to 'src') diff --git a/src/Main.hs b/src/Main.hs index e6bced1..be77b34 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -125,6 +125,7 @@ main = do className =? "zenity" --> doCenterFloat, className =? "gnuplot_qt" --> doCenterFloat, className =? "Yad" --> doCenterFloat, + className =? "XVkbd" --> doBottomFloat, className =? "Xfce4-notifyd" --> doIgnore, className =? "popup-terminal" --> doShift "*" <> updatePopupTerminalHook, className =? "spotify" --> doShift "s", @@ -204,6 +205,16 @@ doCenterFloat = centerRect :: W.RationalRect -> W.RationalRect centerRect (W.RationalRect x y w h) = W.RationalRect ((1 - w) / 2) ((1 - h) / 2) w h +doBottomFloat :: ManageHook +doBottomFloat = + ask >>= \w -> doF . W.float w . bottomRect . snd =<< liftX (floatLocation w) + +bottomRect :: W.RationalRect -> W.RationalRect +bottomRect (W.RationalRect _ _ w h) = + let h' = min 1 (2 * h) + w' = min 1 (2 * w) + in W.RationalRect ((1 - w') / 2) (1 - h') w' h' + windowHooks :: WindowHook -> XConfig l -> XConfig l windowHooks (Query readerT) config = do config diff --git a/src/Rahm/Desktop/Keys.hs b/src/Rahm/Desktop/Keys.hs index 77c3ca3..bbf182f 100644 --- a/src/Rahm/Desktop/Keys.hs +++ b/src/Rahm/Desktop/Keys.hs @@ -197,6 +197,40 @@ mediaSeekBDoc = doc "Seek back 3 seconds" mediaSeekB mediaSeekFDoc = doc "Seek forward 12 seconds" mediaSeekF +-- Screen rotation functions +-- Screen + input rotation functions +rotateScreenNormal = + mapM_ + spawnX + [ "xrandr --output eDP-1 --rotate normal", + "xinput set-prop \"Wacom HID 527E Finger\" \"Coordinate Transformation Matrix\" 1 0 0 0 1 0 0 0 1", + "xinput set-prop \"Wacom HID 527E Pen Pen (0x80e64f93)\" \"Coordinate Transformation Matrix\" 1 0 0 0 1 0 0 0 1" + ] + +rotateScreen180 = + mapM_ + spawnX + [ "xrandr --output eDP-1 --rotate inverted", + "xinput set-prop \"Wacom HID 527E Finger\" \"Coordinate Transformation Matrix\" -1 0 1 0 -1 1 0 0 1", + "xinput set-prop \"Wacom HID 527E Pen Pen (0x80e64f93)\" \"Coordinate Transformation Matrix\" -1 0 1 0 -1 1 0 0 1" + ] + +rotateScreen90 = + mapM_ + spawnX + [ "xrandr --output eDP-1 --rotate right", + "xinput set-prop \"Wacom HID 527E Finger\" \"Coordinate Transformation Matrix\" 0 1 0 -1 0 1 0 0 1", + "xinput set-prop \"Wacom HID 527E Pen Pen (0x80e64f93)\" \"Coordinate Transformation Matrix\" 0 1 0 -1 0 1 0 0 1" + ] + +rotateScreen270 = + mapM_ + spawnX + [ "xrandr --output eDP-1 --rotate left", + "xinput set-prop \"Wacom HID 527E Finger\" \"Coordinate Transformation Matrix\" 0 -1 1 1 0 0 0 0 1", + "xinput set-prop \"Wacom HID 527E Pen Pen (0x80e64f93)\" \"Coordinate Transformation Matrix\" 0 -1 1 1 0 0 0 0 1" + ] + kcQ :: KeyCode kcQ = 24 @@ -377,6 +411,23 @@ bindings = do justMod mediaNextDoc shiftMod mediaSeekFDoc + -- Screen rotation bindings + bind xK_Up $ do + justMod $ + doc "Rotate screen to normal orientation" rotateScreenNormal + + bind xK_Down $ do + justMod $ + doc "Rotate screen 180 degrees" rotateScreen180 + + bind xK_Right $ do + justMod $ + doc "Rotate screen 90 degrees clockwise" rotateScreen90 + + bind xK_Left $ do + justMod $ + doc "Rotate screen 270 degrees clockwise (90 counter-clockwise)" rotateScreen270 + bind xK_Return $ do justMod swapMaster -- The only raw keybinding. It's a consistent way to launch xterm to unbrick -- cgit