{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE PatternGuards #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE FlexibleContexts #-}
module XMonad.Hooks.StatusBar.PP (
PP(..), def,
dynamicLogString,
dynamicLogString',
dynamicLogWithPP,
WS(..), WSPP, WSPP', fallbackPrinters,
isUrgent, isCurrent, isVisible, isVisibleNoWindows, isHidden,
dzenPP, xmobarPP, sjanssenPP, byorgeyPP,
wrap, pad, trim, shorten, shorten', shortenLeft, shortenLeft',
xmobarColor, xmobarFont, xmobarAction, xmobarBorder,
xmobarRaw, xmobarStrip, xmobarStripTags,
dzenColor, dzenEscape, dzenStrip, filterOutWsPP,
pprWindowSet,
pprWindowSetXinerama
) where
import Control.Monad.Reader
import Control.DeepSeq
import qualified Data.List.NonEmpty as NE
import XMonad
import XMonad.Prelude
import qualified XMonad.StackSet as S
import XMonad.Util.NamedWindows
import XMonad.Util.WorkspaceCompare
import XMonad.Hooks.UrgencyHook
data PP = PP { PP -> String -> String
ppCurrent :: WorkspaceId -> String
, PP -> String -> String
ppVisible :: WorkspaceId -> String
, PP -> String -> String
ppHidden :: WorkspaceId -> String
, PP -> String -> String
ppHiddenNoWindows :: WorkspaceId -> String
, PP -> Maybe (String -> String)
ppVisibleNoWindows :: Maybe (WorkspaceId -> String)
, PP -> String -> String
ppUrgent :: WorkspaceId -> String
, PP -> String -> WindowSpace -> String
ppRename :: String -> WindowSpace -> String
, PP -> String
ppSep :: String
, PP -> String
ppWsSep :: String
, PP -> String -> String
ppTitle :: String -> String
, PP -> String -> String
ppTitleSanitize :: String -> String
, PP -> String -> String
ppLayout :: String -> String
, PP -> [String] -> [String]
ppOrder :: [String] -> [String]
, PP -> X ([WindowSpace] -> [WindowSpace])
ppSort :: X ([WindowSpace] -> [WindowSpace])
, :: [X (Maybe String)]
, PP -> String -> IO ()
ppOutput :: String -> IO ()
, PP -> WSPP
ppPrinters :: WSPP
}
instance Default PP where
def :: PP
def = PP { ppCurrent :: String -> String
ppCurrent = String -> String -> String -> String
wrap String
"[" String
"]"
, ppVisible :: String -> String
ppVisible = String -> String -> String -> String
wrap String
"<" String
">"
, ppHidden :: String -> String
ppHidden = String -> String
forall a. a -> a
id
, ppHiddenNoWindows :: String -> String
ppHiddenNoWindows = String -> String -> String
forall a b. a -> b -> a
const String
""
, ppVisibleNoWindows :: Maybe (String -> String)
ppVisibleNoWindows = Maybe (String -> String)
forall a. Maybe a
Nothing
, ppUrgent :: String -> String
ppUrgent = String -> String
forall a. a -> a
id
, ppRename :: String -> WindowSpace -> String
ppRename = String -> WindowSpace -> String
forall a. a -> WindowSpace -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure
, ppSep :: String
ppSep = String
" : "
, ppWsSep :: String
ppWsSep = String
" "
, ppTitle :: String -> String
ppTitle = Int -> String -> String
shorten Int
80
, ppTitleSanitize :: String -> String
ppTitleSanitize = String -> String
xmobarStrip (String -> String) -> (String -> String) -> String -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> String
dzenEscape
, ppLayout :: String -> String
ppLayout = String -> String
forall a. a -> a
id
, ppOrder :: [String] -> [String]
ppOrder = [String] -> [String]
forall a. a -> a
id
, ppOutput :: String -> IO ()
ppOutput = String -> IO ()
putStrLn
, ppSort :: X ([WindowSpace] -> [WindowSpace])
ppSort = X ([WindowSpace] -> [WindowSpace])
getSortByIndex
, ppExtras :: [X (Maybe String)]
ppExtras = []
, ppPrinters :: WSPP
ppPrinters = WSPP
forall a. ReaderT WS Maybe a
forall (f :: * -> *) a. Alternative f => f a
empty
}
dynamicLogWithPP :: PP -> X ()
dynamicLogWithPP :: PP -> X ()
dynamicLogWithPP PP
pp = PP -> X String
dynamicLogString PP
pp X String -> (String -> X ()) -> X ()
forall a b. X a -> (a -> X b) -> X b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= IO () -> X ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
io (IO () -> X ()) -> (String -> IO ()) -> String -> X ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PP -> String -> IO ()
ppOutput PP
pp
dynamicLogString :: PP -> X String
dynamicLogString :: PP -> X String
dynamicLogString PP
pp = String -> X String -> X String
forall a. a -> X a -> X a
userCodeDef String
"_|_" (PP -> X String
dynamicLogString' PP
pp)
dynamicLogString' :: PP -> X String
dynamicLogString' :: PP -> X String
dynamicLogString' PP
pp = do
WindowSet
winset <- (XState -> WindowSet) -> X WindowSet
forall s (m :: * -> *) a. MonadState s m => (s -> a) -> m a
gets XState -> WindowSet
windowset
[Window]
urgents <- X [Window]
readUrgents
[WindowSpace] -> [WindowSpace]
sort' <- PP -> X ([WindowSpace] -> [WindowSpace])
ppSort PP
pp
let ld :: String
ld = Layout Window -> String
forall (layout :: * -> *) a.
LayoutClass layout a =>
layout a -> String
description (Layout Window -> String)
-> (WindowSet -> Layout Window) -> WindowSet -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WindowSpace -> Layout Window
forall i l a. Workspace i l a -> l
S.layout (WindowSpace -> Layout Window)
-> (WindowSet -> WindowSpace) -> WindowSet -> Layout Window
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Screen String (Layout Window) Window ScreenId ScreenDetail
-> WindowSpace
forall i l a sid sd. Screen i l a sid sd -> Workspace i l a
S.workspace (Screen String (Layout Window) Window ScreenId ScreenDetail
-> WindowSpace)
-> (WindowSet
-> Screen String (Layout Window) Window ScreenId ScreenDetail)
-> WindowSet
-> WindowSpace
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WindowSet
-> Screen String (Layout Window) Window ScreenId ScreenDetail
forall i l a sid sd. StackSet i l a sid sd -> Screen i l a sid sd
S.current (WindowSet -> String) -> WindowSet -> String
forall a b. (a -> b) -> a -> b
$ WindowSet
winset
let ws :: String
ws = ([WindowSpace] -> [WindowSpace])
-> [Window] -> PP -> WindowSet -> String
pprWindowSet [WindowSpace] -> [WindowSpace]
sort' [Window]
urgents PP
pp WindowSet
winset
[Maybe String]
extras <- (X (Maybe String) -> X (Maybe String))
-> [X (Maybe String)] -> X [Maybe String]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM (Maybe String -> X (Maybe String) -> X (Maybe String)
forall a. a -> X a -> X a
userCodeDef Maybe String
forall a. Maybe a
Nothing) ([X (Maybe String)] -> X [Maybe String])
-> [X (Maybe String)] -> X [Maybe String]
forall a b. (a -> b) -> a -> b
$ PP -> [X (Maybe String)]
ppExtras PP
pp
String
wt <- X String -> (Window -> X String) -> Maybe Window -> X String
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (String -> X String
forall a. a -> X a
forall (f :: * -> *) a. Applicative f => a -> f a
pure String
"") ((NamedWindow -> String) -> X NamedWindow -> X String
forall a b. (a -> b) -> X a -> X b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap NamedWindow -> String
forall a. Show a => a -> String
show (X NamedWindow -> X String)
-> (Window -> X NamedWindow) -> Window -> X String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Window -> X NamedWindow
getName) (Maybe Window -> X String)
-> (WindowSet -> Maybe Window) -> WindowSet -> X String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WindowSet -> Maybe Window
forall i l a s sd. StackSet i l a s sd -> Maybe a
S.peek (WindowSet -> X String) -> WindowSet -> X String
forall a b. (a -> b) -> a -> b
$ WindowSet
winset
String -> X String
forall a. a -> X a
forall (m :: * -> *) a. Monad m => a -> m a
return (String -> X String) -> String -> X String
forall a b. (a -> b) -> a -> b
$! String -> String
forall a. NFData a => a -> a
force (String -> String) -> String -> String
forall a b. (a -> b) -> a -> b
$ String -> [String] -> String
sepBy (PP -> String
ppSep PP
pp) ([String] -> String)
-> ([String] -> [String]) -> [String] -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PP -> [String] -> [String]
ppOrder PP
pp ([String] -> String) -> [String] -> String
forall a b. (a -> b) -> a -> b
$
[ String
ws
, PP -> String -> String
ppLayout PP
pp String
ld
, PP -> String -> String
ppTitle PP
pp (String -> String) -> String -> String
forall a b. (a -> b) -> a -> b
$ PP -> String -> String
ppTitleSanitize PP
pp String
wt
]
[String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++ [Maybe String] -> [String]
forall a. [Maybe a] -> [a]
catMaybes [Maybe String]
extras
pprWindowSet :: WorkspaceSort -> [Window] -> PP -> WindowSet -> String
pprWindowSet :: ([WindowSpace] -> [WindowSpace])
-> [Window] -> PP -> WindowSet -> String
pprWindowSet [WindowSpace] -> [WindowSpace]
sort' [Window]
urgents PP
pp WindowSet
s = String -> [String] -> String
sepBy (PP -> String
ppWsSep PP
pp) ([String] -> String)
-> ([WindowSpace] -> [String]) -> [WindowSpace] -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (WindowSpace -> String) -> [WindowSpace] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map WindowSpace -> String
fmt ([WindowSpace] -> [String])
-> ([WindowSpace] -> [WindowSpace]) -> [WindowSpace] -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [WindowSpace] -> [WindowSpace]
sort' ([WindowSpace] -> String) -> [WindowSpace] -> String
forall a b. (a -> b) -> a -> b
$
(Screen String (Layout Window) Window ScreenId ScreenDetail
-> WindowSpace)
-> [Screen String (Layout Window) Window ScreenId ScreenDetail]
-> [WindowSpace]
forall a b. (a -> b) -> [a] -> [b]
map Screen String (Layout Window) Window ScreenId ScreenDetail
-> WindowSpace
forall i l a sid sd. Screen i l a sid sd -> Workspace i l a
S.workspace (WindowSet
-> Screen String (Layout Window) Window ScreenId ScreenDetail
forall i l a sid sd. StackSet i l a sid sd -> Screen i l a sid sd
S.current WindowSet
s Screen String (Layout Window) Window ScreenId ScreenDetail
-> [Screen String (Layout Window) Window ScreenId ScreenDetail]
-> [Screen String (Layout Window) Window ScreenId ScreenDetail]
forall a. a -> [a] -> [a]
: WindowSet
-> [Screen String (Layout Window) Window ScreenId ScreenDetail]
forall i l a sid sd. StackSet i l a sid sd -> [Screen i l a sid sd]
S.visible WindowSet
s) [WindowSpace] -> [WindowSpace] -> [WindowSpace]
forall a. [a] -> [a] -> [a]
++ WindowSet -> [WindowSpace]
forall i l a sid sd. StackSet i l a sid sd -> [Workspace i l a]
S.hidden WindowSet
s
where
fmt :: WindowSpace -> String
fmt :: WindowSpace -> String
fmt WindowSpace
w = String -> String
pr (PP -> String -> WindowSpace -> String
ppRename PP
pp (WindowSpace -> String
forall i l a. Workspace i l a -> i
S.tag WindowSpace
w) WindowSpace
w)
where
printers :: WSPP
printers = PP -> WSPP
ppPrinters PP
pp WSPP -> WSPP -> WSPP
forall a.
ReaderT WS Maybe a -> ReaderT WS Maybe a -> ReaderT WS Maybe a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> WSPP
fallbackPrinters
pr :: String -> String
pr = (String -> String) -> Maybe (String -> String) -> String -> String
forall a. a -> Maybe a -> a
fromMaybe String -> String
forall a. a -> a
id (Maybe (String -> String) -> String -> String)
-> Maybe (String -> String) -> String -> String
forall a b. (a -> b) -> a -> b
$ WSPP -> WS -> Maybe (String -> String)
forall r (m :: * -> *) a. ReaderT r m a -> r -> m a
runReaderT WSPP
printers (WS -> Maybe (String -> String)) -> WS -> Maybe (String -> String)
forall a b. (a -> b) -> a -> b
$
WS{ wsUrgents :: [Window]
wsUrgents = [Window]
urgents, wsWindowSet :: WindowSet
wsWindowSet = WindowSet
s, wsWS :: WindowSpace
wsWS = WindowSpace
w, wsPP :: PP
wsPP = PP
pp }
data WS = WS{ WS -> [Window]
wsUrgents :: [Window]
, WS -> WindowSet
wsWindowSet :: WindowSet
, WS -> WindowSpace
wsWS :: WindowSpace
, WS -> PP
wsPP :: PP
}
type WSPP' = ReaderT WS Maybe
type WSPP = WSPP' (WorkspaceId -> String)
fallbackPrinters :: WSPP
fallbackPrinters :: WSPP
fallbackPrinters = WS -> Bool
isUrgent (WS -> Bool) -> (PP -> String -> String) -> WSPP
forall {f :: * -> *} {b}.
(Alternative f, MonadReader WS f) =>
(WS -> Bool) -> (PP -> b) -> f b
?-> PP -> String -> String
ppUrgent
WSPP -> WSPP -> WSPP
forall a.
ReaderT WS Maybe a -> ReaderT WS Maybe a -> ReaderT WS Maybe a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> WS -> Bool
isCurrent' (WS -> Bool) -> (PP -> String -> String) -> WSPP
forall {f :: * -> *} {b}.
(Alternative f, MonadReader WS f) =>
(WS -> Bool) -> (PP -> b) -> f b
?-> PP -> String -> String
ppCurrent
WSPP -> WSPP -> WSPP
forall a.
ReaderT WS Maybe a -> ReaderT WS Maybe a -> ReaderT WS Maybe a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> WS -> Bool
isVisible' (WS -> Bool) -> (PP -> String -> String) -> WSPP
forall {f :: * -> *} {b}.
(Alternative f, MonadReader WS f) =>
(WS -> Bool) -> (PP -> b) -> f b
?-> PP -> String -> String
ppVisible
WSPP -> WSPP -> WSPP
forall a.
ReaderT WS Maybe a -> ReaderT WS Maybe a -> ReaderT WS Maybe a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> WS -> Bool
isVisibleNoWindows' (WS -> Bool) -> (PP -> String -> String) -> WSPP
forall {f :: * -> *} {b}.
(Alternative f, MonadReader WS f) =>
(WS -> Bool) -> (PP -> b) -> f b
?-> ((String -> String)
-> Maybe (String -> String) -> String -> String)
-> (PP -> String -> String)
-> (PP -> Maybe (String -> String))
-> PP
-> String
-> String
forall a b c. (a -> b -> c) -> (PP -> a) -> (PP -> b) -> PP -> c
forall (f :: * -> *) a b c.
Applicative f =>
(a -> b -> c) -> f a -> f b -> f c
liftA2 (String -> String) -> Maybe (String -> String) -> String -> String
forall a. a -> Maybe a -> a
fromMaybe PP -> String -> String
ppVisible PP -> Maybe (String -> String)
ppVisibleNoWindows
WSPP -> WSPP -> WSPP
forall a.
ReaderT WS Maybe a -> ReaderT WS Maybe a -> ReaderT WS Maybe a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> WS -> Bool
isHidden' (WS -> Bool) -> (PP -> String -> String) -> WSPP
forall {f :: * -> *} {b}.
(Alternative f, MonadReader WS f) =>
(WS -> Bool) -> (PP -> b) -> f b
?-> PP -> String -> String
ppHidden
WSPP -> WSPP -> WSPP
forall a.
ReaderT WS Maybe a -> ReaderT WS Maybe a -> ReaderT WS Maybe a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> Bool -> WS -> Bool
forall a. a -> WS -> a
forall (f :: * -> *) a. Applicative f => a -> f a
pure Bool
True (WS -> Bool) -> (PP -> String -> String) -> WSPP
forall {f :: * -> *} {b}.
(Alternative f, MonadReader WS f) =>
(WS -> Bool) -> (PP -> b) -> f b
?-> PP -> String -> String
ppHiddenNoWindows
where
WS -> Bool
cond ?-> :: (WS -> Bool) -> (PP -> b) -> f b
?-> PP -> b
ppr = ((WS -> Bool) -> f Bool
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks WS -> Bool
cond f Bool -> (Bool -> f ()) -> f ()
forall a b. f a -> (a -> f b) -> f b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Bool -> f ()
forall (f :: * -> *). Alternative f => Bool -> f ()
guard) f () -> f b -> f b
forall a b. f a -> f b -> f b
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f b
*> (WS -> b) -> f b
forall r (m :: * -> *) a. MonadReader r m => (r -> a) -> m a
asks (PP -> b
ppr (PP -> b) -> (WS -> PP) -> WS -> b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WS -> PP
wsPP)
isUrgent :: WS -> Bool
isUrgent :: WS -> Bool
isUrgent WS{[Window]
WindowSpace
WindowSet
PP
wsUrgents :: WS -> [Window]
wsWindowSet :: WS -> WindowSet
wsWS :: WS -> WindowSpace
wsPP :: WS -> PP
wsUrgents :: [Window]
wsWindowSet :: WindowSet
wsWS :: WindowSpace
wsPP :: PP
..} = (Window -> Bool) -> [Window] -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any (\Window
x -> (Maybe String -> Maybe String -> Bool
forall a. Eq a => a -> a -> Bool
== String -> Maybe String
forall a. a -> Maybe a
Just (WindowSpace -> String
forall i l a. Workspace i l a -> i
S.tag WindowSpace
wsWS)) (Window -> WindowSet -> Maybe String
forall a i l s sd. Eq a => a -> StackSet i l a s sd -> Maybe i
S.findTag Window
x WindowSet
wsWindowSet)) [Window]
wsUrgents
isCurrent' :: WS -> Bool
isCurrent' :: WS -> Bool
isCurrent' WS{[Window]
WindowSpace
WindowSet
PP
wsUrgents :: WS -> [Window]
wsWindowSet :: WS -> WindowSet
wsWS :: WS -> WindowSpace
wsPP :: WS -> PP
wsUrgents :: [Window]
wsWindowSet :: WindowSet
wsWS :: WindowSpace
wsPP :: PP
..} = WindowSpace -> String
forall i l a. Workspace i l a -> i
S.tag WindowSpace
wsWS String -> String -> Bool
forall a. Eq a => a -> a -> Bool
== WindowSet -> String
forall i l a s sd. StackSet i l a s sd -> i
S.currentTag WindowSet
wsWindowSet
isCurrent :: WS -> Bool
isCurrent :: WS -> Bool
isCurrent = (Bool -> Bool
not (Bool -> Bool) -> (WS -> Bool) -> WS -> Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> WS -> Bool
isUrgent) (WS -> Bool) -> (WS -> Bool) -> WS -> Bool
forall (m :: * -> *). Monad m => m Bool -> m Bool -> m Bool
<&&> WS -> Bool
isCurrent'
isVisible' :: WS -> Bool
isVisible' :: WS -> Bool
isVisible' = WS -> Bool
isVisibleNoWindows' (WS -> Bool) -> (WS -> Bool) -> WS -> Bool
forall (m :: * -> *). Monad m => m Bool -> m Bool -> m Bool
<&&> Maybe (Stack Window) -> Bool
forall a. Maybe a -> Bool
isJust (Maybe (Stack Window) -> Bool)
-> (WS -> Maybe (Stack Window)) -> WS -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WindowSpace -> Maybe (Stack Window)
forall i l a. Workspace i l a -> Maybe (Stack a)
S.stack (WindowSpace -> Maybe (Stack Window))
-> (WS -> WindowSpace) -> WS -> Maybe (Stack Window)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WS -> WindowSpace
wsWS
isVisible :: WS -> Bool
isVisible :: WS -> Bool
isVisible = (Bool -> Bool
not (Bool -> Bool) -> (WS -> Bool) -> WS -> Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> WS -> Bool
isUrgent) (WS -> Bool) -> (WS -> Bool) -> WS -> Bool
forall (m :: * -> *). Monad m => m Bool -> m Bool -> m Bool
<&&> (Bool -> Bool
not (Bool -> Bool) -> (WS -> Bool) -> WS -> Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> WS -> Bool
isCurrent') (WS -> Bool) -> (WS -> Bool) -> WS -> Bool
forall (m :: * -> *). Monad m => m Bool -> m Bool -> m Bool
<&&> WS -> Bool
isVisible'
isVisibleNoWindows' :: WS -> Bool
isVisibleNoWindows' :: WS -> Bool
isVisibleNoWindows' WS{[Window]
WindowSpace
WindowSet
PP
wsUrgents :: WS -> [Window]
wsWindowSet :: WS -> WindowSet
wsWS :: WS -> WindowSpace
wsPP :: WS -> PP
wsUrgents :: [Window]
wsWindowSet :: WindowSet
wsWS :: WindowSpace
wsPP :: PP
..} = WindowSpace -> String
forall i l a. Workspace i l a -> i
S.tag WindowSpace
wsWS String -> [String] -> Bool
forall a. Eq a => a -> [a] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` [String]
visibles
where visibles :: [String]
visibles = (Screen String (Layout Window) Window ScreenId ScreenDetail
-> String)
-> [Screen String (Layout Window) Window ScreenId ScreenDetail]
-> [String]
forall a b. (a -> b) -> [a] -> [b]
map (WindowSpace -> String
forall i l a. Workspace i l a -> i
S.tag (WindowSpace -> String)
-> (Screen String (Layout Window) Window ScreenId ScreenDetail
-> WindowSpace)
-> Screen String (Layout Window) Window ScreenId ScreenDetail
-> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Screen String (Layout Window) Window ScreenId ScreenDetail
-> WindowSpace
forall i l a sid sd. Screen i l a sid sd -> Workspace i l a
S.workspace) (WindowSet
-> [Screen String (Layout Window) Window ScreenId ScreenDetail]
forall i l a sid sd. StackSet i l a sid sd -> [Screen i l a sid sd]
S.visible WindowSet
wsWindowSet)
isVisibleNoWindows :: WS -> Bool
isVisibleNoWindows :: WS -> Bool
isVisibleNoWindows =
(Bool -> Bool
not (Bool -> Bool) -> (WS -> Bool) -> WS -> Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> WS -> Bool
isUrgent)
(WS -> Bool) -> (WS -> Bool) -> WS -> Bool
forall (m :: * -> *). Monad m => m Bool -> m Bool -> m Bool
<&&> (Bool -> Bool
not (Bool -> Bool) -> (WS -> Bool) -> WS -> Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> WS -> Bool
isCurrent')
(WS -> Bool) -> (WS -> Bool) -> WS -> Bool
forall (m :: * -> *). Monad m => m Bool -> m Bool -> m Bool
<&&> (Bool -> Bool
not (Bool -> Bool) -> (WS -> Bool) -> WS -> Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> WS -> Bool
isVisible')
(WS -> Bool) -> (WS -> Bool) -> WS -> Bool
forall (m :: * -> *). Monad m => m Bool -> m Bool -> m Bool
<&&> WS -> Bool
isVisibleNoWindows'
isHidden' :: WS -> Bool
isHidden' :: WS -> Bool
isHidden' = Maybe (Stack Window) -> Bool
forall a. Maybe a -> Bool
isJust (Maybe (Stack Window) -> Bool)
-> (WS -> Maybe (Stack Window)) -> WS -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WindowSpace -> Maybe (Stack Window)
forall i l a. Workspace i l a -> Maybe (Stack a)
S.stack (WindowSpace -> Maybe (Stack Window))
-> (WS -> WindowSpace) -> WS -> Maybe (Stack Window)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WS -> WindowSpace
wsWS
isHidden :: WS -> Bool
isHidden :: WS -> Bool
isHidden =
(Bool -> Bool
not (Bool -> Bool) -> (WS -> Bool) -> WS -> Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> WS -> Bool
isUrgent)
(WS -> Bool) -> (WS -> Bool) -> WS -> Bool
forall (m :: * -> *). Monad m => m Bool -> m Bool -> m Bool
<&&> (Bool -> Bool
not (Bool -> Bool) -> (WS -> Bool) -> WS -> Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> WS -> Bool
isCurrent')
(WS -> Bool) -> (WS -> Bool) -> WS -> Bool
forall (m :: * -> *). Monad m => m Bool -> m Bool -> m Bool
<&&> (Bool -> Bool
not (Bool -> Bool) -> (WS -> Bool) -> WS -> Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> WS -> Bool
isVisible')
(WS -> Bool) -> (WS -> Bool) -> WS -> Bool
forall (m :: * -> *). Monad m => m Bool -> m Bool -> m Bool
<&&> (Bool -> Bool
not (Bool -> Bool) -> (WS -> Bool) -> WS -> Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> WS -> Bool
isVisibleNoWindows')
(WS -> Bool) -> (WS -> Bool) -> WS -> Bool
forall (m :: * -> *). Monad m => m Bool -> m Bool -> m Bool
<&&> WS -> Bool
isHidden'
pprWindowSetXinerama :: WindowSet -> String
pprWindowSetXinerama :: WindowSet -> String
pprWindowSetXinerama WindowSet
ws = String
"[" String -> String -> String
forall a. [a] -> [a] -> [a]
++ [String] -> String
unwords [String]
onscreen String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"] " String -> String -> String
forall a. [a] -> [a] -> [a]
++ [String] -> String
unwords [String]
offscreen
where onscreen :: [String]
onscreen = (Screen String (Layout Window) Window ScreenId ScreenDetail
-> String)
-> [Screen String (Layout Window) Window ScreenId ScreenDetail]
-> [String]
forall a b. (a -> b) -> [a] -> [b]
map (WindowSpace -> String
forall i l a. Workspace i l a -> i
S.tag (WindowSpace -> String)
-> (Screen String (Layout Window) Window ScreenId ScreenDetail
-> WindowSpace)
-> Screen String (Layout Window) Window ScreenId ScreenDetail
-> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Screen String (Layout Window) Window ScreenId ScreenDetail
-> WindowSpace
forall i l a sid sd. Screen i l a sid sd -> Workspace i l a
S.workspace)
([Screen String (Layout Window) Window ScreenId ScreenDetail]
-> [String])
-> ([Screen String (Layout Window) Window ScreenId ScreenDetail]
-> [Screen String (Layout Window) Window ScreenId ScreenDetail])
-> [Screen String (Layout Window) Window ScreenId ScreenDetail]
-> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Screen String (Layout Window) Window ScreenId ScreenDetail
-> ScreenId)
-> [Screen String (Layout Window) Window ScreenId ScreenDetail]
-> [Screen String (Layout Window) Window ScreenId ScreenDetail]
forall b a. Ord b => (a -> b) -> [a] -> [a]
sortOn Screen String (Layout Window) Window ScreenId ScreenDetail
-> ScreenId
forall i l a sid sd. Screen i l a sid sd -> sid
S.screen ([Screen String (Layout Window) Window ScreenId ScreenDetail]
-> [String])
-> [Screen String (Layout Window) Window ScreenId ScreenDetail]
-> [String]
forall a b. (a -> b) -> a -> b
$ WindowSet
-> Screen String (Layout Window) Window ScreenId ScreenDetail
forall i l a sid sd. StackSet i l a sid sd -> Screen i l a sid sd
S.current WindowSet
ws Screen String (Layout Window) Window ScreenId ScreenDetail
-> [Screen String (Layout Window) Window ScreenId ScreenDetail]
-> [Screen String (Layout Window) Window ScreenId ScreenDetail]
forall a. a -> [a] -> [a]
: WindowSet
-> [Screen String (Layout Window) Window ScreenId ScreenDetail]
forall i l a sid sd. StackSet i l a sid sd -> [Screen i l a sid sd]
S.visible WindowSet
ws
offscreen :: [String]
offscreen = (WindowSpace -> String) -> [WindowSpace] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map WindowSpace -> String
forall i l a. Workspace i l a -> i
S.tag ([WindowSpace] -> [String])
-> ([WindowSpace] -> [WindowSpace]) -> [WindowSpace] -> [String]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (WindowSpace -> Bool) -> [WindowSpace] -> [WindowSpace]
forall a. (a -> Bool) -> [a] -> [a]
filter (Maybe (Stack Window) -> Bool
forall a. Maybe a -> Bool
isJust (Maybe (Stack Window) -> Bool)
-> (WindowSpace -> Maybe (Stack Window)) -> WindowSpace -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WindowSpace -> Maybe (Stack Window)
forall i l a. Workspace i l a -> Maybe (Stack a)
S.stack)
([WindowSpace] -> [WindowSpace])
-> ([WindowSpace] -> [WindowSpace])
-> [WindowSpace]
-> [WindowSpace]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (WindowSpace -> String) -> [WindowSpace] -> [WindowSpace]
forall b a. Ord b => (a -> b) -> [a] -> [a]
sortOn WindowSpace -> String
forall i l a. Workspace i l a -> i
S.tag ([WindowSpace] -> [String]) -> [WindowSpace] -> [String]
forall a b. (a -> b) -> a -> b
$ WindowSet -> [WindowSpace]
forall i l a sid sd. StackSet i l a sid sd -> [Workspace i l a]
S.hidden WindowSet
ws
wrap :: String
-> String
-> String
-> String
wrap :: String -> String -> String -> String
wrap String
_ String
_ String
"" = String
""
wrap String
l String
r String
m = String
l String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
m String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
r
pad :: String -> String
pad :: String -> String
pad = String -> String -> String -> String
wrap String
" " String
" "
trim :: String -> String
trim :: String -> String
trim = String -> String
f (String -> String) -> (String -> String) -> String -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> String
f
where f :: String -> String
f = String -> String
forall a. [a] -> [a]
reverse (String -> String) -> (String -> String) -> String -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Bool) -> String -> String
forall a. (a -> Bool) -> [a] -> [a]
dropWhile Char -> Bool
isSpace
shorten :: Int -> String -> String
shorten :: Int -> String -> String
shorten = String -> Int -> String -> String
shorten' String
"..."
shorten' :: String -> Int -> String -> String
shorten' :: String -> Int -> String -> String
shorten' String
end Int
n String
xs | String -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length String
xs Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< Int
n = String
xs
| Bool
otherwise = Int -> String -> String
forall a. Int -> [a] -> [a]
take (Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
- String -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length String
end) String
xs String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
end
shortenLeft :: Int -> String -> String
shortenLeft :: Int -> String -> String
shortenLeft = String -> Int -> String -> String
shortenLeft' String
"..."
shortenLeft' :: String -> Int -> String -> String
shortenLeft' :: String -> Int -> String -> String
shortenLeft' String
end Int
n String
xs | Int
l Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
< Int
n = String
xs
| Bool
otherwise = String
end String -> String -> String
forall a. [a] -> [a] -> [a]
++ Int -> String -> String
forall a. Int -> [a] -> [a]
drop (Int
l Int -> Int -> Int
forall a. Num a => a -> a -> a
- Int
n Int -> Int -> Int
forall a. Num a => a -> a -> a
+ String -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length String
end) String
xs
where l :: Int
l = String -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length String
xs
sepBy :: String
-> [String]
-> String
sepBy :: String -> [String] -> String
sepBy String
sep = String -> [String] -> String
forall a. [a] -> [[a]] -> [a]
intercalate String
sep ([String] -> String)
-> ([String] -> [String]) -> [String] -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (String -> Bool) -> [String] -> [String]
forall a. (a -> Bool) -> [a] -> [a]
filter (Bool -> Bool
not (Bool -> Bool) -> (String -> Bool) -> String -> Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null)
dzenColor :: String
-> String
-> String
-> String
dzenColor :: String -> String -> String -> String
dzenColor String
fg String
bg = String -> String -> String -> String
wrap (String
fg1String -> String -> String
forall a. [a] -> [a] -> [a]
++String
bg1) (String
fg2String -> String -> String
forall a. [a] -> [a] -> [a]
++String
bg2)
where (String
fg1,String
fg2) | String -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null String
fg = (String
"",String
"")
| Bool
otherwise = (String
"^fg(" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
fg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")",String
"^fg()")
(String
bg1,String
bg2) | String -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null String
bg = (String
"",String
"")
| Bool
otherwise = (String
"^bg(" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
bg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")",String
"^bg()")
dzenEscape :: String -> String
dzenEscape :: String -> String
dzenEscape = (Char -> String) -> String -> String
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap (\Char
x -> if Char
x Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== Char
'^' then String
"^^" else [Char
x])
dzenStrip :: String -> String
dzenStrip :: String -> String
dzenStrip = String -> String -> String
strip [] where
strip :: String -> String -> String
strip String
keep String
x
| String -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null String
x = String
keep
| String
"^^" String -> String -> Bool
forall a. Eq a => [a] -> [a] -> Bool
`isPrefixOf` String
x = String -> String -> String
strip (String
keep String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"^") (Int -> String -> String
forall a. Int -> [a] -> [a]
drop Int
2 String
x)
| String
"^" String -> String -> Bool
forall a. Eq a => [a] -> [a] -> Bool
`isPrefixOf` String
x = String -> String -> String
strip String
keep (Int -> String -> String
forall a. Int -> [a] -> [a]
drop Int
1 (String -> String) -> (String -> String) -> String -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Bool) -> String -> String
forall a. (a -> Bool) -> [a] -> [a]
dropWhile (Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
/= Char
')') (String -> String) -> String -> String
forall a b. (a -> b) -> a -> b
$ String
x)
| Bool
otherwise = let (String
good,String
x') = (Char -> Bool) -> String -> (String, String)
forall a. (a -> Bool) -> [a] -> ([a], [a])
span (Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
/= Char
'^') String
x
in String -> String -> String
strip (String
keep String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
good) String
x'
xmobarFont :: Int
-> String
-> String
xmobarFont :: Int -> String -> String
xmobarFont Int
index = String -> String -> String -> String
wrap (String
"<fn=" String -> String -> String
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
index String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
">") String
"</fn>"
xmobarColor :: String
-> String
-> String
-> String
xmobarColor :: String -> String -> String -> String
xmobarColor String
fg String
bg = String -> String -> String -> String
wrap String
t String
"</fc>"
where t :: String
t = [String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [String
"<fc=", String
fg, if String -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null String
bg then String
"" else String
"," String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
bg, String
">"]
xmobarAction :: String
-> String
-> String
-> String
xmobarAction :: String -> String -> String -> String
xmobarAction String
command String
button = String -> String -> String -> String
wrap String
l String
r
where
l :: String
l = String
"<action=`" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
command String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"` button=" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
button String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
">"
r :: String
r = String
"</action>"
xmobarBorder :: String
-> String
-> Int
-> String
-> String
xmobarBorder :: String -> String -> Int -> String -> String
xmobarBorder String
border String
color Int
width = String -> String -> String -> String
wrap String
prefix String
"</box>"
where
prefix :: String
prefix = String
"<box type=" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
border String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" width=" String -> String -> String
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
width String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" color="
String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
color String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
">"
xmobarRaw :: String -> String
xmobarRaw :: String -> String
xmobarRaw String
"" = String
""
xmobarRaw String
s = [String] -> String
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
concat [String
"<raw=", Int -> String
forall a. Show a => a -> String
show (Int -> String) -> Int -> String
forall a b. (a -> b) -> a -> b
$ String -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length String
s, String
":", String
s, String
"/>"]
xmobarStrip :: String -> String
xmobarStrip :: String -> String
xmobarStrip = (String -> String) -> String -> String
forall a. Eq a => (a -> a) -> a -> a
converge ([String] -> String -> String
xmobarStripTags [String
"fc",String
"icon",String
"action"])
converge :: (Eq a) => (a -> a) -> a -> a
converge :: forall a. Eq a => (a -> a) -> a -> a
converge a -> a
f a
a
= (a, a) -> a
forall a b. (a, b) -> a
fst ((a, a) -> a) -> ([a] -> (a, a)) -> [a] -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmpty (a, a) -> (a, a)
forall a. NonEmpty a -> a
NE.head (NonEmpty (a, a) -> (a, a))
-> ([a] -> NonEmpty (a, a)) -> [a] -> (a, a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [(a, a)] -> NonEmpty (a, a)
forall a. HasCallStack => [a] -> NonEmpty a
notEmpty
([(a, a)] -> NonEmpty (a, a))
-> ([a] -> [(a, a)]) -> [a] -> NonEmpty (a, a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. ((a, a) -> Bool) -> [(a, a)] -> [(a, a)]
forall a. (a -> Bool) -> [a] -> [a]
dropWhile ((a -> a -> Bool) -> (a, a) -> Bool
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry a -> a -> Bool
forall a. Eq a => a -> a -> Bool
(/=))
([(a, a)] -> [(a, a)]) -> ([a] -> [(a, a)]) -> [a] -> [(a, a)]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [a] -> [a] -> [(a, a)]
forall a b. [a] -> [b] -> [(a, b)]
zip [a]
xs
([a] -> a) -> [a] -> a
forall a b. (a -> b) -> a -> b
$ Int -> [a] -> [a]
forall a. Int -> [a] -> [a]
drop Int
1 [a]
xs
where xs :: [a]
xs = (a -> a) -> a -> [a]
forall a. (a -> a) -> a -> [a]
iterate a -> a
f a
a
xmobarStripTags :: [String]
-> String -> String
xmobarStripTags :: [String] -> String -> String
xmobarStripTags [String]
tags = String -> String -> String
strip [] where
strip :: String -> String -> String
strip String
keep [] = String
keep
strip String
keep String
x
| String
rest: [String]
_ <- (String -> Maybe String) -> [String] -> [String]
forall a b. (a -> Maybe b) -> [a] -> [b]
mapMaybe String -> Maybe String
dropTag [String]
tags = String -> String -> String
strip String
keep String
rest
| Char
'<':String
xs <- String
x = String -> String -> String
strip (String
keep String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"<") String
xs
| (String
good,String
x') <- (Char -> Bool) -> String -> (String, String)
forall a. (a -> Bool) -> [a] -> ([a], [a])
span (Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
/= Char
'<') String
x = String -> String -> String
strip (String
keep String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
good) String
x'
where dropTag :: String -> Maybe String
dropTag :: String -> Maybe String
dropTag String
tag = [Maybe String] -> Maybe String
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, MonadPlus m) =>
t (m a) -> m a
msum [(String -> String) -> Maybe String -> Maybe String
forall a b. (a -> b) -> Maybe a -> Maybe b
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap String -> String
dropTilClose (String -> String
openTag String
tag String -> String -> Maybe String
forall a. Eq a => [a] -> [a] -> Maybe [a]
`stripPrefix` String
x),
String -> String
closeTag String
tag String -> String -> Maybe String
forall a. Eq a => [a] -> [a] -> Maybe [a]
`stripPrefix` String
x]
dropTilClose, openTag, closeTag :: String -> String
dropTilClose :: String -> String
dropTilClose = Int -> String -> String
forall a. Int -> [a] -> [a]
drop Int
1 (String -> String) -> (String -> String) -> String -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Char -> Bool) -> String -> String
forall a. (a -> Bool) -> [a] -> [a]
dropWhile (Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
/= Char
'>')
openTag :: String -> String
openTag String
str = String
"<" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
str String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"="
closeTag :: String -> String
closeTag String
str = String
"</" String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
str String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
">"
filterOutWsPP :: [WorkspaceId] -> PP -> PP
filterOutWsPP :: [String] -> PP -> PP
filterOutWsPP [String]
ws PP
pp = PP
pp { ppSort = (. filterOutWs ws) <$> ppSort pp }
dzenPP :: PP
dzenPP :: PP
dzenPP = PP
forall a. Default a => a
def
{ ppCurrent = dzenColor "white" "#2b4f98" . pad
, ppVisible = dzenColor "black" "#999999" . pad
, ppHidden = dzenColor "black" "#cccccc" . pad
, ppHiddenNoWindows = const ""
, ppUrgent = dzenColor "red" "yellow" . pad
, ppWsSep = ""
, ppSep = ""
, ppLayout = dzenColor "black" "#cccccc"
. (\String
x -> String -> String
pad (String -> String) -> String -> String
forall a b. (a -> b) -> a -> b
$ case String
x of
String
"TilePrime Horizontal" -> String
"TTT"
String
"TilePrime Vertical" -> String
"[]="
String
"Hinted Full" -> String
"[ ]"
String
_ -> String
x
)
, ppTitle = ("^bg(#324c80) " ++) . dzenEscape
}
xmobarPP :: PP
xmobarPP :: PP
xmobarPP = PP
forall a. Default a => a
def { ppCurrent = xmobarColor "yellow" "" . wrap "[" "]"
, ppTitle = xmobarColor "green" "" . shorten 40
, ppVisible = wrap "(" ")"
, ppUrgent = xmobarColor "red" "yellow"
}
sjanssenPP :: PP
sjanssenPP :: PP
sjanssenPP = PP
forall a. Default a => a
def { ppCurrent = xmobarColor "white" "black"
, ppTitle = xmobarColor "#00ee00" "" . shorten 120
}
byorgeyPP :: PP
byorgeyPP :: PP
byorgeyPP = PP
forall a. Default a => a
def { ppHiddenNoWindows = showNamedWorkspaces
, ppHidden = dzenColor "black" "#a8a3f7" . pad
, ppCurrent = dzenColor "yellow" "#a8a3f7" . pad
, ppUrgent = dzenColor "red" "yellow" . pad
, ppSep = " | "
, ppWsSep = ""
, ppTitle = shorten 70
, ppOrder = reverse
}
where
showNamedWorkspaces :: String -> String
showNamedWorkspaces String
wsId =
if (Char -> Bool) -> String -> Bool
forall (t :: * -> *) a. Foldable t => (a -> Bool) -> t a -> Bool
any (Char -> String -> Bool
forall a. Eq a => a -> [a] -> Bool
forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
`elem` String
wsId) [Char
'a' .. Char
'z'] then String -> String
pad String
wsId else String
""