Skip to content

Wayfire backend #2280

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

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

marcusbritanicus
Copy link
Contributor

@marcusbritanicus marcusbritanicus commented May 13, 2025

What works

  • Listing tasks
  • Listing tasks per workspace
  • Moving windows from one workspace to another (menu)
  • Closing a view (menu and close button)
  • Minimizing and restoring a view (menu)
  • Maximizing/restoring a view (menu)
  • Listing workspaces
  • Switching workspaces
  • Show/hide Desktop
  • Send to previous/next monitor - I am not very sure how LXQt identified "previous" or "next".

What does not work, but can (eventually 😉)

  • Proper minimize/restore using task button - requires double clicks
  • Pin to top/bottom - unimplemented from my side (currently)
  • Workspace names (LXQt support missing) - Since workspaces on wayfire are per-output, workspace names too are per-output. This means that we need to provide the output name when calling the getyWorkspaceName(...) function. I lack the proper knowledge to make this work. @tsujan Perhaps, you can have a look?
  • Vertical/Horizontal maximize (No support from Wayfire, I am working on it)

What should work, but does not.

Unsupported

  • Shade/Roll-up
  • Urgency
  • Pin view below.

All other features are currently untested or not implemented.

@tsujan
Copy link
Member

tsujan commented May 13, 2025

Very nice to have a dedicated backend for wayfire :) Thank you very much for the hard work!

After releasing 2.2.1, I'll try it with git Wayfire and check those of parts of the code that I can check.

@marcusbritanicus
This is very unrelated, but I'll forget it if I don't mention it here ;) Any idea about WayfireWM/wayfire#2600? I think it's a serious obstacle to using Wayfire with Qt.

@stefonarch
Copy link
Member

Can confirm most, nice work :)
It needs Wayfire git+2 PRs atm.

"Show only apps from the panel's screen" works too, maybe it did before too?
"Show only windows from current workspace" doesn't.

@stefonarch
Copy link
Member

Probably the desktop switcher needs a fix as it was never used to show per-screen-workspaces. It should only consider the workspaces of the screen, similar to the setting available in the taskmanager. Atm it works changing workspaces only of the screen but it displays everywhere the same desktop. This is when switching workspaces on another desktop:

swipe.mp4

@marcusbritanicus
Copy link
Contributor Author

Very nice to have a dedicated backend for wayfire :) Thank you very much for the hard work!
Can confirm most, nice work :)

Thank you.

This is very unrelated, but I'll forget it if I don't mention it here ;) Any idea about WayfireWM/wayfire#2600? I think it's a serious obstacle to using Wayfire with Qt.

I'll have a look at this sometime next week.

Probably the desktop switcher needs a fix as it was never used to show per-screen-workspaces. It should only consider the workspaces of the screen, similar to the setting available in the taskmanager. Atm it works changing workspaces only of the screen but it displays everywhere the same desktop. This is when switching workspaces on another desktop:

It's the currentWorkspaceChanged signal that needs to be tracked properly. I have modified this signal to take two arguments, first the workspace index, and second the output name. However, I did not find a proper way to get the screen name in the desktop-switcher plugin, which is why this happens.

"Show only windows from current workspace" doesn't.

This should work, but perhaps some plugin from wayfire is not enabled. Currently, I'm not printing the IPC error messages. Once I add the debug messages, it will be easier to track what's working and what does not.

@stefonarch
Copy link
Member

"Show only windows from current workspace" doesn't.

This should work, but perhaps some plugin from wayfire is not enabled. Currently, I'm not printing the IPC error messages. Once I add the debug messages, it will be easier to track what's working and what does not.

This was before afaik, it works fine now.

What can be seen (if this option is unchecked) moving it by right click to another desktop works, but when I go to another workspace and then try to move it there by right click menu it doesn't. Basically same as "move to current". What's worse is when the view is on 1, I go to 3 and move it to 2 by right click: the view is minimized and can't be activated nowhere by clicking the button, only "maximize" will open it on the current workspace.

@marcusbritanicus
Copy link
Contributor Author

I am missing a few signals from wayfire. For example, I am trying to track the tiled (maximize) signal, but I do not think it is emitted. There are a few other similar issues, I believe. We'll fix it one by one.

