plover icon indicating copy to clipboard operation
plover copied to clipboard

Closing the lookup window can change workspace

Open antistic opened this issue 4 years ago • 5 comments

Summary

Closing the lookup window when it's set to sticky switches workspace back to original

Reproducing

  • set lookup window to appear on all workspaces
    • e.g. in i3wm for_window [title="Plover: Lookup"] sticky enable
  • open the lookup window while another window is active
  • switch to a window on another workspace
  • close the plover lookup window

Plover Version

4.0.0.dev8+235.gd20167f

System

ArchLinux, i3wm, aur/plover-git

-

Pretty sure it's to do with this bit of code in main_window.py:

    def _activate_dialog(self, name, args=(), manage_windows=False):
        if manage_windows:
            previous_window = wmctrl.GetForegroundWindow()
        # ... 
        if dialog is None:
            # ...
            def on_finished():
                # ...
                if manage_windows and previous_window is not None:
                    wmctrl.SetForegroundWindow(previous_window)
            # ...

antistic avatar Feb 23 '21 03:02 antistic

Should this be counted as a bug?

  • It only affect users of that particular windows manager.
  • Switching back to the main window like a reasonable thing to do.
  • Unless Plover can somehow detect whether the main window is on the current workspace, there isn't really a better way.
  • And that concept of workspace is probably i3wm-specific. Does it expose an API to determine that?

As a simple workaround it's possible to hide the Plover window (instead of merely moving it to another work space)

user202729 avatar Feb 23 '21 12:02 user202729

Is it supposed to be switching back to the main Plover window? Because this happens when you open the look up window with any other window active first, with or without the main window already minimized.

I think a more reasonable thing to do is switch back to the last active window you were on before closing the look up window, instead of going back to whatever window was open when you first opened the look up window.

antistic avatar Feb 23 '21 14:02 antistic

Perhaps on some other operating systems it defaults to focusing nothing.

Anyway the best option would be to make it (yet another) configuration option.

Having too many configuration option is never a bad idea as long as the most frequently-used ones are more accessible.

user202729 avatar Feb 23 '21 14:02 user202729

It only affect users of that particular windows manager.

I just did a quick test with Gnome on X, where instead of pinning the lookup window to all workspaces I manually dragged the window over to another workspace and the same thing happens, so it's not WM specific.

Anyway the best option would be to make it (yet another) configuration option.

I think options is a good idea but "switch back to the window you opened lookup on" is a weird option next to "switch to main plover window" and "let your WM handle focus" (which will probably be focusing nothing or focus the window you were on before the lookup).

antistic avatar Feb 23 '21 14:02 antistic

Do we still need this (focus the previous window)? This option was inherited from 3.x, when we were using wx. Frankly, I expect this to be the job of the window manager / DE.

Really not in favor of another config option.

We could add an heuristic: if the window looses focus, then don't try to restore focus when it's next closed.

benoit-pierre avatar Apr 02 '21 16:04 benoit-pierre