Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

feat(macos): add optional Dock visibility in Electron

Sean Ferguson0a80d50cc137
diff --git a/apps/desktop/src/main/dock.ts b/apps/desktop/src/main/dock.ts
new file mode 100644
index 00000000..9dfbf0ae
--- /dev/null
+++ b/apps/desktop/src/main/dock.ts
@@ -0,0 +1,16 @@
+import { app } from 'electron'
+import { prefs } from './host-controller'
+
+export const showInDock = () => prefs.get('showInDock') === true
+
+export function setShowInDock(on: boolean) {
+ prefs.set('showInDock', on)
+ applyDockVisibility()
+ return showInDock()
+}
+
+export function applyDockVisibility() {
+ if (process.platform !== 'darwin') return
+ if (showInDock()) void app.dock?.show()
+ else app.dock?.hide()
+}
diff --git a/apps/desktop/src/main/index.ts b/apps/desktop/src/main/index.ts
index b76b5889..307fcb38 100644
--- a/apps/desktop/src/main/index.ts
+++ b/apps/desktop/src/main/index.ts
@@ -7,6 +7,7 @@ import { devPort, fetchHealth, HostController } from './host-controller'
import { registerHostProxy } from './host-proxy'
import { readClipboardFiles, readFiles } from './files'
import { Tray } from './tray'
+import { applyDockVisibility, setShowInDock, showInDock } from './dock'
import { AccountService } from './account'
import { Updates } from './updates'
import { handleURL, registerAuthIPC, registerSchemes, urlFromArgv } from './auth'
@@ -164,6 +165,12 @@ function registerIPC(tray: Tray) {
ipcMain.on('app:traySummary', (_e, summary) => tray.update(summary))
ipcMain.on('app:openPairing', () => openPairing())
ipcMain.on('app:quit', () => app.quit())
+ ipcMain.handle('app:showInDock', () => showInDock())
+ ipcMain.handle('app:setShowInDock', (_e, on: boolean) => {
+ const visible = setShowInDock(on)
+ tray.hostChanged()
+ return visible
+ })
ipcMain.handle('app:launchAtLogin', () => app.getLoginItemSettings().openAtLogin)
ipcMain.handle('app:setLaunchAtLogin', (_e, on: boolean) => {
app.setLoginItemSettings({ openAtLogin: on })
@@ -205,6 +212,7 @@ if (!app.requestSingleInstanceLock()) {
// Packaged builds take the icon from the bundle (resources/AppIcon.icon); a development run
// would otherwise show Electron's.
if (isMac && !app.isPackaged) app.dock?.setIcon(join(__dirname, '../../resources/icon.png'))
+ applyDockVisibility()
const tray = new Tray({ openChat, openPairing, send, host, updates })
updates.on('change', () => tray.hostChanged())
registerIPC(tray)
diff --git a/apps/desktop/src/main/tray.ts b/apps/desktop/src/main/tray.ts
index f376225f..500db553 100644
--- a/apps/desktop/src/main/tray.ts
+++ b/apps/desktop/src/main/tray.ts
@@ -3,6 +3,7 @@ import { app, clipboard, Menu, nativeImage, shell, Tray as ElectronTray } from '
import type { TraySummary, WindowCommand } from '../shared/ipc'
import type { HostController } from './host-controller'
import type { Updates } from './updates'
+import { setShowInDock, showInDock } from './dock'
interface Deps {
openChat: () => unknown
@@ -202,6 +203,7 @@ export class Tray {
this.rebuild()
},
},
+ ...(process.platform === 'darwin' ? [{ label: 'Show in Dock', type: 'checkbox' as const, checked: showInDock(), click: () => { setShowInDock(!showInDock()); this.rebuild() } }] : []),
{ type: 'separator' },
{ label: 'Updates', submenu: this.updatesMenu() },
{ type: 'separator' },
diff --git a/apps/desktop/src/preload/index.ts b/apps/desktop/src/preload/index.ts
index 0dd51f49..c6fc20c1 100644
--- a/apps/desktop/src/preload/index.ts
+++ b/apps/desktop/src/preload/index.ts
@@ -84,6 +84,8 @@ const bridge: CodyncBridge = {
quit: () => ipcRenderer.send('app:quit'),
resetAllData: () => ipcRenderer.invoke('app:resetAllData'),
setLaunchAtLogin: (on) => ipcRenderer.invoke('app:setLaunchAtLogin', on),
+ showInDock: () => ipcRenderer.invoke('app:showInDock'),
+ setShowInDock: (on) => ipcRenderer.invoke('app:setShowInDock', on),
launchAtLogin: () => ipcRenderer.invoke('app:launchAtLogin'),
openSettings: (url) => ipcRenderer.send('app:openSettings', url),
authenticate: (url, scheme) => ipcRenderer.invoke('app:authenticate', url, scheme),
diff --git a/apps/desktop/src/renderer/views/settings/SettingsView.tsx b/apps/desktop/src/renderer/views/settings/SettingsView.tsx
index ee22c531..bec2128c 100644
--- a/apps/desktop/src/renderer/views/settings/SettingsView.tsx
+++ b/apps/desktop/src/renderer/views/settings/SettingsView.tsx
@@ -99,6 +99,8 @@ function GeneralSettings() {
const [textSize, setTextSize] = usePref(prefs.textSize)
const [usageIconStyle, setUsageIconStyle] = usePref(prefs.usageIconStyle)
const [compact, setCompact] = usePref(prefs.sidebarCompact)
+ const [showInDock, setShowInDock] = useState(false)
+ useEffect(() => void window.codync.app.showInDock().then(setShowInDock), [])
const [launchAtLogin, setLaunchAtLogin] = useState(false)
useEffect(() => void window.codync.app.launchAtLogin().then(setLaunchAtLogin), [])
@@ -147,6 +149,7 @@ function GeneralSettings() {
</Switch>
</CardSection>
<CardSection title="System">
+ {window.codync.platform === 'darwin' ? <Switch on={showInDock} onChange={(on) => void window.codync.app.setShowInDock(on).then(setShowInDock)}>Show in Dock</Switch> : null}
<Switch on={launchAtLogin} onChange={(on) => void window.codync.app.setLaunchAtLogin(on).then(setLaunchAtLogin)}>
Open at login
</Switch>
diff --git a/apps/desktop/src/shared/ipc.ts b/apps/desktop/src/shared/ipc.ts
index a2570a91..68daea65 100644
--- a/apps/desktop/src/shared/ipc.ts
+++ b/apps/desktop/src/shared/ipc.ts
@@ -162,6 +162,8 @@ export interface CodyncBridge {
quit(): void
resetAllData(): Promise<void>
setLaunchAtLogin(on: boolean): Promise<boolean>
+ showInDock(): Promise<boolean>
+ setShowInDock(on: boolean): Promise<boolean>
launchAtLogin(): Promise<boolean>
openSettings(url: string): void
/**