Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions apps/desktop/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ syncShellEnvironment();
const PICK_FOLDER_CHANNEL = "desktop:pick-folder";
const CONFIRM_CHANNEL = "desktop:confirm";
const SET_THEME_CHANNEL = "desktop:set-theme";
const SET_WINDOW_OPACITY_CHANNEL = "desktop:set-window-opacity";
const SET_SIDEBAR_OPACITY_CHANNEL = "desktop:set-sidebar-opacity";
const CONTEXT_MENU_CHANNEL = "desktop:context-menu";
const OPEN_EXTERNAL_CHANNEL = "desktop:open-external";
Expand Down Expand Up @@ -1160,16 +1159,6 @@ function registerIpcHandlers(): void {
nativeTheme.themeSource = theme;
});

ipcMain.removeHandler(SET_WINDOW_OPACITY_CHANNEL);
ipcMain.handle(SET_WINDOW_OPACITY_CHANNEL, async (event, rawOpacity: unknown) => {
if (typeof rawOpacity !== "number" || !Number.isFinite(rawOpacity)) return;
const opacity = Math.max(0.3, Math.min(1, rawOpacity));
const window = BrowserWindow.fromWebContents(event.sender);
if (window) {
window.setOpacity(opacity);
}
});

ipcMain.removeHandler(SET_SIDEBAR_OPACITY_CHANNEL);
ipcMain.handle(SET_SIDEBAR_OPACITY_CHANNEL, async (_event, _rawOpacity: unknown) => {
// Sidebar opacity is handled purely on the renderer side via CSS.
Expand Down Expand Up @@ -1399,6 +1388,7 @@ function createWindow(): BrowserWindow {
sandbox: true,
},
});
window.setOpacity(1);

