-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Adjusted behavior of system tray icon #99
base: master
Are you sure you want to change the base?
Conversation
… is closed. Fixed unguarded ifs which avoids tray icon being created multiple times
I think we can take this further by adjusting the quitting behavior of the application. If system tray is enabled: If system tray is disabled: Right now, I'm not seeing a user-accessible way to surrender control back from tuxclockerd, because there is not a way to close it as designed currently. |
Great to see contributions here, cheers for that!
This is very much needed. It's super annoying to have an app nag you every time you close it.
Quitting the UI should not quit the daemon. Users should be able to run the UI, modify the daemon as required, leave the daemon running and functioning, and exit the UI to preserve resources - or, if the tray is enabled - minimise the UI to the tray to improve UX. Closing the UI means "I am done configuring the daemon" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logic changes look good, otherwise want some clarifications
// if the tray icon is active, hide the application instead of closing it | ||
|
||
if (m_trayIcon && m_trayIcon->isVisible()) { | ||
QMessageBox::information(this, tr("TuxClocker"), | ||
tr("TuxClocker will continue to run " | ||
"in the background. To completely " | ||
"exit the application, choose <b><u>Q</u>uit</b> " | ||
"from the system tray icon")); | ||
hide(); | ||
event->ignore(); | ||
return; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure we need this, since using the tray isn't the default, and we inform the user about this behavior with a tooltip in the settings too
auto show = new QAction{_("&Maximize TuxClocker"), this}; | ||
auto show = new QAction{_("&Show TuxClocker"), this}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this needs changing, I think Maximize/Hide is clear enough, and translations would need to be changed
hide(); | ||
event->ignore(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The window is already hidden in this condition, unless I'm missing something
@@ -104,27 +104,34 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { | |||
|
|||
void MainWindow::setTrayIconEnabled(bool enable) { | |||
if (enable) { | |||
if (!m_trayIcon) | |||
// This seems to make the main window not close during closeEvent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove the comment?
} | ||
// Remove tray icon |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
=||=
We don't want to do this unconditionally, since there may be other users of If we want a way to terminate |
Hello! I found your project recently, and I love it! I hope I can help contribute to its greatness with this change!
Most applications that I use which have a system tray behave as such: If the user exits the application, they either 1) inform the user that the application will continue in the background, and hide themselves or 2) hide themselves with no message.
I've adjusted the tray icon behavior to fit this 'standard'. I also fixed a couple places where if statements were unguarded, which led to a segfault sometimes if you saved the settings menu without changing anything.
I added a new button to the system tray to hide the window, as well as a popup that informs about the application hiding itself. This popup could be removed, or maybe adjusted to ask the user if they meant to close the application, maybe a checkbox to remember the setting so the window doesn't open each time the application is closed.
I hope you like it! Thanks for making this awesome application!
Related to #97