lxqt / qterminal

A lightweight Qt-based terminal emulator
https://lxqt.github.io
GNU General Public License v2.0
586 stars 150 forks source link

Set layer overlay for dropdown terminal on wayland #1113

Closed stefonarch closed 1 month ago

stefonarch commented 2 months ago

Fix for https://github.com/lxqt/qterminal/issues/1111

Remaining issues:

marcusbritanicus commented 2 months ago

This works great..!! Two problems I face at the moment.

  1. Multiple instances.
  2. Toggling the terminal window.

Solution for 1. We can use a single-instance class derived from QApplication. When starting in drop-down mode, we can lock the instance. In all other cases, leave it unlocked.

Solution for 2. Call qterminal -d to toggle and start the drop-down mode. Since the first instance is already locked, the subsequent instances can request the fist instance to toggle the window. All non-drop-down instances will not be affected by this since they're not locked.

stefonarch commented 2 months ago

There are already open issues for that - listed in the the issue which will be fixed. At the moment I've a rather hacky script which I use for the shortcut.

marcusbritanicus commented 2 months ago

There are already open issues for that - listed in the the issue which will be fixed. At the moment I've a rather hacky script which I use for the shortcut.

Well.. I am working on this now. Let's see how it goes.

stefonarch commented 2 months ago

Testing combined with https://github.com/lxqt/qterminal/pull/1115 the issue with the settings window below is less severe as users could use F12 again to remove the terminal. Ideally doing this in the code would best IMO.

Regarding the second listed issue: it is exactly half panel width which moves the terminal out of center or out of screen if set to 100% width. With 2 identical panels on both sides it turns centered.

marcusbritanicus commented 2 months ago

Regarding the second listed issue: it is exactly half panel width which moves the terminal out of center or out of screen if set to 100% width. With 2 identical panels on both sides it turns centered.

Panel should be a TopLayer. Since QTerminal will be OverlayLayer, there should not be any conflict at all. Is this behaviour with all compositors (including kwin) or only a particular one?

stefonarch commented 2 months ago

Is this behaviour with all compositors (including kwin) or only a particular one?

I saw exactly the same with kwin too - actually it was kwin and another user where I played with 100px panels adding and removing (and hating the jumping icon at cursor at F12 press). In theory you're right, it may be a bug in layershell-qt.

I didn't test wayfire or others.

stefonarch commented 2 months ago

Added another issue to fix:

Add an info and disable not-working shortcut selection in preferences.

tsujan commented 1 month ago

The conflict with the current master aside, the combination of this and https://github.com/lxqt/qterminal/pull/1131 resulted in a good experience here, under LabWC.

However, we may need to address some issues. For example, I noticed that the Preferences dialog goes behind the main window. I was able to work with it after clicking into the main window and then somewhere else to hide the main window, but that's not good for UX.

tsujan commented 1 month ago

The problem with Preferences dialog seems to be a problem in Wayland (WM): it's the job of a WM to put a modal dialog in front of its parent window. So, we don't need to deal with it.

marcusbritanicus commented 1 month ago

The problem with Preferences dialog seems to be a problem in Wayland (WM): it's the job of a WM to put a modal dialog in front of its parent window. So, we don't need to deal with it.

We have multiple levels of problems here:

  1. The main window is now a layer-surface, and an overlay surface. What this implies is that: a. It's not a xdg-shell window. So any windows that this layer-surface window spawns will be a simple, xdg-shell window. b. All windows that this layer-surface window spawns will be placed below this surface, because you have asked the compositor to place this on top.
  2. Wayland, at the moment, does not have the concept of window modality. Even if it did, 1a and 1b would make it a moot point.

The solution to this is to hide the drop-down surface, and then show it again when the options dialog is closed.

Alternatively, show the options dialog as a layer-surface.

tsujan commented 1 month ago

@marcusbritanicus Thanks for your explanation! I get your point; I just don't think it's our problem to solve. But yes, we may need a workaround, in which case, it could be added in another PR, after this is merged.

stefonarch commented 1 month ago

Just noticed that qterminal -d and lxqt-runner on sway have the same issue: missing keyboard focus. Actually I don't remember if I already opened an issue about that.

marcusbritanicus commented 1 month ago

@marcusbritanicus Thanks for your explanation! I get your point; I just don't think it's our problem to solve. But yes, we may need a workaround, in which case, it could be added in another PR, after this is merged.

@tsujan Just a quick update: There is a xdg-dialog in wayland-protocols. It might take time for it to be implemented in Qt, but it might solve our problem of the dialog going below. I do not expect that to directly work - it will require changes to layershell-qt.

tsujan commented 1 month ago

It might take time for it to be implemented in Qt, but it might solve our problem of the dialog going below.

Thanks for the info! indeed problems like that should be solved upstream.