[xmonad] Visual indication of minimized windows

Ramon Diaz-Uriarte rdiaz02 at gmail.com
Wed Feb 7 20:00:54 UTC 2024


Dear Eyal,

Without doing anything, special rofi shows the windows (e.g., "rofi -show window") and the workspace where they are. So if you know that somewhere you have a possibly hidden window with a recognizable name, this works perfectly. However, as far as I can tell, there is no indication that they are hidden.

This thread in reddit may be relevant too:
https://old.reddit.com/r/xmonad/comments/q63wt6/minimized_windows_list_open_from_list_open_all/

Based on that thread, and some trial-and-error, I have some code in my xmonad.hs that will feed the hidden windows to rofi, so that they are listed (with the name of their workspace), and will be un-hidden on pressing Enter. The code works for me, but I am a complete ignorant in Haskell; this is from the reddit thread (i.e., from Ivan Malison) + trial and error + a few questions to perplexity.ai. The function I bind to a keybinding is myHiddenMenuBring


----------------------------------------------------------------------
minimizedWindows = withMinimized return
restoreAll = mapM_ maximizeWindow
restoreAllMinimized = minimizedWindows >>= restoreAll


windowIsMinimized w = do
  minimized <- XS.gets minimizedStack
  return $ w `elem` minimized

maybeUnminimize w = windowIsMinimized w >>= flip when (maximizeWindow w)
maybeUnminimizeFocused = withFocused maybeUnminimize


-- Define a custom WindowBringerConfig to use rofi on hidden windows
myRofiHiddenConfig :: WindowBringerConfig
myRofiHiddenConfig = def
  { menuCommand = "rofi"
  , menuArgs = ["-show", "window", "-dmenu", "-p", "Hidden windows"]
  , windowFilter = \ w -> elem w <$> XS.gets minimizedStack
  }

myHiddenMenuBring :: X ()
myHiddenMenuBring = actionMenu myRofiHiddenConfig bringWindow >> maybeUnminimizeFocused



(It might be necessary to also import this, which I do anyway

import qualified XMonad.Util.Dmenu as DM
)
----------------------------------------------------------------------


Best,

R.




On Wed, 07-February-2024, at 20:20:16, Eyal Erez <oneself at gmail.com> wrote:
> Hi,
>
> I've recently added XMonad.Actions.Minimize/XMonad.Layout.Minimize to my setup and I like it a lot. My only issue is that I would love it if there
> was some visual queue that the workspace contains minimized windows. Currently, they just disappear and I need to remember where they
> exist.
>
> Is there some way to show that? I'm also using polybar if that helps.
>
> Thank you,


-- 
Ramon Diaz-Uriarte
Department of Biochemistry, Lab B-31
Facultad de Medicina 
Universidad Autónoma de Madrid 
Arzobispo Morcillo, 4
28029 Madrid
Spain

Phone: +34-91-497-2412

Email: rdiaz02 at gmail.com
       r.diaz at uam.es
       ramon.diaz at iib.uam.es

https://ligarto.org/rdiaz




More information about the xmonad mailing list