Page MenuHomePhabricator

D5633.diff
No OneTemporary

D5633.diff

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

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)

Event Timeline