window.webContents.on("context-menu", (event, params) => {
event.preventDefault();
Expand Down
2 changes: 0 additions & 2 deletions apps/desktop/src/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import type { DesktopBridge } from "@okcode/contracts";
const PICK_FOLDER_CHANNEL = "desktop:pick-folder";
const CONFIRM_CHANNEL = "desktop:confirm";
const SET_THEME_CHANNEL = "desktop:set-theme";
const SET_WINDOW_OPACITY_CHANNEL = "desktop:set-window-opacity";
const SET_SIDEBAR_OPACITY_CHANNEL = "desktop:set-sidebar-opacity";
const CONTEXT_MENU_CHANNEL = "desktop:context-menu";
const OPEN_EXTERNAL_CHANNEL = "desktop:open-external";
Expand Down Expand Up @@ -32,7 +31,6 @@ contextBridge.exposeInMainWorld("desktopBridge", {
pickFolder: () => ipcRenderer.invoke(PICK_FOLDER_CHANNEL),
confirm: (message) => ipcRenderer.invoke(CONFIRM_CHANNEL, message),
setTheme: (theme) => ipcRenderer.invoke(SET_THEME_CHANNEL, theme),
setWindowOpacity: (opacity) => ipcRenderer.invoke(SET_WINDOW_OPACITY_CHANNEL, opacity),
setSidebarOpacity: (opacity) => ipcRenderer.invoke(SET_SIDEBAR_OPACITY_CHANNEL, opacity),
showContextMenu: (items, position) => ipcRenderer.invoke(CONTEXT_MENU_CHANNEL, items, position),
openExternal: (url: string) => ipcRenderer.invoke(OPEN_EXTERNAL_CHANNEL, url),
Expand Down
12 changes: 12 additions & 0 deletions apps/web/src/appSettings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ describe("AppSettingsSchema", () => {

expect(settings.showAuthFailuresAsErrors).toBe(true);
});

it("drops deprecated window opacity values from persisted settings", () => {
const decode = Schema.decodeSync(Schema.fromJsonString(AppSettingsSchema));

expect(
decode(
JSON.stringify({
windowOpacity: 0.3,
}),
),
).not.toHaveProperty("windowOpacity");
});
});

describe("normalizeCustomModelSlugs", () => {
Expand Down
2 changes: 0 additions & 2 deletions apps/web/src/appSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ export const AppSettingsSchema = Schema.Struct({
withDefaults(() => DEFAULT_SIDEBAR_THREAD_SORT_ORDER),
),
timestampFormat: TimestampFormat.pipe(withDefaults(() => DEFAULT_TIMESTAMP_FORMAT)),
windowOpacity: Schema.Number.pipe(withDefaults(() => 1)),
sidebarOpacity: Schema.Number.pipe(withDefaults(() => 1)),
sidebarHideFiles: Schema.Boolean.pipe(withDefaults(() => false)),
sidebarAccentProjectNames: Schema.Boolean.pipe(withDefaults(() => true)),
Expand Down Expand Up @@ -159,7 +158,6 @@ function clampOpacity(value: number): number {
function normalizeAppSettings(settings: AppSettings): AppSettings {
return {
...settings,
windowOpacity: clampOpacity(settings.windowOpacity),
sidebarOpacity: clampOpacity(settings.sidebarOpacity),
customCodexModels: normalizeCustomModelSlugs(settings.customCodexModels, "codex"),
customClaudeModels: normalizeCustomModelSlugs(settings.customClaudeModels, "claudeAgent"),
Expand Down
3 changes: 0 additions & 3 deletions apps/web/src/i18n/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,6 @@
"settings.general.timeFormat.option.24Hour": "24-hour",
"settings.general.timeFormat.option.locale": "System default",
"settings.general.timeFormat.title": "Time format",
"settings.general.windowOpacity.aria": "Window opacity",
"settings.general.windowOpacity.description": "Adjust the transparency of the entire application window.",
"settings.general.windowOpacity.title": "Window opacity",
"settings.models.customModels.addButton": "Add",
"settings.models.customModels.description": "Add custom model slugs for Codex or Anthropic. The chat picker groups models by provider.",
"settings.models.customModels.providerAria": "Custom model provider",
Expand Down
3 changes: 0 additions & 3 deletions apps/web/src/i18n/messages/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,6 @@
"settings.general.timeFormat.option.24Hour": "24 horas",
"settings.general.timeFormat.option.locale": "Predeterminado del sistema",
"settings.general.timeFormat.title": "Formato de hora",
"settings.general.windowOpacity.aria": "Opacidad de la ventana",
"settings.general.windowOpacity.description": "Ajusta la transparencia de toda la ventana de la aplicación.",
"settings.general.windowOpacity.title": "Opacidad de la ventana",
"settings.models.customModels.addButton": "Agregar",
"settings.models.customModels.description": "Añade slugs de modelos personalizados para Codex o Anthropic. El selector de chat agrupa los modelos por proveedor.",
"settings.models.customModels.providerAria": "Proveedor de modelo personalizado",
Expand Down
3 changes: 0 additions & 3 deletions apps/web/src/i18n/messages/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,6 @@
"settings.general.timeFormat.option.24Hour": "24 heures",
"settings.general.timeFormat.option.locale": "Par défaut du système",
"settings.general.timeFormat.title": "Format de l'heure",
"settings.general.windowOpacity.aria": "Opacité de la fenêtre",
"settings.general.windowOpacity.description": "Ajustez la transparence de toute la fenêtre de l'application.",
"settings.general.windowOpacity.title": "Opacité de la fenêtre",
"settings.models.customModels.addButton": "Ajouter",
"settings.models.customModels.description": "Ajoutez des slugs de modèles personnalisés pour Codex ou Anthropic. Le sélecteur de chat regroupe les modèles par fournisseur.",
"settings.models.customModels.providerAria": "Fournisseur de modèle personnalisé",
Expand Down
3 changes: 0 additions & 3 deletions apps/web/src/i18n/messages/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,6 @@
"settings.general.timeFormat.option.24Hour": "24 小时制",
"settings.general.timeFormat.option.locale": "系统默认",
"settings.general.timeFormat.title": "时间格式",
"settings.general.windowOpacity.aria": "窗口透明度",
"settings.general.windowOpacity.description": "调整整个应用窗口的透明度。",
"settings.general.windowOpacity.title": "窗口透明度",
"settings.models.customModels.addButton": "添加",
"settings.models.customModels.description": "为 Codex 或 Anthropic 添加自定义模型 slug。聊天选择器会按提供方对模型分组。",
"settings.models.customModels.providerAria": "自定义模型提供方",
Expand Down
40 changes: 0 additions & 40 deletions apps/web/src/routes/_chat.settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -846,46 +846,6 @@ function SettingsRouteView() {
}
/>

<SettingsRow
title="Window opacity"
description="Adjust the transparency of the entire application window."
resetAction={
settings.windowOpacity !== defaults.windowOpacity ? (
<SettingResetButton
label="window opacity"
onClick={() => {
updateSettings({ windowOpacity: defaults.windowOpacity });
if (isElectron && window.desktopBridge) {
void window.desktopBridge.setWindowOpacity(defaults.windowOpacity);
}
}}
/>
) : null
}
control={
<div className="flex items-center gap-2">
<input
type="range"
min={30}
max={100}
value={Math.round(settings.windowOpacity * 100)}
onChange={(e) => {
const value = Number(e.target.value) / 100;
updateSettings({ windowOpacity: value });
if (isElectron && window.desktopBridge) {
void window.desktopBridge.setWindowOpacity(value);
}
}}
className="h-1.5 w-24 cursor-pointer appearance-none rounded-full bg-muted accent-foreground sm:w-28"
aria-label="Window opacity"
/>
<span className="w-9 text-right text-xs tabular-nums text-muted-foreground">
{Math.round(settings.windowOpacity * 100)}%
</span>
</div>
}
/>

<SettingsRow
title="Sidebar opacity"
description="Adjust the transparency of the side panel and project list."
Expand Down
7 changes: 0 additions & 7 deletions apps/web/src/routes/_chat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,6 @@ function ChatRouteLayout() {
// Auto-delete threads whose PR has been merged (when enabled in settings).
useAutoDeleteMergedThreads(settings);

// Apply window opacity via the desktop bridge when the setting changes
useEffect(() => {
if (window.desktopBridge) {
void window.desktopBridge.setWindowOpacity(settings.windowOpacity);
}
}, [settings.windowOpacity]);

return (
<SidebarProvider defaultOpen={clientMode !== "mobile"}>
<ChatRouteGlobalShortcuts />
Expand Down
1 change: 0 additions & 1 deletion packages/contracts/src/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ export interface DesktopBridge {
pickFolder: () => Promise<string | null>;
confirm: (message: string) => Promise<boolean>;
setTheme: (theme: DesktopTheme) => Promise<void>;
setWindowOpacity: (opacity: number) => Promise<void>;
setSidebarOpacity: (opacity: number) => Promise<void>;
showContextMenu: <T extends string>(
items: readonly ContextMenuItem<T>[],
Expand Down
Loading