@marcusbritanicus
Copy link
Contributor Author

I am missing a few signals from wayfire. For example, I am trying to track the tiled (maximize) signal, but I do not think it is emitted. There are a few other similar issues, I believe. We'll fix it one by one.

Turns out, as usually it does, this was a mistake from my end. The maximize signal is emitted, upon which windowPropertiesChanged(viewId, (int)LXQtTaskBarWindowProperty::State); is emitted. As I understand correctly, once this signal is emitted, getWindowState(viewId) should be called, which I do not see happening. At the moment, I do not know why this is so.

@marcusbritanicus
Copy link
Contributor Author

I am missing a few signals from wayfire. For example, I am trying to track the tiled (maximize) signal, but I do not think it is emitted. There are a few other similar issues, I believe. We'll fix it one by one.

Turns out, as usually it does, this was a mistake from my end. The maximize signal is emitted, upon which windowPropertiesChanged(viewId, (int)LXQtTaskBarWindowProperty::State); is emitted. As I understand correctly, once this signal is emitted, getWindowState(viewId) should be called, which I do not see happening. At the moment, I do not know why this is so.

Again, this was my mistake. Fixed maximize and restore.

@marcusbritanicus
Copy link
Contributor Author

This PR is now ready for review, with one outstanding issue:
Minimize/Restore by clicking on the Task Button does not work as intended.

@tsujan @gfgit I kindly request you both to have a look at my code and suggest if something is amiss. I also request you to help me figure out how we can get the screen names in the desktop switcher plugin.

@stefonarch Feel free to test various scenarios. Please let me know if there is some feature that does not work.

@tsujan
Copy link
Member

tsujan commented May 19, 2025

Yesterday I had time to test it (and, of course, I'll test it again later) and saw some problems:

  • If I opened LXQt file dialog from FeatherPad, it couldn't be minimized by its task-button, but strangely, Show Desktop worked on it.
  • If I switched desktop, all windows that were minimized by Show Desktop were suddenly restored.
  • All windows minimized by Show Desktop were restored if I launched any GUI app.
  • Windows couldn't be moved to other desktops by using their task buttons.

Sorry, I was extremely busy with coding (now too) and so, my tests were short. Also, I don't know if they're fixed by a recent commit of yours or not. I had the latest git wayfire, without an additional patch, so I don't know whether a patch was needed.

@tsujan
Copy link
Member

tsujan commented May 19, 2025

As for the code, I might find and fix problems after merging whenever I encounter them. I did so with both kwin_wayland and wlroots backends. But honestly, due to problems like WayfireWM/wayfire#2600, I'm not sure that I could spend enough time on wayfire.

@marcusbritanicus
Copy link
Contributor Author

If I opened LXQt file dialog from FeatherPad, it couldn't be minimized by its task-button, but strangely, Show Desktop worked on it.

You cannot "minimize" a dialog. Ideally, minimizing a dialog should minimize the whole application. Am I right in assuming that this is where "Transient Windows" concept comes?

If I switched desktop, all windows that were minimized by Show Desktop were suddenly restored.

This is by design (Wayfire design) and not a bug.

All windows minimized by Show Desktop were restored if I launched any GUI app.

Again by design, and not a bug.

Windows couldn't be moved to other desktops by using their task buttons.

I do not know where the code for this resides, but I have a feeling that we'll need to get the screen name for this as well.

But honestly, due to problems like WayfireWM/wayfire#2600, I'm not sure that I could spend enough time on wayfire.

Since I hardly use a menu for cut/copy/paste, I would have never noticed it at all. But let's get it resolved soon.

@tsujan
Copy link
Member

tsujan commented May 19, 2025

You cannot "minimize" a dialog.

Modal dialogs are minimized with their parent windows under labwc. Recently, I corrected some problems about it in our kwin_wayland backend. All in all, this is the expected behavior, IMO.

This is by design (Wayfire design) and not a bug.

Then it's a very bad design, as it's usual with wayfire. Sorry, I prefer to be honest about wayfire's flaws, because I've seen lots of them through years.

Again by design, and not a bug.

Worse ;)

