lxqt-panel icon indicating copy to clipboard operation
lxqt-panel copied to clipboard

Wayland taskbar support

Open gfgit opened this issue 1 year ago • 47 comments

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 avatar Feb 24 '24 10:02 gfgit

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 avatar Feb 24 '24 13:02 stefonarch

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.

stefonarch avatar Feb 24 '24 14:02 stefonarch

  • 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

gfgit avatar Feb 24 '24 14:02 gfgit

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

stefonarch avatar Feb 24 '24 15:02 stefonarch

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

gfgit avatar Feb 24 '24 15:02 gfgit

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 avatar Feb 24 '24 16:02 stefonarch

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 avatar Feb 24 '24 16:02 stefonarch

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 avatar Feb 24 '24 17:02 stefonarch

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!

https://github.com/lxqt/lxqt-panel/assets/10681413/66fb5ae7-71c6-4c49-bda9-009160f6ebeb

Crash when clicking showdesktop is here present too.

stefonarch avatar Feb 24 '24 18:02 stefonarch

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 avatar Feb 25 '24 11:02 gfgit

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

gfgit avatar Feb 25 '24 12:02 gfgit

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

No issue here with both filemanager.

stefonarch avatar Feb 25 '24 18:02 stefonarch

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

stefonarch avatar Feb 25 '24 18:02 stefonarch

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

gfgit avatar Feb 26 '24 08:02 gfgit

Pasting color to clipboard does not seem to work yet.

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

stefonarch avatar Feb 26 '24 11:02 stefonarch

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

stefonarch avatar Feb 26 '24 11:02 stefonarch

I often get this error when doing incremental builds:

ninja: error: dependency cycle: panel/lxqt-panel_autogen/timestamp -> panel/qwayland-org-kde-plasma-virtual-desktop.h -> panel/lxqt-panel_autogen -> panel/CMakeFiles/lxqt-panel_autogen -> panel/lxqt-panel_autogen/timestamp
21:37:32: The process "/usr/bin/cmake" exited with code 1.
Error while building/deploying project lxqt-panel (kit: Desktop)
When executing step "Build"

gfgit avatar Feb 28 '24 20:02 gfgit

Issues seen now on arch, not Neon:

  • keyboard navigation in panel menus working only with kwin_wayland (labwc is fixing this); idem not possible to type in the search of both menus.
  • left|right panels don't preserve space on screen, or better if checked it reserves space at bottom and top, going over sfwbar or waybar in the corner if they are at the bottom. This was not so in Neon.
  • clock displays month and day in english (only that)
  • Didn't manage to make the taskbar work under kwin
  • "add/remove favorites" menu is a normal window center screen usually, same for directorymenu and mount popups, but if first keyboard navigation is used in fancymenu it's ok (except position aligned at bottom with a bottom panel).

EDIT: Not sure if that was working on the previous commit, recompiled this morning and right click on statusnotifier items is not working anymore. Looks like I've issues with libdbusmenu-lxqt

stefonarch avatar Feb 29 '24 06:02 stefonarch

Just noticed that right click menu items in statusbar probably never worked also on Neon.

stefonarch avatar Feb 29 '24 12:02 stefonarch

Not sure but for the popups shown centered and as normal windows: https://wayland.app/protocols/wlr-layer-shell-unstable-v1#zwlr_layer_surface_v1:request:get_popup

stefonarch avatar Mar 01 '24 06:03 stefonarch

One difference I see between compositors: a right panel with less than 100% loses its exclusive zone in labwc, sway and Hyprland, but not in kwin and wayfire.

It doesn't "see" other exclusicve zones than the ones from itself, but that will rarely be an issue.

"Showdesktop" crashes the panel on labwc (on the others non-kwin probably too), but restarts automatically fine, this needs fixing.

EDIT: "showdesktop" restarts the panel on kwin too, "desktop switch" works on kwin and is invisible on the others. which is quite nice.

stefonarch avatar Mar 03 '24 20:03 stefonarch

Forgot the backtrace, probably not very useful.

