Modifying the windowstyle for windows other than the active one

I use

xpdf

to view pdf files, and would like to associate a MiniIcon to the line in the RightPanel that is associated with the pdf viewer. Because xpdf opens a new window, the simple approach

FvwmCommand “Pick WindowStyle MiniIcon ”

doesn’t work: it associates the icon to the window from which xpdf was called, not the new window that xpdf opens. Using the

ps

command, i can identify the new window that’s just been opened, but I dont know how to operate on a window that’s not the active one. Could somebody please explain how to modify the FvwmCommand for this case? Thanks!

Do you want all xpdf windows to use the same MiniIcon? If so, why not just use the Style command with an appropriate name/class/resource and then all xpdf windows will have the MiniIcon style you set for it (no need to pick the window once it opens).

If you want an xpdf specific xpdf window to have a different MiniIcon, you can use the --title option of xpdf to give it a custom title, and then use that to identify the window, and use Style title MiniIcon, and all windows with that title will have the MiniIcon style you set.

Of course, the obvious solution! Thanks very much indeed, works perfectly.

This might be hijacking the thread, but in regards to the title, is it possible to specify different styles for active and inactive windows? Something along the lines of Style (Active) UseDecor MyDecor. The reason being that I want to have only active windows display buttons. If I were to use the “ActiveUp, ActiveDown, Inactive” Buttonstyles in the decor itself, the buttons are still technically there and can be clicked, which is not the behavior I want.

The Decor is not what configures if you can click the buttons or not. This is done via mouse bindings or the Button X style. I see two options. First what you could do is just make it so the buttons do nothing if the window is not focused. In your Mouse bindings wrap all of your options in a function. For instance here is a custom Maximize function:

DestroyFunc MyMaximize
AddToFunc MyMaximize
+ I ThisWindow (Focused) Maximize

So if you bind that to your maximize button, it will only maximize the window if it has focused, otherwise it will do nothing, effectively disabling the buttons on non active windows. Then you can use your decor to make your buttons look different.

If you really want to remove the buttons completely you can use the Button X and !Button X styles. The next thing is to trigger these styles when you change focus and to ensure that only the focused window has buttons. To do this I used a combination of a custom function and FvwmEvent to trigger the function on a focus_change. Using the default configuration, buttons 1, 2, 4, and 6 are used. So I used the following:

DestroyFunc ToggleButtons
AddToFunc ToggleButtons
+ I All (Focused) WindowStyle Button 1, Button 2, Button 4, Button 6
+ I All (!Focused) WindowStyle !Button 1, !Button 2, !Button 4, !Button 6

DestroyModuleConfig FE-ToggleButtons: *
*FE-ToggleButtons: focus_change ToggleButtons
Module FvwmEvent FE-ToggleButtons

And now only the focused window have buttons, and all other windows don’t.

1 Like

The FvwmEvent way is what I had in mind, it’s just a little delayed, but works perfectly otherwise. Thank you!

It might be better to only act on the window that is loosing focus and the one that is gaining focus, but only a single window context is sent with the focus_change event, so I found it easier to just use All (Focused/!Focused) to hit the windows. This is a bit sloppy but works. You might be able to clean it up if you so desire, maybe look at the enter_window and leave_window events.