I do not know where the code for this resides…

That's OK. It could be done after merging, whenever it's doable.

@stefonarch
Copy link
Member

Glad to retest, recently moving views to workspaces was broken afaik.

@stefonarch
Copy link
Member

stefonarch commented May 19, 2025

Modal dialogs are minimized with their parent windows under labwc.

Dialogs are minimized and restored here with the widget (there is also a shortcut afaik). Qterminal with preferences and font dialog as well, only the font dialog gets under the preferences dialog when restored.

Edit: oh, you meant directly minimizing dialogs.

@stefonarch
Copy link
Member

stefonarch commented May 19, 2025

My findings:

  1. Move a view to next monitor by taskbar menu item: it appears on the monitor's taskbar only after a move of the view.
  2. "move to workspace" from taskbar menu is broken here (all desktops is working). Am I missing something? It worked before "all desktop" was added.
  3. panel can't be restarted from the session settings (needs alt+k in qps to really stop it)
  4. After "maximize" > restore is not available, still "maximize" active.
  5. Dialogs have no minimize buttons but in the taskbar it can be done, they minimize and restore immediately.

Sometimes 2 windows are marked as active, not sure how I triggered it.

@marcusbritanicus
Copy link
Contributor Author

Move a view to next monitor by taskbar menu item: it appears on the monitor's taskbar only after a move of the view.

Yes, this is a wayfire bug. I have to discuss with @ammen99. For some reason, wayfire ends up emitting "unmap" on that view, and does not emit a "mapped" signal.

"move to workspace" from taskbar menu is broken here (all desktops is working). Am I missing something? It worked before "all desktop" was added.

It works properly on my system, it seems. I'll add a few more debug outputs and then if you give me the output, I'll be able to pinpoint why.. (hopefully)

After "maximize" > restore is not available, still "maximize" active.

This, AFAIK, I fixed in the latest commit. It was a bug in my code.

Sometimes 2 windows are marked as active, not sure how I triggered it.

I am trying to track this down. This may be a LXQt bug - I am not sure. It's something to do with the activeWindowChanged(WId) signal.

If I switched desktop, all windows that were minimized by Show Desktop were suddenly restored.

This is by design (Wayfire design) and not a bug.

Then it's a very bad design, as it's usual with wayfire.

Not really - it's standard policy. You'll see this in case of Plasma as well. You "Show desktop", and then switch workspace, the "Show Desktop" is disabled and the windows are restored.

All windows minimized by Show Desktop were restored if I launched any GUI app.

Again by design, and not a bug.

Worse ;)

Again standard behaviour. You'll see this on plasma as well.

@marcusbritanicus
Copy link
Contributor Author

marcusbritanicus commented May 20, 2025

Move a view to next monitor by taskbar menu item: it appears on the monitor's taskbar only after a move of the view.

Yes, this is a wayfire bug. I have to discuss with @ammen99. For some reason, wayfire ends up emitting "unmap" on that view, and does not emit a "mapped" signal.

Apparently, the "unampped" is not sent on the view. The unmapped is completely unrelated to the view altogether.

Also, on closer look, LXQt Panel lacks a signal to indicate that output of a view has changed. I am planning on adding this signal (viewOutputChanged(QString)) to panel/backends/ilxqtabstractwmiface.h Do let me know if you prefer other name/place for this.

Edit: On second thoughts, I am simply going to emit windowPropertyChanged(...), which seems to do the trick. In some ways, changing an output is similar to changing the geometry of a window.

@marcusbritanicus
Copy link
Contributor Author

@tsujan @stefonarch I have added a few debug statements in the latest commit to help track down this button-based minimize/restore issue. Also, I have added other debug statements so we know what are the events we're receiving from wayfire. That way, we should be able to track down various issues.

A few tips on reading the output. Right after [Slot] ... output is printed, corresponding signal is emitted. For example, [Slot] View minimized ... results in windowStateChanged(...) to be emitted, and so on.

@stefonarch
Copy link
Member

stefonarch commented May 20, 2025

Sorry for the telegram style, wrote it immediately.

Fixed:

  • button is shown immediately in taskbar when moving window to next monitor
  • restore/maximize items correctly activated and working

