module XMonad.Prompt.Workspace (
workspacePrompt,
Wor(Wor),
) where
import XMonad hiding ( workspaces )
import XMonad.Prompt
import XMonad.StackSet ( workspaces, tag )
import XMonad.Util.WorkspaceCompare ( getSortByIndex )
newtype Wor = Wor String
instance XPrompt Wor where
showXPrompt :: Wor -> String
showXPrompt (Wor String
x) = String
x
workspacePrompt :: XPConfig -> (String -> X ()) -> X ()
workspacePrompt :: XPConfig -> (String -> X ()) -> X ()
workspacePrompt XPConfig
c String -> X ()
job = do [Workspace String (Layout Window) Window]
ws <- (XState -> [Workspace String (Layout Window) Window])
-> X [Workspace String (Layout Window) Window]
forall s (m :: * -> *) a. MonadState s m => (s -> a) -> m a
gets (StackSet String (Layout Window) Window ScreenId ScreenDetail
-> [Workspace String (Layout Window) Window]
forall i l a s sd. StackSet i l a s sd -> [Workspace i l a]
workspaces (StackSet String (Layout Window) Window ScreenId ScreenDetail
-> [Workspace String (Layout Window) Window])
-> (XState
-> StackSet String (Layout Window) Window ScreenId ScreenDetail)
-> XState
-> [Workspace String (Layout Window) Window]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. XState
-> StackSet String (Layout Window) Window ScreenId ScreenDetail
windowset)
WorkspaceSort
sort <- X WorkspaceSort
getSortByIndex
let ts :: [String]
ts = (Workspace String (Layout Window) Window -> String)
-> [Workspace String (Layout Window) Window] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map Workspace String (Layout Window) Window -> String
forall i l a. Workspace i l a -> i
tag ([Workspace String (Layout Window) Window] -> [String])
-> [Workspace String (Layout Window) Window] -> [String]
forall a b. (a -> b) -> a -> b
$ WorkspaceSort
sort [Workspace String (Layout Window) Window]
ws
Wor -> XPConfig -> ComplFunction -> (String -> X ()) -> X ()
forall p.
XPrompt p =>
p -> XPConfig -> ComplFunction -> (String -> X ()) -> X ()
mkXPrompt (String -> Wor
Wor String
"") XPConfig
c (XPConfig -> [String] -> ComplFunction
mkComplFunFromList' XPConfig
c [String]
ts) String -> X ()
job