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. --- extras/HOME/.xmobarrc | 10 ++++---- extras/HOME/.xmonad/xmobar-wifi | 2 +- src/Main.hs | 11 +++++++++ src/Rahm/Desktop/Keys.hs | 51 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 6 deletions(-) diff --git a/extras/HOME/.xmobarrc b/extras/HOME/.xmobarrc index 3367918..ba63b40 100644 --- a/extras/HOME/.xmobarrc +++ b/extras/HOME/.xmobarrc @@ -34,10 +34,10 @@ Config \%UnsafeStdinReader%}{\ \\ \|\ + \ %tabletmode% \ + \  \ + \|\ \ %wifi% \ - \\ - \ %weather% \ - \\ \%media%\ \%bluetooth% %bat% %cpu% %memory% %time% ", commands = @@ -84,11 +84,11 @@ Config ] 10, Run Com ".xmonad/xmobar-media" [] "media" 20, - Run Com ".xmonad/xmobar-weather" [] "weather" 9000, Run Com ".xmonad/xmobar-logo" [] "logo" 0, Run Com "uname" ["-r"] "uname" 0, Run Com ".xmonad/xmobar-bluetooth" [] "bluetooth" 50, Run Com ".xmonad/xmobar-wifi" [] "wifi" 50, - Run Com ".xmonad/xmobar-battery" [] "bat" 20 + Run Com ".xmonad/xmobar-battery" [] "bat" 10, + Run Com "/home/rahm/.local/bin/tablet-mode-toggle" ["status"] "tabletmode" 20 ] } diff --git a/extras/HOME/.xmonad/xmobar-wifi b/extras/HOME/.xmonad/xmobar-wifi index 0422cc5..6e137dc 100755 --- a/extras/HOME/.xmonad/xmobar-wifi +++ b/extras/HOME/.xmonad/xmobar-wifi @@ -14,5 +14,5 @@ elif [[ -z "$ethernet" ]] ; then echo " $name" else devname=$(echo "$ethernet" | awk '{print $4}') - echo " $devname" + echo " $devname" fi 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