gnome-shell-extension-focus-changer icon indicating copy to clipboard operation
gnome-shell-extension-focus-changer copied to clipboard

Exclude covered windows?

Open crispinb opened this issue 3 years ago • 7 comments

I find the behaviour with covered windows (ie. those below one or more visible windows) a bit confusing. Sometimes moving focus left or right from a visible window moves the lower window up (in z-order), sometimes not. Perhaps I just haven't correctly spotted the pattern.

Ideally (for my use anyway), non-visible windows would just be skipped altogether. Focus Changer would be used only to jump between the visible windows, and I'd alt-tab to the covered ones when desired.

(Thanks for the great extension by the way. Combines really usefully with https://github.com/mipmip/gnome-shell-extensions-highlight-focus)

[PS. for other users reading this who have the same issue - a workaround is to hide, rather than merely cover, infrequently-used windows. Focus-changer already excludes hidden windows]

crispinb avatar Mar 11 '22 04:03 crispinb

Z-order is not considered when changing focus to the next window in any direction. It will check for the closest window within the same monitor and workspace that is not hidden (minimized) as you found out :)

return windows.filter(w => w.get_monitor() === monitor && w.is_hidden() === false);

My workflow is that I almost never have any windows on top of each other. I would rather put them on different workspaces. I only use focus-changer to change focus between the windows that are visible, or else I would use alt-tab.

Having an option to ignore windows hidden behind other windows is a good idea. I will implement it when I have time.

I'm happy to hear that you find the extension useful!

martinhjartmyr avatar Mar 12 '22 11:03 martinhjartmyr

I would also like to have the option to exclude covered windows. I'd be willing to contribute this feature, but I've never worked on an extension and can't find much in the way of API documentation. There is a function in the gnome-shell source code that looks like it might do the job, but that isn't much to go on.

Could this issue be re-opened?

mattwcole avatar Feb 19 '23 10:02 mattwcole

Sure, I might have a look at it sometime.

If you want to give it a try, it's in this function you need to filter out the covered windows:

https://github.com/martinhjartmyr/gnome-shell-extension-focus-changer/blob/e01f676cdd0f7b685739b7081e2b164f75b0c812/extension.js#L210

martinhjartmyr avatar Feb 19 '23 11:02 martinhjartmyr

There is a new extension for Cinnamon called Adjacent Windows that performs the same function as this extension, but it also supports excluding covered windows. I am not sure how similar Gnome and Cinnamon are in this regard; perhaps some code could be reused.

qadzek avatar Mar 19 '24 07:03 qadzek

Overall this makes the experience quite buggy. While testing this extension, I managed to

  • pull a covered window from the left screen to the right screen and focus it
  • open a covered window on the same screen
  • not open a covered window on the same screen

However, not a single time did I manage to switch focus from one monitor to another.... :laughing:

rommeswi avatar May 10 '24 12:05 rommeswi

Coming from a tiling window manager (i3) I (almost) never have any covered windows. I split my windows covering my workspaces and monitors using gtile. Using the focus changer extension daily, I do not experience any issues.

Can you explain your workflow? Could you have duplicated shortcuts?

I'm positive we can add an "ignore covered windows" option. As this is not part of my workflow, I have not yet invested any time into it.

martinhjartmyr avatar May 10 '24 20:05 martinhjartmyr

gtile looks interesting, I will try it out. It would be nice to have an "ignore covered windows" option. Most likely the windows were like 1px on the other screen or so.

rommeswi avatar May 11 '24 10:05 rommeswi