سؤال

The problem I'm trying to solve is that I have a bad habit of setting a workspace to full layout and then forgetting I have other windows open.

The solution I'd like to use is to continue displaying the main window's title as white on black via ppTitle, but also show my other windows in gray (and probably trimmed a bit, but that's beside the point). I was hoping for ppTitleUnfocused or something, but as far as I can tell ppTitle is the only title formatting option.

Is there a way to do what I want out of the box? If not, how can I extend dynamicLog? If that's non-trivial, what about appending a magic character to ppTitle and replacing it during ppOutput? (I think I can handle append and replace, but generating the replacement text is beyond my haskell ability.)

هل كانت مفيدة؟

المحلول

You could try adding this Logger in ppExtras:

import qualified XMonad.StackSet as W
import XMonad.Util.NamedWindows ( getName )
import Data.Traversable ( traverse )
import Data.Maybe ( maybeToList )
import Data.List ( (\\) )

logTitles :: X (Maybe String) -- this is a Logger
logTitles = withWindowSet $ fmap (Just . unwords) -- fuse window names
                          . traverse (fmap show . getName) -- show window names
                          . (\ws -> W.index ws \\ maybeToList (W.peek ws))
                          -- all windows except the focused (may be slow)

You can add this to your PP like so:

{
...
ppExtras = [logTitels]
ppOrder  = \(ws:l:t:ts:_) -> ws : l : t : [xmobarColor "gray" "" ts]
-- Use dzenColor if you use dzen and not xmobar
-- ts is the string of the unfocused window titles (seperated by spaces)
...
}
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top