aboutsummaryrefslogtreecommitdiff
path: root/src/Rahm/Desktop/Keys.hs
diff options
context:
space:
mode:
authorJosh Rahm <rahm@josher.dev>2026-08-09 17:22:22 -0600
committerJosh Rahm <rahm@josher.dev>2026-08-09 17:22:22 -0600
commita80d4e2d36b377b3466db3b2628b9dec71fcfce2 (patch)
treea9109869c6bc4516ebeccc80b68fc314031e08aa /src/Rahm/Desktop/Keys.hs
parenta66a73ebe45cbad857f8a2e30050cb94cc1ace39 (diff)
downloadrde-a80d4e2d36b377b3466db3b2628b9dec71fcfce2.tar.gz
rde-a80d4e2d36b377b3466db3b2628b9dec71fcfce2.tar.bz2
rde-a80d4e2d36b377b3466db3b2628b9dec71fcfce2.zip
I'm not even sure.HEADmain
Diffstat (limited to 'src/Rahm/Desktop/Keys.hs')
-rw-r--r--src/Rahm/Desktop/Keys.hs52
1 files changed, 49 insertions, 3 deletions
diff --git a/src/Rahm/Desktop/Keys.hs b/src/Rahm/Desktop/Keys.hs
index af1893b..f9d8b1f 100644
--- a/src/Rahm/Desktop/Keys.hs
+++ b/src/Rahm/Desktop/Keys.hs
@@ -118,6 +118,7 @@ import qualified Rahm.Desktop.StackSet as W
import Rahm.Desktop.Submap
( escape,
mapNextString,
+ nextButtonOrKeyEvent,
submap,
submapButtonsWithKey,
)
@@ -323,6 +324,12 @@ button14 = 14
button15 :: Button
button15 = 15
+syntheticKeyMoveLeft :: KeySym
+syntheticKeyMoveLeft = 0x1110000000000000
+
+syntheticKeyMoveRight :: KeySym
+syntheticKeyMoveRight = 0x1110000000000001
+
mapWindows :: (Ord b) => (a -> b) -> W.StackSet i l a s sd -> W.StackSet i l b s sd
mapWindows fn (W.StackSet cur vis hidden float) =
W.StackSet
@@ -1168,8 +1175,24 @@ bindings = do
bind syntheticKeyStartDrag $
noMod $
- subbind $ do
- bind button1 $ noMod $ noWindow D.dragWindow
+ runMaybeT_ $ do
+ ev <- nextButtonOrKeyEvent
+ lift $ do
+ click
+ mapM_ stylusMoveWindow . W.peek =<< gets windowset
+
+ bind syntheticKeyStartResize $
+ noMod $
+ runMaybeT_ $ do
+ ev <- nextButtonOrKeyEvent
+ lift $ do
+ click
+ mapM_ stylusResizeWindow . W.peek =<< gets windowset
+
+ -- subbind $ do
+ -- bind button1 $ noMod $ noWindow $ do
+ -- logs Info "Start drag!"
+ -- D.dragWindow
let button14Binder = do
bind button3 $
@@ -1454,7 +1477,11 @@ rdeBasicCommandHandler =
SyntheticKeySym mask keySym -> do
logs Info "Got synthetic keysym mask %s %s" (show mask) (show keySym)
keyMap <- asks (\c -> keys (config c) (config c))
- sequence_ $ Map.lookup (mask, keySym) keyMap
+ logs Info "Got keymap"
+ sequence_ $
+ (logs Info "running command" >>)
+ <$> Map.lookup (mask, keySym) keyMap
+ logs Info "Finished thing"
ToNextLayout -> sendMessage toNextLayout
)
@@ -1474,6 +1501,25 @@ cornersConfig =
myMouseMoveWindow = myMouseMoveWindows . Identity
+stylusMoveWindow :: Window -> X ()
+stylusMoveWindow w =
+ D.mouseMoveWindowsAndThen
+ (mapM_ X.focus)
+ ( mconcat
+ [ D.ifReleased button2 D.sinkOnRelease
+ ]
+ )
+ [w]
+
+stylusResizeWindow :: Window -> X ()
+stylusResizeWindow =
+ D.mouseResizeWindowAndThen
+ X.focus
+ ( mconcat
+ [ D.ifReleased button2 D.sinkOnRelease
+ ]
+ )
+
myMouseMoveWindows :: (Foldable f) => f Window -> X ()
myMouseMoveWindows =
D.mouseMoveWindowsAndThen