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