icewm icon indicating copy to clipboard operation
icewm copied to clipboard

Raise windows while cycling through them in Alt-Tab

Open danfe opened this issue 3 years ago • 7 comments

I'm looking for QuickSwitch configuration option which would raise windows while cycling through them with Alt-Tab, and don't seem to find one. Currently, to-be-focused (candidate) window is only indicated by the frame (active vs. inactive), but the window is not raised until Alt-Tab is released. This is usually not a problem when there are few windows on the screen and they don't overlap (cover) others completely, but try launching a dozen of xterms and that's when raise-while-cycling becomes really useful.

I've patched my copy of IceWM like this, but that's probably wrong, it's just a PoC so you can understand what I mean better:

--- src/wmswitch.cc.orig
+++ src/wmswitch.cc
@@ -119,6 +119,7 @@ class WindowItemsCtrlr : public ISwitchItems
 
     void displayFocusChange(YFrameWindow *frame)  {
         manager->switchFocusTo(frame, false);
+        frame->wmRaise();
     }
 
 public:

danfe avatar Mar 22 '21 03:03 danfe

Yeah, this function is the reason for #558, so your addition won't help. I think it shouldn't change the clients WM stacking order, or very carefully restore it when the next tab or a cancel occurs. Maybe easier would be to only temporarily call XRestackWindows to restack the window just below the QuickSwitch overlay.

gijsbers avatar Mar 22 '21 10:03 gijsbers

I think it shouldn't change the clients WM stacking order, or very carefully restore it when the next tab or a cancel occurs.

I see. Alternative to window raising would be any kind of indication that would help to identify the particular window during cycling over them. Openbox does not raise windows, but it draws a rather fat black-and-white frame, perhaps IceWM could do something similar, but less ugly and themable (AFAICT, Openbox does not allow to adjust thickness or colors of it, which kind of sucks).

danfe avatar Mar 22 '21 11:03 danfe

Could you verify that commit 869d42c suffices?

gijsbers avatar Mar 28 '21 19:03 gijsbers

Could you verify that commit 869d42c suffices?

Hmm, I guess it kind of works, but since you've mentioned the window stacking order, I've now started to pay closer attention, and noticed that if I switch between two workspaces back and forth while in Alt-Tab, window order would not always persist: it seems that two topmost windows would be constantly changing their relative position every time. Not sure if that's intended, but I guess it's okay.

FWIW, Openbox always displays identical window lists (different for each workspace, but they remain unchanged between the switches), but then again, it does not raise windows during selection and only gives focus/raises once selection is made, and does not retain current position in the Alt-Tab windows between workspaces switches.

danfe avatar Mar 29 '21 03:03 danfe

Good point! Try again.

gijsbers avatar Mar 29 '21 11:03 gijsbers

Yeah, it feels better now, thanks!

danfe avatar Mar 30 '21 03:03 danfe

This breaks the switching with an arbitrary key in derived mode(s). I.e.

switchkey "Super+p" icewm-menu-xrandr

Now it gets stuck after first Win-P pressing, only mouse can rotate there. Even cursor keys not working.

Code7R avatar Apr 01 '21 15:04 Code7R

Fixed in 43de75c4085aecacfc2b5613031062c8dcbdbbe3.

gijsbers avatar Nov 09 '22 19:11 gijsbers