Show windows in status bar?

What I like about dwm is that it shows me the title of the currently focussed window in the status bar. Has anyone done this for xmonad? Furthermore, it would be cool to get some indication of other windows on the current workspace: One could display a list of titles and highlight the currently focussed window. The difficult part is that the list of titles is likely long, so one would have to shorten it somehow. List of titles: Emacs / xterm 1 / [xterm 2] / Gaim / xload Here, xterm 2 would be the current window. Shortening the list of titles: - Truncate title of current window to 20 (configurable) - Truncate titles of other windows to 10 each (configurable) - Only print windows around the currently focussed one. - Use ellipsis to show truncations ... / xt... / [xter...] / Ga... / ... ^^^ ^^^^^ ^^^^^^^ ^^^^^ ^^^ | | | | Windows omitted from rear | | | | Truncated titles of nonactive windows | Windows omitted from front | Truncated title of active window Thoughts? Opinions? Kai

kai.grossjohann:
What I like about dwm is that it shows me the title of the currently focussed window in the status bar. Has anyone done this for xmonad?
Should be very easy now with the logHook system. Use XMonadContrib.NamedWindows. Find the focused window on each workspace (using peek), and find its name with show =<< getName
Furthermore, it would be cool to get some indication of other windows on the current workspace: One could display a list of titles and highlight the currently focussed window. The difficult part is that the list of titles is likely long, so one would have to shorten it somehow.
List of titles:
Emacs / xterm 1 / [xterm 2] / Gaim / xload
Here, xterm 2 would be the current window.
Shortening the list of titles:
- Truncate title of current window to 20 (configurable) - Truncate titles of other windows to 10 each (configurable) - Only print windows around the currently focussed one. - Use ellipsis to show truncations
... / xt... / [xter...] / Ga... / ... ^^^ ^^^^^ ^^^^^^^ ^^^^^ ^^^ | | | | Windows omitted from rear | | | | Truncated titles of nonactive windows | Windows omitted from front
| Truncated title of active window
Thoughts? Opinions?
Nicely thoughout idea. I think this would make a very nice contrib module. To get an idea of how to write log hooks, look at DynamicLog.hs -- Don

On Mon, Jun 11, 2007 at 11:45:49 +0200, Kai Grossjohann wrote:
What I like about dwm is that it shows me the title of the currently focussed window in the status bar. Has anyone done this for xmonad?
Furthermore, it would be cool to get some indication of other windows on the current workspace: One could display a list of titles and highlight the currently focussed window. The difficult part is that the list of titles is likely long, so one would have to shorten it somehow.
List of titles:
Emacs / xterm 1 / [xterm 2] / Gaim / xload
Here, xterm 2 would be the current window.
Shortening the list of titles:
- Truncate title of current window to 20 (configurable) - Truncate titles of other windows to 10 each (configurable) - Only print windows around the currently focussed one. - Use ellipsis to show truncations
... / xt... / [xter...] / Ga... / ... ^^^ ^^^^^ ^^^^^^^ ^^^^^ ^^^ | | | | Windows omitted from rear | | | | Truncated titles of nonactive windows | Windows omitted from front
| Truncated title of active window
It's supposed to be easy to gather the window name from the state dump since there's the window id in it, and then use xprop or xwininfo to get the name. Your proposition sounds fine, but even if truncating most names, I fear it would be too much for the available space (seeing mine, I currently have slightly more than the workspace information width still available). Plus on many windows, the interesting bit is at the end (e.g. "Konqueror - Website title"). So if you still go ahead with your idea (and I hope you will), please ensure that it works well with 0 friends on each side (and then without ellipsis). Thanks, /Alexandre -- Hi, I'm a .signature virus! Please copy me in your ~/.signature.

buisse:
On Mon, Jun 11, 2007 at 11:45:49 +0200, Kai Grossjohann wrote:
What I like about dwm is that it shows me the title of the currently focussed window in the status bar. Has anyone done this for xmonad?
Furthermore, it would be cool to get some indication of other windows on the current workspace: One could display a list of titles and highlight the currently focussed window. The difficult part is that the list of titles is likely long, so one would have to shorten it somehow.
List of titles:
Emacs / xterm 1 / [xterm 2] / Gaim / xload
Here's a quick example to get you going. It's a variant of the existing DynamicLog idea, 1 [2] 3 7 And also prints the title of the focused window on the current workspace, 1 [2 urxvt] 3 7 Screenshot, http://www.cse.unsw.edu.au/~dons//tmp/dzen-fetchname.png Here's the code, the first block is the interesting part: logHook = withWindowSet $ \s -> do -- here's the S.peek/fetchName ws <- gets windowset n <- case S.peek ws of Nothing -> return "" Just w -> do d <- asks display maybe "-" id `fmap` io (fetchName d w) io . putStrLn . (ppr n) $ s -- and the rest is pretty much unchanged from DynamicLog.hs where ppr n s = concatMap fmt $ sortBy tags (map S.workspace (S.current s : S.visible s) ++ S.hidden s) where tags a b = S.tag a `compare` S.tag b this = S.tag (S.workspace (S.current s)) pprTag = show . (+(1::Int)) . fromIntegral . S.tag visibles = map (S.tag . S.workspace) (S.visible s) fmt w | S.tag w == this = "[" ++ pprTag w ++ " " ++ n ++ "]" | S.tag w `elem` visibles = "<" ++ pprTag w ++ ">" | S.stack w /= S.Empty = " " ++ pprTag w ++ " " | otherwise = "" -- Don
participants (3)
-
Alexandre Buisse
-
dons@cse.unsw.edu.au
-
Kai Grossjohann