Issues:

  • Maximize → minimize from menu: restore restores the previous state, not maximized. "restore" does not restore a previous maximized size, also if minimized by window decoration button edit: kwin does the same, I'm not used anymore to minimized windows...
  • Move to desktop 2, not working, move to all desktops, working, qterminal window, nothing is printed afaik

[Slot] Window property changed 47
[Slot] Window property changed 47
[Slot] Window property changed 47
[Slot] Window property changed 47
[Slot] View focused 47
==================================
[Taskbar Group] "qterminal" onActiveChanged 47 true
Button checked true LXQtTaskButton(0x634775b7a970)                                                                  
Group checked true
==================================
[Slot] Window property changed 47
[Slot] Window property changed 47
[Slot] Window property changed 47
[Slot] Window property changed 47
[Slot] Window property changed 47
[Slot] Window property changed 47
[Slot] View focused 47
==================================

[Taskbar Group] "qterminal" onActiveChanged 47 true
Button checked true LXQtTaskButton(0x634775b7a970)
Group checked true
==================================

  • Minimize/raise by taskbar buttons. Starting with active button, 4 clicks needed. After first click button is still active together with next window button, window minimized, second click fix activated state, third click raises, 4th click activates button
======================================
--> button is checked true
minimizeApplication() called
--> minimizing window 47
[Slot] View minimized 47
[Slot] Window property changed 47
[Slot] Window property changed 88
[Slot] View focused 88
==================================
[Taskbar Group] "qterminal" onActiveChanged 88 false
Group checked false
==================================
==================================
[Taskbar Group] "featherpad" onActiveChanged 88 true
Button checked true LXQtTaskButton(0x634776115db0)
Group checked true
==================================
==================================================
--> button is checked true
minimizeApplication() called
--> minimizing window 47
==================================================
--> button is checked false
raiseApplication() called
--> raising window 47
Unminimizing view first 47
[Slot] View minimized 47
[Slot] Window property changed 47
[Slot] Window property changed 88
[Slot] View focused 47
==================================
[Taskbar Group] "qterminal" onActiveChanged 47 true
Button checked true LXQtTaskButton(0x634775b7a970)
Group checked true
==================================
==================================
[Taskbar Group] "featherpad" onActiveChanged 47 false
Group checked false
==================================
Focusing view 47
==================================================
--> button is checked false
raiseApplication() called
--> raising window 47
Focusing view 47

  • always only "previous monitor" available (needs to look in kwin for that)

@marcusbritanicus
Copy link
Contributor Author

Minimize/raise by taskbar buttons. Starting with active button, 4 clicks needed. After first click button is still active together with next window button, window minimized, second click fix activated state, third click raises, 4th click activates button

Unfortunately... I do not know how I can fix this. Starting with the active button, once it's clicked, you know that the window is minimized, and the next view is focused. But the buttons do not seem to reflect this.

I initially thought this might have something to do with the logic in taskbar plugin. But you can see:

[Taskbar Group] "featherpad" onActiveChanged 88 true
Button checked true LXQtTaskButton(0x634776115db0)
Group checked true

The featherpad button is checked: Button checked true LXQtTaskButton(0x634776115db0) The true comes from button->isChecked()

Is there a mechanism elsewhere which changes the button->setChecked(...)? I ask because until the next two clicks, this button does not get "checked". The window on the other hand, is already active.

@stefonarch
Copy link
Member

So reassuming I see 3 issues:

  • the taskbar button not activated
  • send to desktop not working (only me?)
  • panel process not exiting

Any idea when wayfire will be released with the needed commits?

@stefonarch
Copy link
Member

So I've a new laptop, reinstalled the same packages and copied the home folder and but now things have changed for whatever reason:

  1. I can move views to workspace by taskmanager menu now, so fine.
  2. panel process is still an issue
  3. If I select workspace 2 the pager on the second monitor follows to 2 but the workspace is still 1 active (as it should).
    Basically it shows the wrong active workspace on the other monitor when I switch on one monitor, both pagers show the same number always.

@tsujan
Copy link
Member

tsujan commented Jul 16, 2025

