I have a binding to let me switch the page using Super_L and the arrow keys and this works fine. My problem is that the window stays in focus while in the other page, and I haven’t found any functions that let me drop the focus a window without giving focus to another. Is root seen as a window? If so, can I switch focus to there instead?
If I understand correctly, the current window e.g. on page 0 0 remains focused when you switch to page 0 1? My system becomes unfocused. What makes the difference, we have to check.
I don’t know of a way to give the root window focus, but if you use
MouseFocus, focus will be lost as soon as the mouse leaves the window.
Yes that is correct. I am using the style SloppyFocus, and I would like to keep it like that because it is convenient when going back and forth in the same page.
From the sound of it, it doesn’t sound like there is any way to do this while keeping SloppyFocus
Correct. This is what MouseFocus is for.
You could make your bindings call a function that will give focus to a window on the page as you change, which can work if you move to a page with another window already there. I’ve also seen people setup functions that remember what has focus on a page, and return that window to focus when switching between pages/desks.
I did a test with
SloppyFocus when changing the page. The window gets focused due to courser. If it is not pointed on a window, no focus. Push the cursor aside before changing the page.
This doesn’t make sense, or your test wasn’t complete.
SloppyFocus, will only change focus when a mouse enters in a new window, so switching pages will keep focus on the old window until a new window gains focus via a mouse enter.
MouseFocus on the other hand will loose focus as soon as the mouse leaves a window, which is the difference between the two.
Was test on Debian 1.0.6a with FvwmConsole running GoToPage? I remember seeing strange, console has problems. @somiaj comment reminded me about it. I deleted Debian and installed release 1.0.8 and everything works fine, including SloppyFocus
I found a work around by first setting all window styles to
NeverFocus, then back to
SloppyFocus. The problem here is that this ruins the the focus style of my FvwmButtons.
Is there any way to get a handle to the currently selected window? Either in the form of the name or something similar. This way I could localize the temporary changes to only one window and therefore not ruin my FvwmButtons style
You could try saving the name of the newly focused window in the info store whenever you change focus.
For example, in your StartFunction, add:
+ I Module FvwmEvent EvtFocusChange
Then customize the focus_change event with:
DestroyModuleConfig EvtFocusChange:* *EvtFocusChange: focus_change SaveWindowName DestroyFunc SaveWindowName AddToFunc SaveWindowName + I InfoStoreAdd temp_name $[w.name]
You should be able to use the stored window name later in any function triggered by the new_page event. This function could consist in changing the style of the named window:
... + I Style $[infostore.temp_name] .... ...
Why not use: Prev (Focused) Echo $[w.name]…
Thanks for the answer. I got it working as wanted with a modified version of your suggestion. I also tried with thomasadam’s suggestion, but couldn’t get it to work