mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 03:20:21 -07:00
Prompts based on `mkComplFunList` and `mkComplFunList'` were not taking into account the `searchPredicate` funtion from `XPConfig`. This was rather confusing. We fix it by passing `XPConfig` to these functions; although this is strictly more than they need, it makes the breaking change very easy to fix and is also more future-proof.
50 lines
1.5 KiB
Haskell
50 lines
1.5 KiB
Haskell
-----------------------------------------------------------------------------
|
|
-- |
|
|
-- Module : XMonad.Prompt.Workspace
|
|
-- 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".
|
|
|
|
data 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
|