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

Reopen GUI window if launcher script is executed a second time. #20

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

Conversation

studersi
Copy link
Contributor

@studersi studersi commented Oct 6, 2015

If the GUI window is closed and the launcher script is executed a second time, a window is opened, but it doesn't connect to the firewall. It stays empty and the firewall rules can't be modified.

I implemented a solution where the script checks if the GUI application is already running. If so, a USR1 signal is sent to that process, telling it to reopen the closed window.

This solves my issue: #18

@studersi
Copy link
Contributor Author

studersi commented Oct 6, 2015

Added the shebang, so it merges without conflicts.

@themighty1
Copy link
Owner

So you have a situation where the GUI app is running and yet it has no systray icon?
What Linux flavor/desktop environment are you on?

@studersi
Copy link
Contributor Author

studersi commented Oct 8, 2015

Yes. I'm running Linux Mint 17.2 with Cinnamon.

When the GUI is launched at startup, the icon is not showing in the system tray.

I think this is due to a race condition. The system tray is probably not available when the GUI is launched. I found a more or less reliable solution to the problem, adding the following lines before the tray icon is created:

while not QSystemTrayIcon.isSystemTrayAvailable():
    time.sleep(1)

@studersi
Copy link
Contributor Author

studersi commented Oct 8, 2015

With this solution the initial problem still remains however. If for example a launcher for ./gui/gui.py is added to the application menu, it would open a new window that is empty (and a second tray icon) instead of reopening the one that was closed.

@licaon-kter
Copy link
Contributor

This will fail with a custom pid file location.

@bash64
Copy link

bash64 commented Apr 7, 2016

In Linux Mint 17.3 Cinnamon 64 bit I avoid this by adding both lpfw and the gui to System Settings->Startup Applications. This causes lpfw and the gui to run everytime I login, however, on a cold boot I do get the Icon in the systray. I give lpfw a startup delay of 0 secs and the gui a delay of 5 secs. Doesn't seem to be effected by a logout/login.

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.

4 participants