@stefonarch
I'll check it later, hopefully before LXQt 2.3.0.

@marcusbritanicus
Please keep up your exceptional work on Wayland; I think I can fix the details afterward (as I did before).

@stefonarch
Copy link
Member

stefonarch commented Jul 16, 2025

I'll check it later, hopefully before LXQt 2.3.0.

= this week ;)

I just noticed that I can't stop the panel from session settings also in niri, so the issue is outside of the backend.

EDIT: hm, I can't stop anything from session settings atm, so ignore for now.

@marcusbritanicus
Copy link
Contributor Author

marcusbritanicus commented Jul 16, 2025

If I select workspace 2 the pager on the second monitor follows to 2 but the workspace is still 1 active (as it should).
Basically it shows the wrong active workspace on the other monitor when I switch on one monitor, both pagers show the same number always.

@tsujan I think you can help me out here. I am out of my depth with the rest of the code. What needs to be done here is we need a way to get the QScreen of the panel. I think I have made suitable provisions, but I am unable to integrate them properly.

Please keep up your exceptional work on Wayland; I think I can fix the details afterward (as I did before).

Thank you so much. :) I have just started my work on ext-workspaces protocol. Let's see how that goes on.

@tsujan
Copy link
Member

tsujan commented Jul 16, 2025

@marcusbritanicus
Don't worry about the rest. You write the main codes, which I can't. We've had this division of jobs implicitly for a while: you do the main job, I deal with small details :)

Since your PRs aren't made against LXQt, sometimes I might need to create other PRs and give you the credit in them —which isn't a problem.

@tsujan
Copy link
Member

tsujan commented Jul 19, 2025

After fixing the app's exit problem with this backend (by using QThread instead of QRunnable), I dealt with the issue in the checked state of buttons.

I initially thought this might have something to do with the logic in taskbar plugin…

@marcusbritanicus
Your initial thought was right :) There was always a flaw in the logic of LXQtTaskButton, but only your Wayfire backend reveals it because it's very fast — perhaps as a result of signaling from a separate thread. On releasing an unchecked button, the window is activated immediately, the button is checked because of that, and then QToolButton::mouseReleaseEvent is called and unchecks it again. The fix was easy and solved at least two problems here, but I should make sure that it doesn't affect the other backends (I think it shouldn't).

BTW, please don't make changes to this PR. I use it as a reference. I'll make another PR based on it with all needed fixes.

@marcusbritanicus
Copy link
Contributor Author

@tsujan It's great that you fixed this problem. I am not planning any changes to this currently. Please make the changes you need to make. I will open new PRs as and when new wayfire features become available.

@tsujan
Copy link
Member

tsujan commented Jul 19, 2025

However, I did not find a proper way to get the screen name in the desktop-switcher plugin, which is why this happens.

I implemented it in the panel's code, and now switchers on different screens don't affect each other.

But there's still a problem. If the user starts the panel on desktop 1 of screen 1, there's no way for the backend to get the desktop of the screen 2, because it only gets the desktop of the active screen.

This doesn't cause a problem on logging in; the problem happens only if the panel is started when the desktops of the screens are different. However, once the switcher is used for the first time, its desktop is corrected. So, IMO, this can be fixed later, in a separate PR.

tsujan added a commit that referenced this pull request Jul 20, 2025
The credit goes to @marcusbritanicus for writing the core code in #2280.

Known issues that may be fixed later in other PRs:

 1. #2280 (comment)
 2. I disabled "Move To Next/Previous Monitor" because it didn't work (the error message was that the method "wsets/send-view-to-wset" wasn't found). I also kept its state contingent on `LXQtTaskBarBackendAction::Move`, which isn't supported by this backend for now.
tsujan added a commit that referenced this pull request Jul 20, 2025
The credit goes to @marcusbritanicus for writing the core code in #2280.

Known issues that may be fixed later in other PRs:

 1. #2280 (comment)
 2. I disabled "Move To Next/Previous Monitor" because it didn't work (the error message was that the method "wsets/send-view-to-wset" wasn't found). I also kept its state contingent on `LXQtTaskBarBackendAction::Move`, which isn't supported by this backend for now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants