1
0
mirror of https://github.com/xmonad/xmonad-contrib.git synced 2025-07-30 19:51:51 -07:00
Files
.github
XMonad
Actions
Config
Doc
Hooks
Layout
Prompt
AppLauncher.hs
AppendFile.hs
ConfirmPrompt.hs
DirExec.hs
Directory.hs
Email.hs
FuzzyMatch.hs
Input.hs
Layout.hs
Man.hs
OrgMode.hs
Pass.hs
RunOrRaise.hs
Shell.hs
Ssh.hs
Theme.hs
Unicode.hs
Window.hs
Workspace.hs
XMonad.hs
Zsh.hs
Util
Doc.hs
Prelude.hs
Prompt.hs
scripts
tests
.gitignore
.hlint.yaml
.mailmap
CHANGES.md
CONTRIBUTING.md
LICENSE
README.md
Setup.lhs
cabal.haskell-ci
cabal.project
flake.nix
stack-master.yaml
stack.yaml
xmonad-contrib.cabal
xmonad-contrib/XMonad/Prompt/Workspace.hs

51 lines
1.6 KiB
Haskell

-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Prompt.Workspace
-- Description : A workspace prompt.
-- Copyright : (C) 2007 Andrea Rossato, David Roundy
-- License : BSD3
--
-- Maintainer :
-- Stability : unstable
-- Portability : unportable
--
-- A workspace prompt for XMonad
--
-----------------------------------------------------------------------------
module XMonad.Prompt.Workspace (
-- * Usage
-- $usage
workspacePrompt,
-- * For developers
Wor(Wor),
) where
import XMonad hiding ( workspaces )
import XMonad.Prompt
import XMonad.StackSet ( workspaces, tag )
import XMonad.Util.WorkspaceCompare ( getSortByIndex )
-- $usage
-- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
--
-- > import XMonad.Prompt
-- > import XMonad.Prompt.Workspace
--
-- > , ((modm .|. shiftMask, xK_m ), workspacePrompt def (windows . W.shift))
--
-- For detailed instruction on editing the key binding see
-- "XMonad.Doc.Extending#Editing_key_bindings".
newtype Wor = Wor String
instance XPrompt Wor where
showXPrompt (Wor x) = x
workspacePrompt :: XPConfig -> (String -> X ()) -> X ()
workspacePrompt c job = do ws <- gets (workspaces . windowset)
sort <- getSortByIndex
let ts = map tag $ sort ws
mkXPrompt (Wor "") c (mkComplFunFromList' c ts) job