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

Kando appears behind full-screen applications on Linux #620

Closed
LucaBoschetto opened this issue Sep 17, 2024 · 14 comments
Closed

Kando appears behind full-screen applications on Linux #620

LucaBoschetto opened this issue Sep 17, 2024 · 14 comments
Assignees
Labels
bug Something isn't working Cinnamon This affects Cinnamon only Linux This affects Kando on Linux

Comments

@LucaBoschetto
Copy link
Contributor

LucaBoschetto commented Sep 17, 2024

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.

@LucaBoschetto LucaBoschetto added the bug Something isn't working label Sep 17, 2024
@Schneegans
Copy link
Contributor

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: electron/electron#12445
Maybe it's a know bug?

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

@Schneegans Schneegans added Linux This affects Kando on Linux Cinnamon This affects Cinnamon only labels Sep 17, 2024
@LucaBoschetto
Copy link
Contributor Author

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
Copy link
Contributor Author

Just to add some info to the issue:

  • I restarted the session explicitly selecting GNOME as the DE instead of Cinnamon, and indeed it did not show the issue;
  • I restarted the session in the native Ubuntu:GNOME mode, and the issue did show. 🤔

@Schneegans
Copy link
Contributor

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

I also tried this possible solution: no success.

@Schneegans
Copy link
Contributor

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
Copy link
Contributor Author

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
Copy link
Contributor

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
Copy link
Contributor Author

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
Copy link
Contributor

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?

@LucaBoschetto
Copy link
Contributor Author

Sorry, I stand corrected: whether I set type: 'normal' directly here, or I do it through the backend, it still creates the same problem: just for one of the 3 monitors, Kando shows on another one.

I'm trying to investigate it a little bit, but I'm not a TypeScript/Electron developer, so I don't know if I can find anything. Will let you know.

@LucaBoschetto
Copy link
Contributor Author

Sorry: I couldn't find where the coordinates of the Kando window get set upon triggering.

I created the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Cinnamon This affects Cinnamon only Linux This affects Kando on Linux
Projects
None yet
Development

No branches or pull requests

2 participants