X.L.IndependentScreens: Added focusWorkspace function.

This commit is contained in:
m1mir 2025-01-24 02:52:40 +01:00 committed by Tony Zorman
parent 2b11459496
commit 619a347f3f
2 changed files with 12 additions and 1 deletions

View File

@ -45,6 +45,11 @@
a client sends a **_NET_CURRENT_DESKTOP** request. It is now possible a client sends a **_NET_CURRENT_DESKTOP** request. It is now possible
to change it using the `setEwmhSwitchDesktopHook`. to change it using the `setEwmhSwitchDesktopHook`.
* `XMonad.Layout.IndependentScreens`
- Added `focusWorkspace` for focusing workspaces on the screen that they
belong to.
## 0.18.1 (August 20, 2024) ## 0.18.1 (August 20, 2024)
### Breaking Changes ### Breaking Changes

View File

@ -27,7 +27,7 @@ module XMonad.Layout.IndependentScreens (
whenCurrentOn, whenCurrentOn,
countScreens, countScreens,
workspacesOn, workspacesOn,
workspaceOnScreen, focusWindow', focusScreen, nthWorkspace, withWspOnScreen, workspaceOnScreen, focusWindow', focusScreen, focusWorkspace, nthWorkspace, withWspOnScreen,
-- * Converting between virtual and physical workspaces -- * Converting between virtual and physical workspaces
-- $converting -- $converting
marshall, unmarshall, unmarshallS, unmarshallW, marshall, unmarshall, unmarshallS, unmarshallW,
@ -40,6 +40,7 @@ import XMonad
import XMonad.Hooks.StatusBar.PP import XMonad.Hooks.StatusBar.PP
import XMonad.Prelude import XMonad.Prelude
import qualified XMonad.StackSet as W import qualified XMonad.StackSet as W
import XMonad.Actions.OnScreen (viewOnScreen)
-- $usage -- $usage
-- You can use this module with the following in your @xmonad.hs@: -- You can use this module with the following in your @xmonad.hs@:
@ -163,6 +164,11 @@ focusWindow' window ws
focusScreen :: ScreenId -> WindowSet -> WindowSet focusScreen :: ScreenId -> WindowSet -> WindowSet
focusScreen screenId = withWspOnScreen screenId W.view focusScreen screenId = withWspOnScreen screenId W.view
-- | Focus the given workspace on the correct Xinerama screen.
-- An example usage can be found at `XMonad.Hooks.EwmhDesktops.setEwmhSwitchDesktopHook`
focusWorkspace :: WorkspaceId -> WindowSet -> WindowSet
focusWorkspace workspaceId = viewOnScreen (unmarshallS workspaceId) workspaceId
-- | Get the nth virtual workspace -- | Get the nth virtual workspace
nthWorkspace :: Int -> X (Maybe VirtualWorkspace) nthWorkspace :: Int -> X (Maybe VirtualWorkspace)
nthWorkspace n = (!? n) . workspaces' <$> asks config nthWorkspace n = (!? n) . workspaces' <$> asks config