evilsocket / opensnitch

OpenSnitch is a GNU/Linux interactive application firewall inspired by Little Snitch.
GNU General Public License v3.0
9.88k stars 490 forks source link

Pop-up window gets behind the opened programs (Wayland) #796

Open Danny3 opened 1 year ago

Danny3 commented 1 year ago

Hello!

Describe the bug Pop-up window gets behind the opened programs

Include the following information:

Steps to reproduce the behavior:

  1. If Opensnitch is no freshly instlled delete any rules about KDE's Discover or Qbittorrent
  2. Open Discover or Qbittorrent, which will atumatically do some connections triggering the Pop-up window of OpenSnitc to appear

Expected behavior (optional) I expected the Po-up window to create a new rule to appear and it appears correctly, but it appears so fast that Discover or Qbittorrent, which appear later are covering it completely when they appear as the appear more in foreground than it. Because of this I have to minimize Discover or Qbittorrent, click on the Allow or Deny button and then unminimize them to start doing what I wanted with them. It's ok that pop-up window appears so fast, I wouldn't want it slower or delayed so I guess it's normal that it's covered by a program that opens up later, but I wish the pop-up windows would have a rule or something to stay above the program that triggered it so I can just click on one of its button and get by to the programs that I opened, without having to do the minimize / unminimize thing.

Additional context I remember I have seen this problem with other programs too.

And there might be even more problematic to decide on Allow or Deny because, for example Kodi and games open up in fullscreen, so there's no minimize button to quickly get that out of the way to see the pop-up window. In Kodi you have to either quit it or press the "/" to get into its windowed mode, if you know about this shortcut, then minimize it or move it, press Allow | Deny and come back to Kodi and press the "/" to get back into fullscreen.

With games I assume you have to quit it or alt tab it, I'm not sure now as I don't have any game installed to test.

And there's another case with mixed results, for Stellarium:

  1. After starting Stellarium, it's loading pop-up appears.
  2. Then Open'snitch's pop-up over it, which is great.
  3. Then, whe Steallarium is finishes loading, if you haven't already decided to allow it or not, it it opens as full screen covering OpenSnitch's pop-up window and then you can't decide anymore unless you quit it to see the pop-up window again.

So, if you find a way to make the pop-up window show on top of everything or even better on top of the program that triggered it, it would be great for usability.

Another thing that wold be great for usability is that, when a pop-up window appears in the background behind a full screen movie, game, etc, a short optional sound to be played to hear that a pop-up is waiting for you. Maybe some people would like to enable that. In some case, like when not playing or watching with somebody else, a game or a movie can be paused and the pop-up window be taken care of. It happened to me to now know that pop-up appeared to allow something until I have finished and exited a game. But at the same time I would not want a pop-up in front of a game or movie that I'm playing.

Not sure if this is helpful or not:

https://forum.qt.io/topic/1368/solved-how-to-make-always-top-window https://amin-ahmadi.com/2016/06/20/how-to-make-your-window-stay-always-on-top/

Thank you!

gustavo-iniguez-goya commented 1 year ago

The pop-ups have the sticky flag to be above all other windows. The problem is on Wayland. On Fedora 37 I've realized that this flag is not set.

Could you launch the GUI as follow and try to reproduce it? $ QT_QPA_PLATFORM=xcb opensnitch-ui

gustavo-iniguez-goya commented 1 year ago

Regarding moving a window on Wayland (spoiler: not supported, although on Manjaro+Wayland+KDE seems to work partially, due to PyQt5 version maybe):

https://gitlab.freedesktop.org/wayland/wayland/-/issues/110 https://lists.freedesktop.org/archives/wayland-devel/2015-September/024410.html

Simple example:

import sys
from PyQt5.QtWidgets import QApplication, QDialog, QLabel, QDesktopWidget
from PyQt5.QtCore import Qt, QSize

app = QApplication(sys.argv)
d = QDialog()
d.setModal(True)
# right click on the title bar, and check if [x] Stay on top is checked on Wayland.
d.setWindowFlags(Qt.WindowStaysOnTopHint)

d.resize(QSize(400, 400))

# move() not supported on Wayland
# pos = QDesktopWidget().availableGeometry()
# d.move(pos.bottomRight())

QLabel('OpenSnitch rlz', d)
d.show()
sys.exit(app.exec_())
Danny3 commented 1 year ago

The pop-ups have the sticky flag to be above all other windows. The problem is on Wayland. On Fedora 37 I've realized that this flag is not set.

Could you launch the GUI as follow and try to reproduce it? $ QT_QPA_PLATFORM=xcb opensnitch-ui

I'm testing on Debian 12 + unstable repository and latest version of KDE Plasma, Frameworks, on Wayland.

I exited the UI and started it again from the command line as you said and it works great with Discover and Qbittorrent.

In both cases the OpenSnitch's pop-up appears first like before and when Discover and Qbittorrent fully load they remain in background and not cover OpenSnitch pop-up anymore, exactly as I wanted it.

Where it still doesn't work and probably nothing could be done about it is Stellarium where it goes like this:

  1. Click on Stelarium in start menu to open it and its loading pop-up appears showing that it's loading its resources
  2. OpenSnitch's pop-up window appears on top of that, as expected.
  3. When Stellarium fully loads its pop-up window behind OpenSnitch's one disappears and a fullscreen layout appears covering OpenSnitch's pop-up window.

And since I don't know how to make it windowed like in Kodi, I have to close it to get it out of the way so I can choose an action in OpenSnitch's pop-up.

Now that I reminded myself about Kodi I have tested it there too and strangely even though Kodi open in full screen mode too, similar to Stellarium, there OpenSnitch's pop-up windows stays on top until ou click one of the two buttons, which makes it diappear and then Kodi gets focused as expected.

So Stellarium is the only one that still doesn't play nice.

While both Stellarium and Kodi seem similar how they open in full screen, AFAIK, Stelarium is based on Qt, while Kodi is no, the difference might still be from there.

Seeing the splash screen before Stellarium starts I rembered that Qbittorrent had something like this too in the beginning and it's still there to activtate it if you want and I did it to make it more similar in behavior to Stellarium and to see if this has anything to do with the strange behavior in Stellarium and it doesn't.

OpenSnitch's pop-up keeps staying on top after Qbittorrent has been fully loaded even with its splash screen appearing at the beginning like for Stellarium.

So, without this Stellarium exceptions I think this environment variable being set before the UI is opened works great and solves the problem.

tavoda commented 1 year ago

And since I don't know how to make it windowed ALT + TAB?