kando-menu / kando

🥧 The Cross-Platform Pie Menu.
https://ko-fi.com/post/Kando-1-0-0-released-G2G5Z1DOS
Other
2.5k stars 75 forks source link

Kando appears behind full-screen applications on Linux #620

Open LucaBoschetto opened 1 week ago

LucaBoschetto commented 1 week ago

Short Summary

When triggered on a screen where a full-screen application is running, Kando does not show. Triggering full-screen off on the application shows that Kando was running behind it.

Tried so far with Firefox and Xournal++.

Steps to Reproduce the Issue

  1. Launch Kando
  2. Open Firefox or Xournal++ and toggle full-screen on (F11 or from the menu)
  3. Trigger Kando menu (Ctrl+Space)
  4. Kando does not show
  5. Toggle full-screen off on the application in the foreground
  6. Kando becomes visible without re-triggering it

Kando Version

v1.4.0

Installation Method

Via a package manger

Desktop Environment

Linux

Environment Version

Linux Mint 21.3, kernel 5.15.0-121, DE: Cinnamon 6.0.4

Additional Information

I believe this to be similar, but not identical, to issue #522. Main difference: it opens behind the app, not on another desktop.

Schneegans commented 1 week ago

Hi there! Thanks for the report. I currently do not have a Cinnamon installation around for reproducing this. On GNOME, I cannot observe the issue.

This could either be an issue of Cinnamon or of Electron. Kando sets its window to be "Always on Top". Maybe Cinnamon does not respect this? Also, Cinnamon has Fullscreen Unredirecting enabled per default, I think. This prevents compositing if there is a fullscreen window. There should be a checkbox for this somewhere in the settings. Maybe you can try disabling that?

There is also a not-really-resolved issue in Electron: https://github.com/electron/electron/issues/12445 Maybe it's a know bug?

If you would install Kando from source, you could try some things. Maybe we find a workaround...

LucaBoschetto commented 6 days ago

Hi Simon! No, thank you for this beautiful app!

I disabled unredirecting, but it didn't solve the issue, so that one probably is not the cause.

I don't know anything about Electron, so I can't help with that, but at least it seems that in that thread they talk about a possible workaround?

I reinstalled Kando from source, and the issue is still there, so I am ready to try anything you can throw at me. 😊

Note: in order to make it run, besides your instructions on how to run it from source, I also had to:

npm i --save-dev @types/node
npm install events --save
LucaBoschetto commented 6 days ago

Just to add some info to the issue:

Schneegans commented 3 days ago

Btw, have you tried whether other windows are shown above full-screen windows if they are set to be "always on top"? I think you can enable this via a right-click on the title bar.

Currently, this property is set here in Kando. You could experiment by setting this somewhere else. Maybe here after the window has been shown or maybe even here after it got focused for GNOME Shell.

Does this change anything?

LucaBoschetto commented 3 days ago

Other windows will show on top of full-screen windows, whether or not I set "Always on Top" for them: as soon as I focus them, they come on top. For this reason, I don't believe that it can be solved by calling setAlwaysOnTop(true, 'screen-saver');.

Despite that, I tried adding it anyway in both places you suggested: after this.window.show(); and after this.window.focus(); but it didn't solve the issue.

Just as a test, besides 'screen-saver' I also tried 'normal', 'modal-panel', 'pop-up-menu', 'floating'.

LucaBoschetto commented 2 days ago

JFYI: I also tried some external ways to force Kando's window on top:

wmctrl -r "Kando" -b add,above
wmctrl -x -r "kando.kando" -b add,above
wmctrl -i -r <window_id> -b add,above
xprop -id <window_id> -f _NET_WM_STATE 32a -set _NET_WM_STATE _NET_WM_STATE_ABOVE

and I also tried using devilspie to intercept Kando's window creation and move it on top. None of these worked.

LucaBoschetto commented 2 days ago

I also tried this possible solution: no success.

Schneegans commented 1 day ago

That's weird. I guess you could experiment with the window properties around here.

If - for instance - you use the following, Kando will open in a pretty ordinary window. Not in fullscreen, with a border, and with window controls:

this.window = new BrowserWindow({
  webPreferences: {
    contextIsolation: true,
    sandbox: true,
    webSecurity: process.env.NODE_ENV !== 'development',
    preload: MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY,
  },
  transparent: false,
  resizable: true,
  skipTaskbar: false,
  frame: true,
  hasShadow: true,
  type: 'normal',
  show: false,
});

Is this window now always on top?

LucaBoschetto commented 1 day ago

Yes: with these changes, the Kando window appears on top of full-screen windows.

Actually, tweaking with all the properties of the BrowserWindow, I found out that just changing

type: this.backend.getBackendInfo().windowType,

to

type: 'normal',

on this line, and nothing else, solved the problem.

Schneegans commented 18 hours ago

Cool! On GNOME, type 'dock' prevents the Kando window from having open and close animations. Also, it is not shown in the overview. On KDE, the type 'toolbar' provides the best results.

If on Cinnamon 'normal' is the best, we should create a new backend for Cinnamon. Do you want to do this? It will be very easy. Simple copy the KDEX11Backend, rename it to CinnamonBackend, and put it into a new directory in the linux backends.

Finally, you'll need to use the backend somewhere here, similar to how the KDE X11 backend is used.

LucaBoschetto commented 5 hours ago

I did it.

Unfortunately, it seems that another problem came up: with the new backend, when the mouse is on one of my 3 screens, the Kando menu appears on another one.

This doesn't happen when I just set type: 'normal' in new BrowserWindow in app.ts. I can't understand why, I didn't modify anything else.

Schneegans commented 5 hours ago

Well, the backend should only modify the window type... Maybe you can simply create a pull request and I see if I spot any potential issues?