Skip to content

feature: add toggle-titlebar and toggle-borders commands - #337

Open
Granitosaurus wants to merge 4 commits into
malbiruk:mainfrom
Granitosaurus:toggle-titlebar
Open

Granitosaurus wants to merge 4 commits into
malbiruk:mainfrom
Granitosaurus:toggle-titlebar

Conversation

@Granitosaurus

@Granitosaurus Granitosaurus commented Nov 10, 2026 •

Copy link
Copy Markdown

Add command to toggle window titlebar and box decorations

A window's chrome (titlebar, border etc) is fixed when it opens: decoration = "server" in a window rule gives it driftwm's title bar, border, shadow and rounded-corner clip for as long as it lives. There is no way to drop any of it later, and no way to give a bar to a window that opened without one.

Concrete case: I use a keyboard-driven image viewer (swayimg) as a picture frame on the canvas, for a transparent gif or a video. I want the title bar while I arrange the window, then nothing around the picture once it sits where I want it. A shadow shows as a dark halo around the transparent parts and the corner clip crops the picture, so removing only the bar is not enough. Today the only route is decoration = "none" under a second app_id, and relaunching the viewer to switch.

2026-11-10_20-07-37.mp4

here using these two new actions I can toggle window's chrome for a playing gif in swayimg window

Proposal

Two bindable actions, independent of each other:

[keybindings]
"mod+shift+t" = "toggle-titlebar"
"mod+shift+b" = "toggle-borders"
  • toggle-titlebar flips the focused window between server and minimal: the bar goes, border, corners and shadow stay. Both modes are ServerSide on the wire, so the client is not told and nothing is reconfigured.
  • toggle-borders hides the border, drop shadow and corner clip together, so the window draws as the bare client surface. It is a runtime flag on the window's stored rule that the existing effective_border_width / effective_shadow_enabled / effective_corner_radius helpers check, the way they already honour decoration = "none". The rule's own values stay untouched, so toggling back restores them with nothing saved.
  • Pressing a key again restores the window. Using both gives the bare frame.
  • Windows that draw their own chrome (client) or none (none) are left alone by the title bar toggle, so a GTK app never gets a second bar. Fit, fill, fullscreen and widget windows are left alone by both.
  • Runtime-only, in the same spirit as msg opacity: not saved in session.json, gone when the window closes. No behaviour change for anyone who does not bind them. Both are scriptable through driftwm msg action.

The only uncertainty I'm having here is to whether toggle-borders should be split further to more granular options like toggle-corners and toggle-shadows bu I think use case just for toggling corners or shadows is likely super rare. However sometimes a user might want to just toggle titlebar as it's not very useful for some programs but retain boxing for navigation (e.g. video player) or just keep the titlebar with no borders for scratchpad #334 windows.

Granitosaurus and others added 4 commits November 10, 2026 11:06
Flips the focused window's decoration between `server` and `minimal`, so the
title bar goes away while the border, corners and shadow stay. Both modes map
to server-side on the wire, so the client is not told; the compositor drops or
rebuilds the window's decoration and its cached chrome.

Windows that draw their own chrome (`client`) or none are left alone, so a GTK
app never gets a second bar. A `minimal` rule window gains a bar on the first
toggle. Runtime-only, like `msg opacity`: the override lives on the stored
applied rule and is gone when the window closes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…rners

Review follow-up.

- Refresh the cached snap rect: the frame changes by the bar height, and a stale
  rect read as a grow on the next commit and could relocate a snapped window.
- Leave fit, fill and widget windows alone: their geometry was computed against
  the bar they have, or is rule-defined.
- Skip windows that negotiated client-side decoration, so an app with its own
  header bar never gets a second one.
- Carve the opaque-region corners when the bar goes. The compositor clips the
  corners of a bar-less window itself, but a client that never commits again kept
  declaring them opaque. The carve moves out of `commit` into
  `trim_opaque_corners` and is idempotent.
- Move the mechanism into state/window_frame.rs, drop the redundant shadow/border
  cache evictions and the unread `pending_ssd` bookkeeping.
- Document the runtime rule rewrite in window-rules.md.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A runtime flag on the window's stored rule, checked by effective_border_width,
effective_shadow_enabled and effective_corner_radius the way `decoration =
"none"` already is, so render, layout, snap, fit and IPC all see it through the
helpers they already use. The rule's own values stay untouched, so toggling back
needs nothing saved.

Applies to client-decorated windows too (the compositor draws those three around
them as well); left alone for `decoration = "none"`, fullscreen, fit, fill and
widget windows, the same guards as toggle-titlebar, which now share a target
helper and a post-change step (snap rect refresh, corner carve, redraw).

Runtime-only, like `msg opacity`: not saved in session.json, gone when the window
closes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…rop stale render caches

Review fixes: don't write the decoration override when no bar can be
created, drop the cached border/shadow elements when chrome changes,
skip windows with a deferred fit or fullscreen, document that widget
windows are skipped, and tidy the doc comments.
@Granitosaurus Granitosaurus changed the title WIP feature: Add toggle-titlebar: hide/show a window's title bar at runtime WIP feature: Add toggle-titlebar - hide/show a window's title bar at runtime and toggle-border - hide/show windows border decorations Nov 10, 2026
@Granitosaurus
Granitosaurus marked this pull request as ready for review November 10, 2026 13:16
@Granitosaurus Granitosaurus changed the title WIP feature: Add toggle-titlebar - hide/show a window's title bar at runtime and toggle-border - hide/show windows border decorations feature: add toggle-titlebar and toggle-borders commands Nov 10, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant