Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wayland taskbar support #2031

Closed
wants to merge 92 commits into from
Closed

Wayland taskbar support #2031

wants to merge 92 commits into from

Conversation

gfgit
Copy link
Member

@gfgit gfgit commented Feb 24, 2024

Depends on #2024 (Qt6 port) and #2029 (WM abstraction)

This is an experimental implementation on taskbar, desktopswitch and showdesktop functionality for KWin Wayland compositor.
It uses following protocols:

Code is inspired by libtaskmanager/waylandtasksmodel.cpp

Ideally the Wayland backend should have sub-backends targeting specific compositors when no standard protocol is available.

It also uses layer shell protocol to place panel on screen edge.

NOTE: panel auto-hide is not working yet

@gfgit gfgit mentioned this pull request Feb 24, 2024
@stefonarch
Copy link
Member

stefonarch commented Feb 24, 2024

Heureka!

In plasma session all 3 elements of lxqt-panel are working perfectly ;) just starting from cli.

Less luck in openbox with kwin nested session (both cli and .desktop file in /usr/share/applications)

  • taskbar empty
  • desktop switch working
  • showdesktop segfaults panel, sorry only screenshot

screenshot_2024-02-24_14 20 10

Maybe kwin needs more arguments, --no-kactivities and else.

@stefonarch
Copy link
Member

stefonarch commented Feb 24, 2024

NOTE: panel auto-hide is not working yet

On my slower VM (neon-unstable) this works, but empty taskbar also in plasma-session
EDIT: works also on the dev edition.

@gfgit
Copy link
Member Author

gfgit commented Feb 24, 2024

  • showdesktop segfaults panel, sorry only screenshot

Protocol access is not guarded yet.
Infact we should wait for compositor to grant the protocol before starting using it. in your case I think the protocol is not grabted (hence taskbar empty) and you explicitly use make a request to show desktop which fails.
Need to investigate why nested session does not grant protocol

@stefonarch
Copy link
Member

stefonarch commented Feb 24, 2024

I fiddled with env vars (see featherpad window) and.... all working, also showdesktop amd autohide! Not sure which one is needed and about the Qt one. Some invisible icon issues, the share dir doesn't work here.

kwin

@gfgit
Copy link
Member Author

gfgit commented Feb 24, 2024

In kwin_wayland nested inside openbox I can reproduce crash if clicking show desktop button.
Crash does not happen if I set KWIN_WAYLAND_NO_PERMISSION_CHECKS=1 env variable before starting KWin.
Also FancyMenu is completely empty and also Favorites and All Apps categories are empty and without icon. I think XDG env variables are not set correctly

@stefonarch
Copy link
Member

Also FancyMenu is completely empty and also Favorites and All Apps categories are empty and without icon. I think XDG env variables are not set correctly

Here I didn't install wip_qt6 of lxqt-qtplugin yet.

I'm using this script to start openbox at the bottom line exec openbox and inserted those 3 env vars too. The I use just kwin_wayland lxqt-panel. For some reason if I try directly form sddm to start a kwin script I've no cursor. I'm happy when I can stop using Neon for testing...

@stefonarch
Copy link
Member

stefonarch commented Feb 24, 2024

Found only one issue: the favorites dialog is normal window and behind, and similar for plugin directorymenu: it displays a window center screen.
bug

Disabled also all kwin effects, now it's snappy.

@stefonarch
Copy link
Member

stefonarch commented Feb 24, 2024

Just for the record: Only export XDG_SESSION_DESKTOP=KDE is needed for a working taskbar. And also "mount" plugin opens a normal window center screen, looks like a layer-shell-qt bug to me as it doesn't happen without.

EDIT: seems a focus thing, if typing in the search first the favorites menu is adiacent at the panel:

favorites

Another misalignment with bottom panel:

submenu1

@stefonarch
Copy link
Member

stefonarch commented Feb 24, 2024

