Skip to content

Commit

Permalink
X.L.IndependentScreens: Added focusWorkspace function.
Browse files Browse the repository at this point in the history
  • Loading branch information
m1mir authored and slotThe committed Jan 25, 2025
1 parent daccf68 commit fa76527
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@
a client sends a **_NET_CURRENT_DESKTOP** request. It is now possible
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)

### Breaking Changes
Expand Down
8 changes: 7 additions & 1 deletion XMonad/Layout/IndependentScreens.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module XMonad.Layout.IndependentScreens (
whenCurrentOn,
countScreens,
workspacesOn,
workspaceOnScreen, focusWindow', focusScreen, nthWorkspace, withWspOnScreen,
workspaceOnScreen, focusWindow', focusScreen, focusWorkspace, nthWorkspace, withWspOnScreen,
-- * Converting between virtual and physical workspaces
-- $converting
marshall, unmarshall, unmarshallS, unmarshallW,
Expand All @@ -40,6 +40,7 @@ import XMonad
import XMonad.Hooks.StatusBar.PP
import XMonad.Prelude
import qualified XMonad.StackSet as W
import XMonad.Actions.OnScreen (viewOnScreen)

-- $usage
-- You can use this module with the following in your @xmonad.hs@:
Expand Down Expand Up @@ -163,6 +164,11 @@ focusWindow' window ws
focusScreen :: ScreenId -> WindowSet -> WindowSet
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
nthWorkspace :: Int -> X (Maybe VirtualWorkspace)
nthWorkspace n = (!? n) . workspaces' <$> asks config
Expand Down

0 comments on commit fa76527

Please sign in to comment.