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

draft: set a new icon icon when there are new messages #16

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

hydrargyrum
Copy link
Contributor

the new icon is shown:

  • on startup, if there are notifications
  • when new messages are received

the "new messages" icon is cleared when the main window is displayed

the icon is ugly and my implementation is not optimal i believe, but it's a draft to first discuss the idea to have your opinion

the new icon is shown:
- on startup, if there are notifications
- when new messages are received

the "new messages" icon is cleared when the main window is displayed
@seird
Copy link
Owner

seird commented Oct 11, 2022

this is a great idea, thanks!

i see an issue when the window is opened, but not in focus and then a new message comes in. When you switch to the main window (alt-tab or just clicking on it), the tray icon will not be cleared.
To fix that i would add an event filter to the main window, which sends a signal when the window gets activated, without having to care which action caused it:

def eventFilter(self, object: QtCore.QObject, event: QtCore.QEvent) -> bool:
        if event.type() == QtCore.QEvent.Type.WindowActivate:
            self.activated.emit()

        return super().eventFilter(object, event)

and then in MainApplication remove the self.tray.discard_icon_unread() and replace them with a single self.main_window.activated.connect(self.tray.discard_icon_unread).

@seird
Copy link
Owner

seird commented Oct 11, 2022

the icon is ugly and my implementation is not optimal i believe, but it's a draft to first discuss the idea to have your opinion

the icon looks fine to me, very subtle. the red makes good contrast but also makes me think "something went wrong"..

@hydrargyrum
Copy link
Contributor Author

Regarding the icon: if the red looks too aggressive, we could change it to green. But I think an additional visual clue (different than color) would be useful, typically for the colorblind. Maybe a little "badge", like on android notifications, a little circle covering the icon to indicate "there's new stuff".

Regarding the "unread" itself, I'm not sure if I plugged in the right place (in new_message_callback), it also covers messages sent when gotify tray was not run, I don't know if that's desired (I think it is useful, but don't know your opinion).

@seird
Copy link
Owner

seird commented Oct 13, 2022

Regarding the "unread" itself, I'm not sure if I plugged in the right place (in new_message_callback), it also covers messages sent when gotify tray was not run, I don't know if that's desired (I think it is useful, but don't know your opinion).

This part still needs some work. As it is, the unread icon is always shown on startup if there are any messages, not necessarily unread ones.

The issue isn't so much where it's plugged in, rather that we need to keep track of the last "viewed" message.

Right now, I keep track of the last "received" message (settings.value("message/last", type=int)), for the purpose of showing missed notifications on reconnect. Probably need to do something similar to this.

But I think an additional visual clue (different than color) would be useful, typically for the colorblind. Maybe a little "badge", like on android notifications, a little circle covering the icon to indicate "there's new stuff".

How about just color the body instead so it's consistent with the other states? Then just add a unread badge to it, and maybe a exclamation point for the tray-error icon? Or, if you're more artistically inclined than me, only show the envelope when there's a new message.

tray
tray-error
tray-unread-green

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.

None yet

2 participants