aboutsummaryrefslogtreecommitdiff
path: root/src/Internal/Windows.hs
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2022-03-28 11:52:34 -0600
committerJosh Rahm <joshuarahm@gmail.com>2022-10-09 12:19:45 -0600
commit0762cb0962e269caa70d5aa6c012a2a3fc1140c9 (patch)
treeb9621342d9f16d25ce9ae2fdc1929934e4f8931e /src/Internal/Windows.hs
parentc8e3f7627115603cb794deb47505b0506baad7b0 (diff)
downloadrde-0762cb0962e269caa70d5aa6c012a2a3fc1140c9.tar.gz
rde-0762cb0962e269caa70d5aa6c012a2a3fc1140c9.tar.bz2
rde-0762cb0962e269caa70d5aa6c012a2a3fc1140c9.zip
Add (some) ability to send keys to other windows
Diffstat (limited to 'src/Internal/Windows.hs')
-rw-r--r--src/Internal/Windows.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/Internal/Windows.hs b/src/Internal/Windows.hs
index b6f5335..c6a2b8b 100644
--- a/src/Internal/Windows.hs
+++ b/src/Internal/Windows.hs
@@ -1,7 +1,9 @@
module Internal.Windows where
+import XMonad (windowset, X, Window, get)
+
import Control.Applicative ((<|>))
-import XMonad.StackSet (Stack(..), StackSet(..), Screen(..), Workspace(..), integrate, integrate')
+import XMonad.StackSet (Stack(..), StackSet(..), Screen(..), Workspace(..), integrate, integrate', allWindows)
import Data.Maybe (listToMaybe, catMaybes)
import qualified Data.Map as Map
@@ -45,6 +47,11 @@ getLocationWorkspace _ = Nothing
workspaceMember :: (Eq a) => Workspace i l a -> a -> Bool
workspaceMember (Workspace _ _ s) w = w `elem` integrate' s
+forAllWindows :: (Window -> X ()) -> X ()
+forAllWindows fn = do
+ stackSet <- windowset <$> get
+ mapM_ fn (allWindows stackSet)
+
{- Finds a Window and returns the screen its on and the workspace its on.
- Returns nothing if the window doesn't exist.
-