-
Notifications
You must be signed in to change notification settings - Fork 277
fix: icon color when idle #2266
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,33 +165,26 @@ app.whenReady().then(async () => { | |
EVENTS.USE_UNREAD_ACTIVE_ICON, | ||
(_, useUnreadActiveIcon: boolean) => { | ||
shouldUseUnreadActiveIcon = useUnreadActiveIcon; | ||
|
||
if (shouldUseUnreadActiveIcon) { | ||
setActiveIcon(); | ||
} else { | ||
setIdleIcon(); | ||
} | ||
}, | ||
); | ||
|
||
onMainEvent(EVENTS.ICON_ERROR, () => { | ||
onMainEvent(EVENTS.UPDATE_ICON_COLOR, (_, notificationsCount: number) => { | ||
if (!mb.tray.isDestroyed()) { | ||
mb.tray.setImage(TrayIcons.error); | ||
} | ||
}); | ||
if (notificationsCount < 0) { | ||
setErrorIcon(); | ||
return; | ||
} | ||
|
||
onMainEvent(EVENTS.ICON_ACTIVE, () => { | ||
if (!mb.tray.isDestroyed() && shouldUseUnreadActiveIcon) { | ||
} | ||
}); | ||
if (notificationsCount > 0) { | ||
setActiveIcon(); | ||
return; | ||
} | ||
|
||
onMainEvent(EVENTS.ICON_IDLE, () => { | ||
if (!mb.tray.isDestroyed()) { | ||
setIdleIcon(); | ||
} | ||
}); | ||
Comment on lines
-177
to
185
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a naive quick skim of this code; but the logic around Might just be the diff making things look more confusing; but currently it sort of looks like the error icon will be used if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, nevermind. Reading through the rest of it I see that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for taking a look. That's correct, at the moment a negative number is used to flag that the app is in error state. Some further room for improvement |
||
|
||
onMainEvent(EVENTS.UPDATE_TITLE, (_, title: string) => { | ||
onMainEvent(EVENTS.UPDATE_ICON_TITLE, (_, title: string) => { | ||
if (!mb.tray.isDestroyed()) { | ||
mb.tray.setTitle(title); | ||
} | ||
|
@@ -256,14 +249,6 @@ const handleURL = (url: string) => { | |
} | ||
}; | ||
|
||
function setActiveIcon() { | ||
mb.tray.setImage( | ||
menuBuilder.isUpdateAvailable() | ||
? TrayIcons.activeWithUpdate | ||
: TrayIcons.active, | ||
); | ||
} | ||
|
||
function setIdleIcon() { | ||
if (shouldUseAlternateIdleIcon) { | ||
mb.tray.setImage( | ||
|
@@ -279,3 +264,19 @@ function setIdleIcon() { | |
); | ||
} | ||
} | ||
|
||
function setActiveIcon() { | ||
if (shouldUseUnreadActiveIcon) { | ||
mb.tray.setImage( | ||
menuBuilder.isUpdateAvailable() | ||
? TrayIcons.activeWithUpdate | ||
: TrayIcons.active, | ||
); | ||
} else { | ||
setIdleIcon(); | ||
} | ||
} | ||
|
||
function setErrorIcon() { | ||
mb.tray.setImage(TrayIcons.error); | ||
} |
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.
Was the downgrade intentional?
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.
Yep, timing issue