aboutsummaryrefslogtreecommitdiff
path: root/src/Internal/Keys.hs
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2022-04-01 16:49:07 -0600
committerJosh Rahm <joshuarahm@gmail.com>2022-10-09 12:19:46 -0600
commit255e93111fe464bb035bfe4fcc79311404746471 (patch)
treedcccd5792feb7cff6c9781536205b59466cde434 /src/Internal/Keys.hs
parentedd905971d9f0b7b7b09d65fe8ee9cc8337f4172 (diff)
downloadrde-255e93111fe464bb035bfe4fcc79311404746471.tar.gz
rde-255e93111fe464bb035bfe4fcc79311404746471.tar.bz2
rde-255e93111fe464bb035bfe4fcc79311404746471.zip
More experimental MouseMotion
Diffstat (limited to 'src/Internal/Keys.hs')
-rw-r--r--src/Internal/Keys.hs36
1 files changed, 7 insertions, 29 deletions
diff --git a/src/Internal/Keys.hs b/src/Internal/Keys.hs
index fcf233e..6d34c4a 100644
--- a/src/Internal/Keys.hs
+++ b/src/Internal/Keys.hs
@@ -46,6 +46,7 @@ import XMonad.Actions.SpawnOn as SpawnOn
import qualified Data.Map as Map
import qualified XMonad.StackSet as W
+import Internal.MouseMotion
import Internal.Windows
import Internal.Lib
import Internal.DMenu
@@ -356,34 +357,8 @@ keymap = runKeys $ do
bind xK_q $
(justMod -|- noMod) $
- let fi = fromIntegral
- mag (fi -> x₁, fi -> y₁) (fi -> x₂, fi -> y₂) =
- sqrt ((x₂ - x₁) ^ 2 + (y₂ - y₁) ^ 2) in
-
- doc "EXPERIMENTAL: Move mouse to control media." $ fix $ \recur -> do
-
- -- Moving the mouse 100+ pixels to the right will go to the next song
- -- Moving the mouse 100+ pixel to the left will go to the prior song
- -- Moving the mouse vertically 100+ pixels will stop the loop
- --
- -- May mess up the mouse, requiring an XMonad reboot, which is why
- -- this is experimental. It's not the most practical bindings in the
- -- world, but it shows that it's theoretically possible to program
- -- some neat mouse moptions to do cool things.
- firstMotion@(x, y) <- nextMotion
- (x', y') <- iterateWhile ((<100) . mag firstMotion) nextMotion
-
-
- if abs (y' - y) > abs (x' - x)
- then
- if (y' - y) < 0
- then logs "up"
- else logs "down"
- else do
- if (x' - x) < 0
- then mediaPrev
- else mediaNext
- recur
+ doc "EXPERIMENTAL: Move mouse to control media." $
+ mouseRotateMotion (logs "CW") (logs "CCW")
bind xK_r $ do
justMod $ doc "Run a command via Rofi" runDMenu
@@ -625,9 +600,12 @@ mouseMap = runButtons $ do
bind button13 $ noMod $ subMouse $ do
bind button1 $ noMod mouseMoveWindow
+ bind button2 $ noMod $ windows . W.sink
bind button3 $ noMod mouseResizeWindow
- bind button13 $ noMod $ windows . W.sink
+ bind button13 $ noMod $ subMouse $ do
+ bind button13 $ noMod $ subMouse $ do
+ bind button13 $ noMod $ noWindow $ spawnX "xsecurelock"
bind button15 $ do