Show name of focused window in status bar

Do people think that showing the name of the currently focused window in the status bar (in addition to the workspaces) would be a worthwhile addition? If so, could you advise how to improve the quality of the code I've concocted? Given that I don't know Haskell, I'm happy that it runs. Here's what I did. To NamedWindows.hs I added the following function (and exported it): unWindow :: NamedWindow -> String unWindow (NW n _) = n In Config.hs I wrote: dynamicLogWName :: X () dynamicLogWName = do withWindowSet $ io . putStr . pprWindowSet io (putStr " // ") withNamedWindow $ io . putStr . unWindow io (putStrLn "") logHook = dynamicLogWName tia, Kai

Am Dienstag, 21. August 2007 schrieb Kai Grossjohann:
Do people think that showing the name of the currently focused window in the status bar (in addition to the workspaces) would be a worthwhile addition?
If so, could you advise how to improve the quality of the code I've concocted? Given that I don't know Haskell, I'm happy that it runs.
Here's what I did.
To NamedWindows.hs I added the following function (and exported it):
unWindow :: NamedWindow -> String unWindow (NW n _) = n
That function already exists; it's called "show". My Config.hs says: logHook = withWindowSet $ \ws -> do let d = pprWindowSet ws t <- maybe (return "") (liftM show . getName) (W.peek ws) io . putStrLn $ show t ++ d HTH, Lukas

On Tue, Aug 21, 2007 at 06:09:45PM +0200, Lukas Mai wrote:
logHook = withWindowSet $ \ws -> do let d = pprWindowSet ws t <- maybe (return "") (liftM show . getName) (W.peek ws) io . putStrLn $ show t ++ d
Way over my head. I just know it works. Thanks a lot. Kai

Am Dienstag, 21. August 2007 schrieb Kai Grossjohann:
On Tue, Aug 21, 2007 at 06:09:45PM +0200, Lukas Mai wrote:
logHook = withWindowSet $ \ws -> do let d = pprWindowSet ws t <- maybe (return "") (liftM show . getName) (W.peek ws) io . putStrLn $ show t ++ d
Way over my head. I just know it works. Thanks a lot.
Maybe this version is easier to understand (untested): logHook = withWindowSet $ \ws -> do let d = pprWindowSet ws let maybeWindow = W.peek ws let action = case maybeWindow of Nothing -> return "" Just window -> do namedWindow <- getName window return (show namedWindow) t <- action io (putStrLn (show t ++ d)) HTH, Lukas
participants (2)
-
Kai Grossjohann
-
Lukas Mai