Skip to content

Commit 3f6c35e

Browse files
author
Aayush Singh
committed
feat(app): add option to hide window titlebar on Linux
Add a setting in Settings → Advanced → Appearance to hide the native window titlebar. This is useful for tiling window managers on Linux (Hyprland, i3, sway, etc.) where window controls are typically handled via keybinds, making the titlebar redundant. Implementation: - Add HIDE_TITLEBAR_PREF_KEY constant for localStorage persistence - Add Tauri command `set_window_decorations` to toggle decorations - Add TypeScript binding for the new Tauri command - Add UI toggle in Settings → Advanced → Appearance section - Apply setting on change and restore from localStorage on startup The setting is only shown in the desktop (Tauri) environment and persists across sessions via localStorage. Closes anomalyco#441
1 parent b0fe577 commit 3f6c35e

8 files changed

Lines changed: 94 additions & 2 deletions

File tree

‎packages/app/src/app/app.tsx‎

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import ProtoV1UxView from "./pages/proto-v1-ux";
4141
import { createClient, unwrap, waitForHealthy } from "./lib/opencode";
4242
import {
4343
DEFAULT_MODEL,
44+
HIDE_TITLEBAR_PREF_KEY,
4445
MCP_QUICK_CONNECT,
4546
MODEL_PREF_KEY,
4647
SESSION_MODEL_PREF_KEY,
@@ -124,6 +125,7 @@ import {
124125
openworkServerInfo,
125126
openwrkStatus,
126127
owpenbotInfo,
128+
setWindowDecorations,
127129
type OpenwrkStatus,
128130
type OpenworkServerInfo,
129131
type OwpenbotInfo,
@@ -1240,6 +1242,7 @@ export default function App() {
12401242
const [modelPickerQuery, setModelPickerQuery] = createSignal("");
12411243

12421244
const [showThinking, setShowThinking] = createSignal(false);
1245+
const [hideTitlebar, setHideTitlebar] = createSignal(false);
12431246
const [modelVariant, setModelVariant] = createSignal<string | null>(null);
12441247

12451248
const MODEL_VARIANT_OPTIONS = [
@@ -3056,6 +3059,18 @@ export default function App() {
30563059
}
30573060
}
30583061

3062+
const storedHideTitlebar = window.localStorage.getItem(HIDE_TITLEBAR_PREF_KEY);
3063+
if (storedHideTitlebar != null) {
3064+
try {
3065+
const parsed = JSON.parse(storedHideTitlebar);
3066+
if (typeof parsed === "boolean") {
3067+
setHideTitlebar(parsed);
3068+
}
3069+
} catch {
3070+
// ignore
3071+
}
3072+
}
3073+
30593074
const storedVariant = window.localStorage.getItem(VARIANT_PREF_KEY);
30603075
if (storedVariant && storedVariant.trim()) {
30613076
const normalized = normalizeModelVariant(storedVariant);
@@ -3408,7 +3423,22 @@ export default function App() {
34083423
}
34093424
});
34103425

3411-
3426+
// Persist and apply hideTitlebar setting
3427+
createEffect(() => {
3428+
if (typeof window === "undefined") return;
3429+
const hide = hideTitlebar();
3430+
try {
3431+
window.localStorage.setItem(HIDE_TITLEBAR_PREF_KEY, JSON.stringify(hide));
3432+
} catch {
3433+
// ignore
3434+
}
3435+
// Apply to window decorations (only in Tauri desktop environment)
3436+
if (isTauriRuntime()) {
3437+
setWindowDecorations(!hide).catch(() => {
3438+
// ignore errors (e.g., window not ready)
3439+
});
3440+
}
3441+
});
34123442

34133443
createEffect(() => {
34143444
if (typeof window === "undefined") return;
@@ -3710,6 +3740,8 @@ export default function App() {
37103740
openDefaultModelPicker,
37113741
showThinking: showThinking(),
37123742
toggleShowThinking: () => setShowThinking((v) => !v),
3743+
hideTitlebar: hideTitlebar(),
3744+
toggleHideTitlebar: () => setHideTitlebar((v) => !v),
37133745
modelVariantLabel: formatModelVariantLabel(modelVariant()),
37143746
editModelVariant: handleEditModelVariant,
37153747
updateAutoCheck: updateAutoCheck(),

‎packages/app/src/app/constants.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ export const SESSION_MODEL_PREF_KEY = "openwork.sessionModels";
55
export const THINKING_PREF_KEY = "openwork.showThinking";
66
export const VARIANT_PREF_KEY = "openwork.modelVariant";
77
export const LANGUAGE_PREF_KEY = "openwork.language";
8+
export const HIDE_TITLEBAR_PREF_KEY = "openwork.hideTitlebar";
89

910
export const DEFAULT_MODEL: ModelRef = {
1011
providerID: "opencode",

‎packages/app/src/app/lib/tauri.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -802,3 +802,12 @@ export async function owpenbotRestart(options: {
802802
await owpenbotStop();
803803
return owpenbotStart(options);
804804
}
805+
806+
/**
807+
* Set window decorations (titlebar) visibility.
808+
* When `decorations` is false, the native titlebar is hidden.
809+
* Useful for tiling window managers on Linux (e.g., Hyprland, i3, sway).
810+
*/
811+
export async function setWindowDecorations(decorations: boolean): Promise<void> {
812+
return invoke<void>("set_window_decorations", { decorations });
813+
}

‎packages/app/src/app/pages/dashboard.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ export type DashboardViewProps = {
175175
openDefaultModelPicker: () => void;
176176
showThinking: boolean;
177177
toggleShowThinking: () => void;
178+
hideTitlebar: boolean;
179+
toggleHideTitlebar: () => void;
178180
modelVariantLabel: string;
179181
editModelVariant: () => void;
180182
updateAutoCheck: boolean;
@@ -746,6 +748,8 @@ export default function DashboardView(props: DashboardViewProps) {
746748
openDefaultModelPicker={props.openDefaultModelPicker}
747749
showThinking={props.showThinking}
748750
toggleShowThinking={props.toggleShowThinking}
751+
hideTitlebar={props.hideTitlebar}
752+
toggleHideTitlebar={props.toggleHideTitlebar}
749753
modelVariantLabel={props.modelVariantLabel}
750754
editModelVariant={props.editModelVariant}
751755
updateAutoCheck={props.updateAutoCheck}

‎packages/app/src/app/pages/settings.tsx‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ export type SettingsViewProps = {
8585
openDefaultModelPicker: () => void;
8686
showThinking: boolean;
8787
toggleShowThinking: () => void;
88+
hideTitlebar: boolean;
89+
toggleHideTitlebar: () => void;
8890
modelVariantLabel: string;
8991
editModelVariant: () => void;
9092
themeMode: "light" | "dark" | "system";
@@ -1601,6 +1603,32 @@ export default function SettingsView(props: SettingsViewProps) {
16011603
</p>
16021604
</div>
16031605

1606+
<Show when={isTauriRuntime()}>
1607+
<div class="bg-gray-2/30 border border-gray-6/50 rounded-2xl p-5 space-y-3">
1608+
<div>
1609+
<div class="text-sm font-medium text-gray-12">Appearance</div>
1610+
<div class="text-xs text-gray-10">Customize window appearance.</div>
1611+
</div>
1612+
1613+
<div class="flex items-center justify-between bg-gray-1 p-3 rounded-xl border border-gray-6 gap-3">
1614+
<div class="min-w-0">
1615+
<div class="text-sm text-gray-12">Hide titlebar</div>
1616+
<div class="text-xs text-gray-7">
1617+
Hide the window titlebar. Useful for tiling window managers on Linux (Hyprland, i3, sway).
1618+
</div>
1619+
</div>
1620+
<Button
1621+
variant="outline"
1622+
class="text-xs h-8 py-0 px-3 shrink-0"
1623+
onClick={props.toggleHideTitlebar}
1624+
disabled={props.busy}
1625+
>
1626+
{props.hideTitlebar ? "On" : "Off"}
1627+
</Button>
1628+
</div>
1629+
</div>
1630+
</Show>
1631+
16041632
<Show when={isTauriRuntime() && isLocalPreference()}>
16051633
<div class="bg-gray-2/30 border border-gray-6/50 rounded-2xl p-5 space-y-4">
16061634
<div>

‎packages/desktop/src-tauri/src/commands/mod.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ pub mod owpenbot;
99
pub mod scheduler;
1010
pub mod skills;
1111
pub mod updater;
12+
pub mod window;
1213
pub mod workspace;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
use tauri::{AppHandle, Manager};
2+
3+
/// Set window decorations (titlebar) visibility.
4+
/// When `decorations` is false, the native titlebar is hidden.
5+
/// This is useful for tiling window managers on Linux (e.g., Hyprland, i3, sway).
6+
#[tauri::command]
7+
pub fn set_window_decorations(app: AppHandle, decorations: bool) -> Result<(), String> {
8+
let window = app
9+
.get_webview_window("main")
10+
.ok_or_else(|| "Main window not found".to_string())?;
11+
12+
window
13+
.set_decorations(decorations)
14+
.map_err(|e| format!("Failed to set decorations: {e}"))
15+
}

‎packages/desktop/src-tauri/src/lib.rs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ use commands::owpenbot::{
3131
};
3232
use commands::skills::{install_skill_template, list_local_skills, uninstall_skill};
3333
use commands::updater::updater_environment;
34+
use commands::window::set_window_decorations;
3435
use commands::workspace::{
3536
workspace_add_authorized_root, workspace_bootstrap, workspace_create, workspace_create_remote,
3637
workspace_export_config, workspace_forget, workspace_import_config, workspace_openwork_read,
@@ -106,7 +107,8 @@ pub fn run() {
106107
reset_opencode_cache,
107108
opencode_mcp_auth,
108109
scheduler_list_jobs,
109-
scheduler_delete_job
110+
scheduler_delete_job,
111+
set_window_decorations
110112
])
111113
.run(tauri::generate_context!())
112114
.expect("error while running OpenWork");

0 commit comments

Comments
 (0)