Zren / material-decoration

Material-ish window decoration theme for KWin, with LIM, based on zzag's original design.
GNU General Public License v2.0
197 stars 17 forks source link

[Question] LIM: Wayland? #6

Open chippmann opened 4 years ago

chippmann commented 4 years ago

Is the lim branch also compatible with wayland?

Zren commented 4 years ago

No. There's a few #ifdef HAVE_X11 that I've commented out to simplify porting appmenu from plasma-workspace.

chippmann commented 4 years ago

Ah bummer. Anyway thanks a lot for your work! I keep watching. How big of a task do you think will the wayland support be (i might have a look into it once i have a bit more time)

Zren commented 4 years ago

If the widget works in walyand, then it should be possible.

The hard part is testing it, as while you can restart plasmashell easily in wayland, you can't really easily test kwin_wayland as killing it will restart your session.

baduhai commented 4 years ago

As of earlier today, when Plasma 5.19 was released, the Global Menu works under Wayland. From my testing, LIM does not work as it currently is under Wayland, but perhaps due to the advancements it could with a bit of tweaking? The global menu is currently the only thing keeping me on X11, so it'd be awesome to be able to migrate.

trmdi commented 3 years ago

FWIW, applet-window-appmenu has added wayland support recently.

Zren commented 3 years ago

I'd noticed the LibTaskManager changes in Plasma 5.19, but wasn't entirely sure how to link it.

Relevant changes:

Zren commented 3 years ago

Here's the commit for how the Global Menu widget implemented LibTaskManager.

I found I could link with PW::LibTaskManager or taskmanager as it's aliased using add_library(PW::LibTaskManager ALIAS taskmanager). I needed to use #include <taskmanager/tasksmodel.h> to import the TasksModel class. I could only find /usr/include/taskmanager/tasksmodel.h.

Annoyingly, I need to link against Qt5::Quick as TasksModel imports QQmlParserStatus.

The Global Menu widget only calls m_tasksModel->activeTask(), it doesn't need a way to set windowId like LIM needs.

Zren commented 3 years ago

All I really need is to connect to the wayland server, find the PlasmaWindow instance, then get it's applicationMenuServiceName() and applicationMenuObjectPath().

PlasmaWindow::uuid() was added in the most recent KF5 v5.73.

psifidotos' appmenu widget has a nice WaylandWindowManager::windowFor(QVariant wid) I can use. It checks if PlasmaWindow::isValid() && PlasmaWindow::internalId() == wid.toUInt(). Unfortunately, internalId() is deprecated in the latest KF5 v5.73.

baduhai commented 3 years ago

Seems like the replacement for internalId() is uuid(), which doesn't seem so hard to adapt.

Zren commented 3 years ago

Note: I haven't actually gotten wayland working, I'm just poking at KDecoration code.

For some reason, wayland menus show up with a titlebar. Even the standard ApplicationMenu icon button from Breeze.

2021-03-15___21-49-11

Oddly, the AppIcon button menu displays properly.

m_menu = new QMenu;
connect(m_menu, &QMenu::aboutToShow, this, &UserActionsMenu::menuAboutToShow);
connect(m_menu, &QMenu::triggered, this, &UserActionsMenu::slotWindowOperation, Qt::QueuedConnection);

QMenu *advancedMenu = new QMenu(m_menu);
connect(advancedMenu, &QMenu::aboutToShow, [this, advancedMenu]() {
    if (m_client) {
        advancedMenu->setPalette(m_client->palette());
    }
});

The ApplicationMenu has a similar call:

baduhai commented 3 years ago

5.22 fixed a lot of issues with the global menu on wayland, perhaps there could be some progress now?

That search feature is sweet, and with LIM, it'd be the ultimate setup.

Vistaus commented 2 years ago

I've recently switched to Wayland and this feature would be so, so sweet to have! 🙂

Vistaus commented 1 year ago

@Zren Have you had time to look at this yet?

amorozov commented 1 year ago

Hello! Maybe some help is needed?

flukejones commented 1 year ago

Actually came here just to ping like the folks above. Recently shifted from Gnome to KDE and the absolute waste of space that is a titlebar is doing my head in.

I'm unlikely to find time to help unfortunately.

flukejones commented 1 year ago

Also came across this - https://invent.kde.org/plasma/breeze/-/merge_requests/126, is it the same code as this?

amorozov commented 1 year ago

Well, as the annotation says, it's based on the material decoration code. Likely its code slightly differs from the original one. Also it doesn't support the continuation button yet.

guiodic commented 11 months ago

By the end of the year we will move to Plasma 6 which will have Wayland by default. It would be nice to have the LIM ported to Plasma 6 and if possible to Wayland.