<commit_before>-----------------------------------------------------------------------------
-- |
-- Module      :  XMonad.Prompt.Workspace
-- Copyright   :  (C) 2007 <NAME>, <NAME>
-- License     :  BSD3
-- 
-- Maintainer  :  <EMAIL>
-- Stability   :  unstable
-- Portability :  unportable
--
-- A workspace prompt for XMonad
--
-----------------------------------------------------------------------------

module XMonad.Prompt.Workspace (
                             -- * Usage
                             -- $usage
                             workspacePrompt
                              ) where

import Control.Monad.State ( gets )
import Data.List ( sort )
import XMonad hiding ( workspaces )
import XMonad.Prompt
import XMonad.StackSet ( workspaces, tag )

-- $usage
-- You can use this module with the following in your Config.hs file:
-- 
-- > import XMonad.Prompt.WorkspacePrompt
--
-- >   , ((modMask .|. shiftMask, xK_m     ), workspacePrompt myXPConfig (windows . W.shift))

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)
                           let ts = sort $ map tag ws
                           mkXPrompt (Wor "") c (mkCompl ts) job

mkCompl :: [String] -> String -> IO [String]
mkCompl l s = return $ filter (\x -> take (length s) x == s) l<commit_msg>Prompt/Workspace.hs: suggest using defaultXPConfig in usage doc.<commit_after>-----------------------------------------------------------------------------
-- |
-- Module      :  XMonad.Prompt.Workspace
-- Copyright   :  (C) 2007 <NAME>, <NAME>
-- License     :  BSD3
-- 
-- Maintainer  :  <EMAIL>
-- Stability   :  unstable
-- Portability :  unportable
--
-- A workspace prompt for XMonad
--
-----------------------------------------------------------------------------

module XMonad.Prompt.Workspace (
                             -- * Usage
                             -- $usage
                             workspacePrompt
                              ) where

import Control.Monad.State ( gets )
import Data.List ( sort )
import XMonad hiding ( workspaces )
import XMonad.Prompt
import XMonad.StackSet ( workspaces, tag )

-- $usage
-- You can use this module with the following in your Config.hs file:
-- 
-- > import XMonad.Prompt
-- > import XMonad.Prompt.Workspace
--
-- >   , ((modMask .|. shiftMask, xK_m     ), workspacePrompt defaultXPConfig (windows . W.shift))

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)
                           let ts = sort $ map tag ws
                           mkXPrompt (Wor "") c (mkCompl ts) job

mkCompl :: [String] -> String -> IO [String]
mkCompl l s = return $ filter (\x -> take (length s) x == s) l
{'fraction_non_alphanumeric': 0.2119972733469666, 'fraction_numerical': 0.0034083162917518746, 'mean_word_length': 1.3726758286176233, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5493656', 'n_tokens_mistral': 838, 'n_tokens_neox': 809, 'n_words': 245}