aboutsummaryrefslogtreecommitdiff
path: root/src/Internal/Keys.hs
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2022-03-28 11:52:34 -0600
committerJosh Rahm <rahm@google.com>2022-03-28 11:52:34 -0600
commitd15ea771e45b60f32c83bfd90386c60d192299c0 (patch)
treeb9621342d9f16d25ce9ae2fdc1929934e4f8931e /src/Internal/Keys.hs
parentb8bb40af61fbbf1c13c4556832055304109311db (diff)
downloadrde-d15ea771e45b60f32c83bfd90386c60d192299c0.tar.gz
rde-d15ea771e45b60f32c83bfd90386c60d192299c0.tar.bz2
rde-d15ea771e45b60f32c83bfd90386c60d192299c0.zip
Add (some) ability to send keys to other windows
Diffstat (limited to 'src/Internal/Keys.hs')
-rw-r--r--src/Internal/Keys.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/Internal/Keys.hs b/src/Internal/Keys.hs
index 5d4e6fe..13112cb 100644
--- a/src/Internal/Keys.hs
+++ b/src/Internal/Keys.hs
@@ -1,6 +1,8 @@
{-# LANGUAGE RankNTypes #-}
module Internal.Keys (applyKeys) where
+import Control.Monad.Trans.Class
+import Control.Monad.Reader
import Control.Monad.Loops (iterateWhile)
import Control.Monad.Fix (fix)
import Graphics.X11.ExtraTypes.XF86;
@@ -41,6 +43,7 @@ import XMonad.Actions.SpawnOn as SpawnOn
import qualified Data.Map as Map
import qualified XMonad.StackSet as W
+import Internal.Windows
import Internal.Lib
import Internal.DMenu
import Internal.PassMenu
@@ -112,8 +115,26 @@ keymap = runKeys $ do
-- something goes wrong with the keyboard layout and for first-time boots
-- where dmenu/alacritty may not be installed.
rawMask mod4Mask $ spawn "xterm"
+
+ -- Moves xmobar to different monitors.
justMod $ spawn "pkill -SIGUSR1 xmobar"
+ bind xK_F1 $ do
+ -- Experimental. Sends 'a' to all windows.
+ --
+ -- I've discovered that many clients ignore such synthetic events, including
+ -- Spotify, Chrome and Gedit. Some, like Chrome, seem to honor them if it's
+ -- focused. It's pretty annoying because it keeps me from doing some cool
+ -- things all for BS security theater, but I guess there might be some way
+ -- to do this via XTest?
+ shiftMod $ forAllWindows $ \w -> do
+ logs $ "Try send to " ++ show w
+ sendKey (0, xK_a) w
+
+ -- Experimental. Sends 'A' 10 times to the focused window.
+ justMod $
+ replicateM_ 10 $ withFocused (sendKey (shiftMask, xK_a))
+
bind xK_F10 $ do
justMod playPause