Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3511894
D5633.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D5633.diff
View Options
diff --git a/desktop/main.cjs b/desktop/main.cjs
--- a/desktop/main.cjs
+++ b/desktop/main.cjs
@@ -128,6 +128,10 @@
}
});
+ ipcMain.on('set-badge', (event, value) => {
+ app.dock.setBadge(value?.toString() ?? '');
+ });
+
win.webContents.setWindowOpenHandler(({ url: openURL }) => {
shell.openExternal(openURL);
// Returning 'deny' prevents a new electron window from being created
diff --git a/desktop/preload.cjs b/desktop/preload.cjs
--- a/desktop/preload.cjs
+++ b/desktop/preload.cjs
@@ -8,6 +8,7 @@
},
clearHistory: () => ipcRenderer.send('clear-history'),
doubleClickTopBar: () => ipcRenderer.send('double-click-top-bar'),
+ setBadge: value => ipcRenderer.send('set-badge', value),
};
contextBridge.exposeInMainWorld('electronContextBridge', bridge);
diff --git a/web/app.react.js b/web/app.react.js
--- a/web/app.react.js
+++ b/web/app.react.js
@@ -274,6 +274,7 @@
const boundUnreadCount = useSelector(unreadCount);
React.useEffect(() => {
document.title = getTitle(boundUnreadCount);
+ electron?.setBadge(boundUnreadCount === 0 ? null : boundUnreadCount);
}, [boundUnreadCount]);
const dispatch = useDispatch();
diff --git a/web/electron.js b/web/electron.js
--- a/web/electron.js
+++ b/web/electron.js
@@ -12,6 +12,7 @@
+onNavigate: OnNavigateListener => () => void,
+clearHistory: () => void,
+doubleClickTopBar: () => void,
+ +setBadge: (value: string | number | null) => void,
} = typeof electronContextBridge === 'undefined' ? null : electronContextBridge;
export default electron;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 22, 5:17 PM (13 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2691958
Default Alt Text
D5633.diff (1 KB)
Attached To
Mode
D5633: [desktop] Notification badge
Attached
Detach File
Event Timeline
Log In to Comment