Skip to content

Draw window controls on GNOME and make text selectable - #72

Open
fzakaria wants to merge 2 commits into
tobi:mainfrom
fzakaria:gnome-chrome-and-selection
Open

fzakaria wants to merge 2 commits into
tobi:mainfrom
fzakaria:gnome-chrome-and-selection

Conversation

@fzakaria

@fzakaria fzakaria commented Oct 4, 2026 •

Copy link
Copy Markdown

I have really enjoyed this app! I suspect you did it for https://omarchy.us/ + Hyprland but I was enjoying it on https://nixos.org/ + Wayland.

Here are two fixes for running disktree on GNOME (Wayland).

Window controls where the compositor draws none

disktree asks for server-side decorations. Hyprland, KDE, X11 window
managers, macOS and Windows draw a title bar for it. GNOME's Mutter does
not offer server-side decorations to Wayland apps, so GPUI falls back to
client-side ones, and disktree drew nothing: no minimize, maximize or
close, no way to move the window, no resize edges.

When the window reports client-side decorations, each screen's header is
now the title bar:

  • drag to move (after a 4 px threshold, so a click stays a click)
  • double-click to maximize or restore, right-click for the window menu
  • minimize / maximize / close at the right end, limited to what the
    compositor says it supports
  • the free edges and corners resize the window

Presses on the header's crumbs and settings never reach the title bar,
so double-clicking a crumb does not maximize the window. Under
server-side decorations nothing changes.

Selectable text and Ctrl+C

Nothing could be selected, so a path in the panel had to be retyped.
This uses gpui-kit's own window-wide text selection (TextSelectionLayer
plus SelectableText). The selection's name and path, the marked and
review lists, the removal log and failures, the disk figures, notices
and the key bar are selectable. Ctrl+C (Cmd+C, with an Edit menu on
macOS) copies; with nothing selected the chord is left alone and is not
read as c.

gpui-kit moves a selection as the pointer drags but leaves the redraw to
the app, so the root refreshes the window during a selection drag;
without it the highlight lagged.

Text stays plain where a press already means something: buttons, crumbs,
clickable rows, the title bar, the cursor tooltip, and the painted
treemap.

Testing

  • cargo xtask lint and cargo xtask test pass on each commit.
  • New window-harness tests: no chrome and no window move under
    server-side decorations (the test window panics if asked to move);
    controls and resize handles under client-side decorations, standing in
    for GNOME through a test-only field; a drag across the selection's
    name and path followed by Ctrl+C copies exactly that text.
  • Unit tests for which controls show, which edges resize, and the move
    threshold.
  • Run by hand on GNOME 49 / Wayland (NixOS): move, maximize, minimize,
    close, resize, select and copy. Not tried on Windows or macOS beyond
    CI, or on Hyprland by hand.

Screenshots

The controls in the header on GNOME, and a selection in the panel.

Screenshot From 2026-10-04 14-20-32 Screenshot From 2026-10-04 14-20-22 Screenshot From 2026-10-04 14-20-11

fzakaria and others added 2 commits October 4, 2026 14:16
disktree asks for server-side decorations, and Hyprland, KDE, X11
window managers, macOS and Windows draw a title bar for it. GNOME's
Mutter does not offer server-side decorations to Wayland apps, so GPUI
falls back to client-side ones and disktree drew none: no minimize,
maximize or close, no way to move the window by its header, and no
resize edges.

When the window reports client-side decorations, each screen's header
now acts as the title bar. A drag moves the window once the pointer
travels a few pixels, so a click on a crumb stays a click. Double-click
maximizes, right-click opens the compositor's window menu, and the
controls the compositor supports sit at the header's right end. The
free edges and corners resize the window. Presses on the header's
buttons never reach the title bar, so double-clicking a crumb does not
maximize the window.

Under server-side decorations nothing changes. The test window always
reports server-side decorations, so a test-only field lets the harness
stand in for GNOME.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Nothing in the window could be selected, so a path seen in the panel
had to be retyped to use it anywhere else. The selection's name and
path, the marked list, the review list, the removal log and failures,
the disk figures, notices and the key bar are now selectable, and
Ctrl+C (Cmd+C, also in a new Edit menu on macOS) copies the selection.
With nothing selected the chord is left alone.

This is gpui-kit's own window-wide text selection: one layer at the
root and a selectable run per piece of text. The layer moves a
selection as the pointer drags but leaves the redraw to the app, so
the root refreshes the window while a selection is being dragged;
without that the highlight lagged until something else repainted.

Text stays plain where a press already means something: buttons,
crumbs, clickable rows, the title bar, the tooltip that follows the
pointer, and the treemap, whose labels are painted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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