#0  0x000075663d6f99d4 in wl_proxy_get_version () at /usr/lib/libwayland-client.so.0
#1  0x0000592fc2e96049 in ??? ()
#2  0x0000592fc2e8429a in ??? ()
#3  0x000075663bd90ca9 in ??? () at /usr/lib/libQt6Core.so.6
#4  0x000075663c6e2077 in QAction::activate(QAction::ActionEvent) () at /usr/lib/libQt6Gui.so.6
#5  0x000075663cdfeb1c in ??? () at /usr/lib/libQt6Widgets.so.6
#6  0x000075663ce0d245 in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () at /usr/lib/libQt6Widgets.so.6
#7  0x000075663cf1f6fe in QToolButton::mouseReleaseEvent(QMouseEvent*) () at /usr/lib/libQt6Widgets.so.6
#8  0x000075663cd45065 in QWidget::event(QEvent*) () at /usr/lib/libQt6Widgets.so.6
#9  0x000075663ccf438b in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
    at /usr/lib/libQt6Widgets.so.6
#10 0x000075663ccf6be8 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/libQt6Widgets.so.6
#11 0x000075663bd39818 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
    at /usr/lib/libQt6Core.so.6
#12 0x000075663ccf2327 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) () at /usr/lib/libQt6Widgets.so.6                                    
#13 0x000075663cd57a97 in ??? () at /usr/lib/libQt6Widgets.so.6
#14 0x000075663cd58db0 in ??? () at /usr/lib/libQt6Widgets.so.6
#15 0x000075663ccf438b in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
    at /usr/lib/libQt6Widgets.so.6
#16 0x000075663bd39818 in QCoreApplication::notifyInternal2(QObject*, QEvent*) ()
    at /usr/lib/libQt6Core.so.6
#17 0x000075663c36f9e5 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /usr/lib/libQt6Gui.so.6                                                                             
#18 0x000075663c3da85c in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/libQt6Gui.so.6                                                                             
#19 0x000075663c7b26c4 in ??? () at /usr/lib/libQt6Gui.so.6
#20 0x000075663b52bf69 in ??? () at /usr/lib/libglib-2.0.so.0
#21 0x000075663b58a3a7 in ??? () at /usr/lib/libglib-2.0.so.0
#22 0x000075663b52a162 in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#23 0x000075663bf739c4 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /usr/lib/libQt6Core.so.6
#24 0x000075663bd43d6e in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
    at /usr/lib/libQt6Core.so.6
#25 0x000075663bd3c2b8 in QCoreApplication::exec() () at /usr/lib/libQt6Core.so.6
#26 0x0000592fc2e4c29a in ??? ()
#27 0x000075663b643cd0 in ??? () at /usr/lib/libc.so.6
#28 0x000075663b643d8a in __libc_start_main () at /usr/lib/libc.so.6
#29 0x0000592fc2e4cb25 in _start ()

stefonarch avatar Mar 04 '24 06:03 stefonarch

@gfgit What do you think about https://github.com/labwc/labwc/issues/1572#issuecomment-1973000293 ?

Keyboard navigation and search are working only under kwin and Hyprland.

stefonarch avatar Mar 04 '24 20:03 stefonarch

@gfgit What do you think about labwc/labwc#1572 (comment) ?

Keyboard navigation and search are working only under kwin and Hyprland.

Well if it's working on Hyprland it should mean it's not a wlroots issue. Also if at least panel dependencies get merged for Qt6 it would be easier for third-party devs to test this bug with lxqt-panel

We could try replicate the same workaround and see if it works and then revert it when compositors get fixed

gfgit avatar Mar 04 '24 20:03 gfgit

At the moment I'm a bit busy so I might delay this change a bit. But thank you for linking this!

gfgit avatar Mar 04 '24 20:03 gfgit

Also if at least panel dependencies get merged for Qt6 it would be easier for third-party devs to test this bug with lxqt-panel

Hopefully soon. I filed bug reports to sway too; wayfire dev have compiled it already and had already an open issue.

stefonarch avatar Mar 04 '24 21:03 stefonarch

@gfgit Could you implement this for "Configure panel" window? https://github.com/lxqt/lxqt-config/issues/984

With some help from @tsujan I did already https://github.com/stefonarch/lxqt-session/commit/201d6ee402f5a27a71568b05cfb80d56e4708634

stefonarch avatar Mar 11 '24 08:03 stefonarch

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

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

tsujan avatar Mar 11 '24 12:03 tsujan

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...

gfgit avatar Mar 11 '24 12:03 gfgit

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.

tsujan avatar Mar 11 '24 13:03 tsujan