Skip to content

Commit eb7ab37

Browse files
committed
add option to manage flash/bounce icon on new messages
1 parent f52bdae commit eb7ab37

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

src/ui/dispatcher.coffee

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ handle 'forcecustomsound', (value) ->
157157
handle 'showiconnotification', (value) ->
158158
viewstate.setShowIconNotification(value)
159159

160+
handle 'bouncyicon', (value) ->
161+
viewstate.setBouncyIcon(value)
162+
160163
handle 'mutesoundnotification', ->
161164
viewstate.setMuteSoundNotification(not viewstate.muteSoundNotification)
162165

src/ui/models/viewstate.coffee

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ module.exports = exp = {
4242
closetotray: tryparse(localStorage.closetotray) or false
4343
showDockOnce: true
4444
showIconNotification: tryparse(localStorage.showIconNotification) ? true
45+
bouncyIcon: tryparse(localStorage.bouncyIcon) ? true
4546
muteSoundNotification: tryparse(localStorage.muteSoundNotification) ? false
4647
forceCustomSound: tryparse(localStorage.forceCustomSound) ? false
4748
language: localStorage.language ? 'en'
@@ -256,6 +257,11 @@ module.exports = exp = {
256257
@forceCustomSound = localStorage.forceCustomSound = doshow
257258
updated 'viewstate'
258259

260+
setBouncyIcon: (doshow) ->
261+
return if localStorage.bouncyIcon == doshow
262+
@bouncyIcon = localStorage.bouncyIcon = doshow
263+
updated 'viewstate'
264+
259265
setShowIconNotification: (doshow) ->
260266
return if localStorage.showIconNotification == doshow
261267
@showIconNotification = localStorage.showIconNotification = doshow

src/ui/views/menu.coffee

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,13 +199,15 @@ templateView = (viewstate) ->
199199
checked: viewstate.showPopUpNotifications
200200
enabled: viewstate.loggedin
201201
click: (it) -> action 'showpopupnotifications', it.checked
202-
}, {
202+
}
203+
{
203204
type: 'checkbox'
204205
label: i18n.__('menu.view.notification.message:Show message in notifications')
205206
checked: viewstate.showMessageInNotification
206207
enabled: viewstate.loggedin && viewstate.showPopUpNotifications
207208
click: (it) -> action 'showmessageinnotification', it.checked
208-
}, {
209+
}
210+
{
209211
type: 'checkbox'
210212
label: i18n.__('menu.view.notification.username:Show username in notifications')
211213
checked: viewstate.showUsernameInNotification
@@ -234,6 +236,13 @@ templateView = (viewstate) ->
234236
enabled: viewstate.loggedin && viewstate.showPopUpNotifications && !viewstate.muteSoundNotification
235237
click: (it) -> action 'forcecustomsound', it.checked
236238
} if notifierSupportsSound
239+
{
240+
type: 'checkbox'
241+
label: i18n.__('menu.view.notification.bouncyIcon:Bounce/flash icon on new messages')
242+
checked: viewstate.bouncyIcon
243+
enabled: viewstate.loggedin
244+
click: (it) -> action 'bouncyicon', it.checked
245+
}
237246
].filter (n) -> n != undefined
238247
}
239248
{

src/ui/views/notifications.coffee

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ module.exports = (models) ->
109109
# if not mainWindow.isVisible()
110110
# mainWindow.showInactive()
111111
# mainWindow.minimize()
112-
mainWindow.flashFrame(true) # uncommented in #1206
112+
if viewstate.bouncyIcon
113+
mainWindow.flashFrame(true) # uncommented in #1206
113114

114115
textMessage = (cont, proxied, showMessage = true) ->
115116
if cont?.segment?

0 commit comments

Comments
 (0)