Testing with labwc, no popup is shown as normal window, but some misalignment can be found, like the favorites menu close to the panel or directorymenu covering the panel on the right. AND: autohide working!

labwc.mp4

Crash when clicking showdesktop is here present too.

@gfgit
Copy link
Member Author

gfgit commented Feb 25, 2024

Only export XDG_SESSION_DESKTOP=KDE is needed

Not working here :(

EDIT: It works, I was using an old .desktop file

XDG_CURRENT_DESKTOP=KDE makes it load icons from breeze theme using KDE Platform integration (I still have to install lxqt qtplugin which would replace this)

XDG_SESSION_DESKTOP=KDE is needed because .desktop file contains OnlyShowId=KDE

XDG_MENU_PREFIX=lxqt- makes FancyMenu load the applications

I have same popup issues and also "Open With" both from dolphin and from PCManFM-Qt does not work

@gfgit
Copy link
Member Author

gfgit commented Feb 25, 2024

For future works:
I've found this code inside Qt sources:

QPlatformServiceColorPicker *QGenericUnixServices::colorPicker(QWindow *parent)
{
#if QT_CONFIG(dbus)
    // Make double sure that we are in a wayland environment. In particular check
    // WAYLAND_DISPLAY so also XWayland apps benefit from portal-based color picking.
    // Outside wayland we'll rather rely on other means than the XDG desktop portal.
    if (!qEnvironmentVariableIsEmpty("WAYLAND_DISPLAY")
        || QGuiApplication::platformName().startsWith("wayland"_L1)) {
        return new XdgDesktopPortalColorPicker(portalWindowIdentifier(parent), parent);
    }
    return nullptr;
#else
    Q_UNUSED(parent);
    return nullptr;
#endif
}

So we could replace out color picker logic with XDG Portal equivalent

@stefonarch
Copy link
Member

"Open With" both from dolphin and from PCManFM-Qt does not work

No issue here with both filemanager.

@stefonarch
Copy link
Member

Launching lxqt-globalkeysd default shortcut Alt+F1 is opening the panel menu, but can't be changed obviously. Kwin-only.

@gfgit
Copy link
Member Author

gfgit commented Feb 26, 2024

Color picker now uses XDG Desktop Portal on Wayland. Pasting color to clipboard does not seem to work yet.
Also we should show some sort of error if portal says color picking is not supported of if no portal is available at all.
Logic is already implemented, we just need the UI part

@stefonarch
Copy link
Member

Pasting color to clipboard does not seem to work yet.

Usually this is piped to wl-copy, to take inspiration.

@stefonarch
Copy link
Member

I noticed that kwin has no "shade" (roll up) feature anymore, I thought it was possible once. Only lawc has it afaik.

anchors.setFlag(LayerShellQt::Window::AnchorRight);
mLayerWindow->setAnchors(anchors);

mLayerWindow->setKeyboardInteractivity(LayerShellQt::Window::KeyboardInteractivityNone);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be KeyboardInteractivityOnDemand otherwise typing in search and using arrow keys won't work in most compositors. See labwc/labwc#1594

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, and Ondemand fixed also those popup opening as normal windows in add-favorites dialog, directorymenu, mount and else!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Thanks for the hint.
Here starting nested labwc with your startlxqtlabwc script it doesn't solve the issue.
FancyMenu does not receive keyboard input. Anyway it's more correct now

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be sure I've started labwc session directly from SDDM to double check.
I've also tried setting "Exclusive" keyboard focus.
Still not working.

Copy link
Member

@stefonarch stefonarch Mar 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need latest labwc, they fixed it today. pcmanfm-qt --desktop had the same issue, no keyboard.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pcmanfm-qt --desktop had the same issue, no keyboard.

Yes, the keyboard focus problem of pcmanfm-qt's desktop was also fixed by a patch. LabWC's devs are very fast.

Set layer shell keyboard interactivity on-demand
@stefonarch
Copy link
Member

@gfgit Could you implement this for "Configure panel" window?
lxqt/lxqt-config#984

With some help from @tsujan I did already stefonarch/lxqt-session@201d6ee

@tsujan
Copy link
Member

tsujan commented Mar 11, 2024

@gfgit Could you implement this for "Configure panel" window?

I really think we need to avoid overusing layer-shell-qt.

@gfgit
Copy link
Member Author

gfgit commented Mar 11, 2024

I really think we need to avoid overusing layer-shell-qt.

Hi, I was thinking the same thing. Isn't lxqt-config just a normal app?
lxqt-leave might be an exception in this, but on non-tiling compositors it should open at sceen center like any other window...

@tsujan
Copy link
Member

tsujan commented Mar 11, 2024

Isn't lxqt-config just a normal app?

Yes.

lxqt-leave might be an exception in this

@stefonarch has already taken care of it and waits for my Qt6 PR for lxqt-session to be merged (which should be merged only with other Qt6 PRs for components that depend on liblxqt, including lxqt-panel).

but on non-tiling compositors it should open at sceen center like any other window...

Stacking Wayland compositors have their options for that — for centering (default in LabWC) or not — and, IMHO, we should respect those options.

@stefonarch
Copy link
Member

stefonarch commented Mar 11, 2024

It's ok if you don't use tiling WM like sway or hyprland where you need again window rules to make them float. I tested with the lxqt-leave and it behaves ok. We only need to force position IMO, not layer or keyboard to avoid those rules which are never 100% working.
Example Hyprland:

# LXQt Settings windows, policykit
windowrule = float,^(lxqt-.*)$
windowrule = float, ^(pavucontrol-qt)$

sway

# LXQt (config) windows
    for_window [app_id="^lxqt-.*$"] floating enable
    ```

@tsujan
Copy link
Member

tsujan commented Mar 11, 2024

It's ok if you don't use tiling WM

Tiling WMs need to fix their UX problems themselves. It's not our job to do their work for them ;)

@stefonarch
Copy link
Member

It's ok if you don't use tiling WM

Tiling WMs need to fix their UX problems themselves. It's not our job to do their work for them ;)

I know you dislike them ;)

My opinion is this: if we can provide a good out-of-the-box experience we should do it. We pretend also being modular and to work with any WM/compositor.

@tsujan
Copy link
Member

tsujan commented Mar 11, 2024

We pretend also being modular

Being modular is one thing, adding codes to compensate for others' problems is another. The latter would make LXQt codes dirty and unmaintainable if we didn't avoid it.

@stefonarch
Copy link
Member

stefonarch commented Mar 12, 2024

Trying to build again on Neon stable it fails here: https://paste.debian.net/1310396/
After fixing this I get in plugin-taskbar/lxqttaskbarplugin.h line 62 "undefined inteface"

@stefonarch
Copy link
Member

After fixing this I get in plugin-taskbar/lxqttaskbarplugin.h line 62 "undefined interface"

I see this happens if I compile directly this branch. If I compile first wip_qt6 branch it does compile.
So it looks there is something missing here.

@stefonarch
Copy link
Member

stefonarch commented Mar 15, 2024

I continue to consider not centering the panel config dialog a bug we should fix - in tiling WM at least it doesn't get covered by a left or right panel:

screen_area_sab_00:54:32_

@stefonarch
Copy link
Member

@gfgit Just learned that qmpanel has working taskbar support on wayland for wlroots-based compositors: https://github.com/jlindgren90/qmpanel/blob/master/panel/taskbar.cpp

@gfgit
Copy link
Member Author

gfgit commented Mar 15, 2024

in tiling WM at least it doesn't get covered by a left or right panel

Isn't this supposed to just work™ with layer shell protocol on the panel which reserves screen space?

@stefonarch
Copy link
Member

It should and it's somehow an exception, as issues with alignment (tooltips, fancymenu dialog) can be seen only on bottom and right panels. I first thought it was about right panels only.

@gfgit
Copy link
Member Author

gfgit commented Mar 15, 2024

It should and it's somehow an exception, as issues with alignment (tooltips, fancymenu dialog) can be seen only on bottom and right panels. I first thought it was about right panels only.

I think it's worth filing a bug to affected tiling compositors and see if they can fix it.

@stefonarch
Copy link
Member

stefonarch commented Mar 16, 2024

I think it's worth filing a bug to affected tiling compositors and see if they can fix it.

Maybe I wasn't clear: this is an issue on stacking WMs, in tiling WM without window rules it's tiled as any other:
screen_area_sab_02:36:09_
with windowrule = float,^(lxqt-.*)$ it is floating, with layershell code it would always be floating and centered on any WM:

screen_area_sab_02:27:21_

I noticed that in kwin_wayland it is centered by default.

@Consolatis
Copy link

Consolatis commented Mar 16, 2024

I continue to consider not centering the panel config dialog a bug we should fix - in tiling WM at least it doesn't get covered by a left or right panel:

screen_area_sab_00:54:32_

What compositor is that? If the panel is correctly configured to use the exclusive zone (and updates it on window resize), the window should likely not overlap the panel area.

The protocol does not enforce that restriction though. It also says about the exclusive zone:

 A positive zone is the distance from the edge in surface-local
 coordinates to consider exclusive.

So that would mean if the panel is anchored to the top, right and bottom edges, the exclusive zone should be set to the panel width rather than height.

@stefonarch
Copy link
Member

What compositor is that?

It's labwc. I made a test assuming that wayfire had the same issue, but it behaves like kwin, centering this panel config dialog without rules.
The exclusive zone works fine as in the other screenshots (Hyprland) but only if the panel width i set to 100% .

@stefonarch
Copy link
Member

I didn't keep in mind that I was on a branch (for testing exit session) which didn't have the panel focus fix and maybe else. So there is no issue with exclusive zone on left/right panels in labwc git:

screen_area_sab_21:30:16_

TryExec=lxqt-panel

# NOTE: KWin wants absolute path here, make sure it's correct
Exec=/usr/local/bin/lxqt-panel
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the reason why only pager worked on arch.
This file has to be configured by cmake to match the installation path. Changing it to /usr/bin kwin_wayland session is fully functional here now :)
Could have seen it earlier.

@tsujan
Copy link
Member

tsujan commented Mar 17, 2024

probably for this feature of the floating panel in plasma

Do they really call it a feature or are you joking? The second problem of Plasma 6 that attracted my attention yesterday was its panel (under X11 — wasn't brave enough to log into its Wayland session).

@stefonarch
Copy link
Member

stefonarch commented Mar 17, 2024

Do they really call it a feature or are you joking

I put it first between " " but removed them as I'm trying to be polite;)
I logged into plasma and disabled the floating panel but this space didn't disappear, it's in Neon too I saw. Maybe open a bug report is necessary.

@stefonarch
Copy link
Member

Could this solve eventually the alignment issues in bottom/right panels?

git://code.qt.io/qt/qtwayland.git:

QRect placementAnchor = m_window->window()->property("_q_waylandPopupAnchorRect").toRect();
   if (!placementAnchor.isValid()) {
       placementAnchor = QRect(m_window->geometry().topLeft() - parent->geometry().topLeft(), QSize(1,1));
   }
...
   positioner->set_anchor_rect(placementAnchor.x(),
                               placementAnchor.y(),
                               placementAnchor.width(),
                               placementAnchor.height());»
                               ```

@stefonarch
Copy link
Member

Just another maybe useful snippet for alignment:
https://github.com/jlindgren90/qmpanel/pull/8/files

@stefonarch
Copy link
Member

Not sure what has changed - it was some time I didn't use kwin_wayland session, but can't get the taskbar to work now anymore.

As it looks that the review of taskbar-refactor will take much time I think we should have a PR only for the panel wayland code for now.

@gfgit
Copy link
Member Author

gfgit commented Mar 26, 2024

Replaced by #2043

@gfgit gfgit closed this Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants