Repository navigation
Add the dock's context menu and panel commands - #60
Merged
Merged
Conversation
A row of the menu renders the panel's header, the component its tab shows, so a custom panel is listed like any other and a file's row has its unsaved changes dot. The menu no longer draws an icon per type or its own close button. A custom panel without a source has no row. DockTabHeader shows its close button in a highlighted menu item as in a hovered tab, and its title grows and truncates. DropdownMenuItem takes recolor, which is off for a row whose content keeps its own colors while highlighted. A panel component has a header in place of a tab, and every panel's tab is one Tab that adds dragging and the tabless marker around it. The tabs per type are gone, and the files of the file's and terminal's are named for their headers. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A panel command runs on a panel, e.g. to close or move it, and without a target on the active panel of the dock shown. The command manager tells a panel from the other targets, which a terminal's and a file's panel used to pass for. The built-in ones close a panel, the other tabs of its group, all of them, or those to its left or right, and split its group by moving it right or down. Several panels close one after another, so that only one asks at a time. Close has the default key Ctrl+F4, or Cmd+W on macOS, which nothing dispatches yet. A command is hidden for a panel it can never apply to, or when it would shift nothing above it in a menu, and is then disabled too. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A right-click on a panel's header opens a menu of the panel commands, run on that panel: closing it, the others, all, or those to its left or right, and splitting its group by moving it. The click does not activate the tab. Plugins add groups with Docks.addContextMenu, and an item for one kind of panel hides for the others through its command. The menu's trigger is stretched over the padding of dockview's tab, so that it opens anywhere on the tab. A tab reads its panel from the dock, and so renders again when the dock changes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A file's tab can copy its absolute path or its path from the workspace, and open the file in the file manager. A terminal's tab can rename its session. They are panel commands that hide for other kinds of panel, and share their logic with the file tree's commands. The menu groups the paths under "Copy path" and the moves under "Split and move", as the file tree's menu does. Renaming a session opens a popover below the tab, flush with its left edge, since a field in a tab would resize it and shift the tabs after it. The popover keeps a right-click in its field from the tab's menu, and leaves the focus alone when it closes, which would otherwise land on the tab's close button. The tab's menu leaves the focus to what its item focuses. The field is the sidebar's, now shared. A terminal's header shows the session's name once it is renamed, where it kept dockview's stale title. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A key pressed in the dock runs the panel commands bound to it on the active panel, so Ctrl+F4, or Cmd+W on macOS, closes the active tab. A key pressed in a menu or popover of the dock is left alone, as is one pressed outside it. A terminal sends its keys to the shell, so it leaves the key of an allowed command to the dock. Close is the only one allowed for now. On macOS the window closes on Cmd+Shift+W, which leaves Cmd+W to the panel. Hide is a new panel command for a tabless panel that cannot be closed, such as the file tree. It hides the panel's group and shares the close key, with Shift+Escape as another. The close commands move from panel.close to panel.view, beside hide. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Dockview tracks whether a panel has the focus but never moves it: a click on a tab left the focus on the tab, and a closed panel left it on nothing, so that the next key did nothing. A panel is now asked to take the focus when it becomes the active panel, when a dock attaches, and when its tab is clicked. The dock only records the request. Every panel's content is rendered in one Panel, as every header is in one Tab, which moves the focus when the request is for its panel: to what the content picks with usePanelFocus, else to its first focusable element. Content that has nothing to focus yet, e.g. an editor whose file loads, takes the focus once it has, unless the focus has gone outside the dock meanwhile. The editor that edits the file, the terminal and the file tree pick what they focus. A custom panel sets a handle with a focus function on the ref its component is given. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Closing the tab shown in a group left it to dockview to show the one that was shown before it. The frontend settings now have workspace.closeActivation: the tab on the left, which is the default, the tab on the right, or the most recent one. The left and right fall back to the other side at either end. A Workspace page in the settings, after the keymap's, has it as "Tab after close". The dock shows the successor before it closes the tab, and activates it if the tab was the active panel, so that it takes the focus. A panel is closed in one place, DockManager.close, which takes a force flag that the contract does not have: whether the panel can be closed and what it shows are then not asked. A terminal whose shell exited and custom panels whose source is gone close that way. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A tab shows a tooltip below it, flush with its left edge as the rename popover is, once the pointer rests on it for 600ms. A file's shows its absolute path and a terminal's the name of its session, each on one line. The file tree and the placeholder have none. Every tab waits out the delay, since the pointer crosses tabs on its way to one. A panel source has a tooltip function, called each time the tooltip is about to open, which returns what to show or null for none. A source that throws shows none. A terminal returns null while its session is renamed, since the rename popover opens where the tooltip does. The tooltip opens on hover only: the focus of a popover in the header reaches the tab, which would otherwise open the tooltip over it. Anything in the header that takes the focus closes it. TooltipContent takes an anchor, as PopoverContent does. sameSession compares two terminal sessions, beside sameWorkspace. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A press on a tab moves the focus to the tab before its context menu opens, so the menu left the focus on nothing once it closed. The tab now remembers what had the focus at the press, and focuses it again when the menu closes, whether that was a panel or something outside the dock. An item still has the last word: one that shows a field, e.g. to rename a session, keeps the focus there, and one that closes the panel that had the focus leaves it to the panel that becomes active. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The frontend settings have workspace.tabTooltips, on by default. The Workspace page has it as "Tab tooltips", a switch after "Tab after close", with an illustration of a tab bar that shows the tooltip while it is on. While it is off, a tab asks no panel for a tooltip, so it covers files, terminals and custom panels alike. Two tests that expect no tooltip waited less than the tooltip's delay, and now wait past it. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test before it clicks the close button, which leaves the pointer where the next tab's close button renders. The tab then counted as hovered once Chromium updated the hover, and hid the status the test expects. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
docks.addContextMenu; the built-in groups areDEFAULT_DOCK_CONTEXT_MENU. A file's tab copies its paths and opens the file in the file manager, and a terminal's renames its session in a popover below the tab.usePanelFocus; a custom panel sets aCustomPanelHandleon its ref. A tab's context menu gives the focus back when it closes.CustomPanelSourcehas an optionaltooltip.workspace.closeActivation(the tab on the left, on the right, or the most recent after a close) andworkspace.tabTooltips.Testing
🤖 Generated with Claude Code