Skip to content
プロジェクト

概要

Floating scratch shell for herdr — a tmux-floax style toggleable popup, one per workspace, with persistent sessions

開発ツール

この数値の測り方

計測したスター増加

24時間
0
7日間
+3
15日間
+3
1か月
履歴を収集中

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

herdr-floax

A floating scratch shell for the current herdr workspace — inspired by tmux-floax.

One keybinding toggles a floating shell: open → dismiss, one session per workspace. It is your real login shell, fully interactive, and its session persists across toggles. On herdr 0.7.4 or newer it opens in herdr's native popup, floating over your live workspace; on older herdr it falls back to a zoomed split that draws its own box (see Display modes).

Floax floating shell open over a herdr workspace after install (prefix+f)

Demo: open with prefix+f, hide it while a build keeps running, bring it back, then jump to another workspace's detached shell with prefix+i (MP4).

herdr-floax demo: toggle, persistence, and the instance picker

prefix+i opens the instance picker. It shows the total number of running shell sessions in the connected Herdr server, including dismissed sessions, with each workspace's name and ID, open/detached state, backend, and launch directory. Use ↑/↓ or j/k to select, Enter to jump or reattach, r to refresh, and Esc or q to close (in popup mode, prefix+i again also closes it). The directory is where the session started, not necessarily the shell's current directory.

With the tmux backend, extra windows (C-b c) and extra sessions (C-b :new) created inside a Floax shell appear as nested rows under their workspace's entry, with each window's name, directory, and which one is showing. Selecting a nested row shows that window in the view, reopening the view first when it is detached. A session stays listed while any of its windows is alive, even after its first shell exits. A view opened before upgrading does not tag the sessions it creates; dismiss and reopen it once. If another workspace's view switches into a nested session, that session moves under the other workspace. Orphaned sessions, whose root session has ended, are not listed.

Display modes

Set mode in floax.conf (or HERDR_FLOAX_MODE):

  • auto (default): popup on herdr 0.7.4 or newer, split otherwise.
  • popup: herdr's native session-modal popup, sized by width_pct/height_pct (default 80%×80%) and drawn over your live panes.
  • split: the original zoomed split described under How it works, with a solid backdrop.

Popup mode

  • Hiding: a herdr popup receives every key, including herdr's prefix, so herdr never sees your Floax bindings while the popup is open. Floax handles them instead: it reads keys.prefix (one key or a list) and your herdr-floax.toggle and herdr-floax.instances bindings from ~/.config/herdr/config.toml. The toggle binding hides the popup; the instances binding replaces it with the picker. Every other key, including other prefix combinations, reaches the shell unchanged. This works whether the app inside uses legacy keys, the kitty keyboard protocol, or modifyOtherKeys. The backend's own detach key (Ctrl-\ for dtach and abduco, C-b d for tmux) also hides it.
  • Bindings: any key herdr's binding syntax accepts works: letters, digits, named punctuation (plus, minus, backtick, ...), space, tab, enter, esc, backspace, arrows, and f1–f12, with ctrl, alt, and shift. cmd/super is only seen when the app inside uses the kitty keyboard protocol. The binding is read when the popup opens; after changing it, hide and reopen the popup.
  • Pastes: a bracketed paste goes to the shell verbatim, even if it contains your toggle or instances binding. Herdr brackets a paste only once the app inside has asked for it. dtach and abduco do not replay that request on reattach, so right after reopening, until the shell draws its next prompt, a pasted binding still acts (hiding the popup, or opening the picker), as it would trigger herdr's own bindings outside the popup.
  • Remote: with herdr --remote and local keybindings (the default), Floax reads the server's config.toml, so it matches the server's toggle and instances bindings, not your local ones.
  • One popup per server: herdr allows one popup at a time. Switching workspaces hides it, and focusing its workspace again shows it. Toggling in another workspace closes the hidden Floax popup (its shell keeps running) and opens that workspace's own. Floax never closes a popup or dialog that isn't its own; it shows a herdr toast instead (visible when ui.toast.delivery is not off).
  • All clients: like every herdr popup, it shows on every attached client and takes input from each of them.
  • Picker: the picker opens in a popup too, at the same size. It takes herdr's one popup slot, so opening it closes a Floax popup (the shell keeps running) and lists that session as detached. Like the shell popup, it receives every key, so it reads your instances binding the same way: pressing it again closes the picker, as do Esc and q. After the prefix, any other key keeps its usual picker meaning. Selecting a detached session closes the picker, focuses that session's workspace, and opens its popup there. A session's existing view is reused whichever mode is set, so a split view left from split mode or Floax 0.4 is focused rather than duplicated.
  • Leftover split view: in popup mode, toggling from inside that split view dismisses it. Toggling from elsewhere opens the popup, then closes the split view; its shell keeps running in its detached session. A split view running a plain shell (no dtach, abduco, or tmux) keeps toggling as a split, since closing it would end the shell.

How it works

In split mode, pressing the key toggles one floating pane per workspace:

  • no floating pane yet → opens a centered, sized popup (default 98%×96% — generous, since the backdrop is dead space; see Limitations) hosting your login shell, over a dimmed backdrop
  • focused on it → dismisses it (closes the pane; the shell session survives)
  • exists but you focused away → reveals + re-maximizes it
  • a Floax popup is open in this workspace (left from popup mode) → dismisses it, whichever mode is set

Under the hood the pane runs a small Rust TUI (ratatui + portable-pty + vt100) that draws the floating box and embeds a real shell PTY inside it — the same way herdr-file-viewer draws its help overlay, except the box hosts a live terminal instead of static text. Everything you can do in a normal pane works in the box: vim, REPLs, paste, colors, resize. Input is raw byte passthrough, so no key handling is lost in translation.

The host pane itself is a herdr split that the toggle action immediately zooms, so the box appears centered over the whole workspace. herdr's overlay/zoomed placements can't be used from a keybinding — herdr tears those transient views down the instant the invoking action finishes — and the app-drawn box is what restores floax's sized-popup look on top of that constraint.

  • Scope: per workspace. Toggling in workspace A and workspace B gives you two independent floating shells.
  • Persistence: dismiss closes the pane, so the embedded shell runs inside a per-workspace detached session when a multiplexer (dtach, abduco, or tmux) is on your PATH — anything running in it survives dismiss/reopen. Without one, it degrades to a plain login shell (fresh each reopen).
  • Backdrop: see Limitations — the area around the box uses your terminal background, not your live panes dimmed behind it.

In split mode the picker uses the same split-then-zoom approach, so it works without the newer Herdr popup API. It never creates a shell just by opening the list. Selecting an open session focuses and maximizes its pane. Selecting a detached session opens a view in its original workspace and reattaches the running shell. Closing the picker removes only its temporary split. Herdr's public focus API navigates all attached UI clients in the same server; it cannot target only the client that invoked the plugin.

Session supervisors hold OS file locks while their shells run. Unlocked records do not count, even after a crash. Pane ownership uses pane and terminal IDs rather than titles, so renaming a Floax pane does not break discovery. Sessions are namespaced by Herdr socket identity and workspace ID. Other Herdr servers and sessions left behind by a restarted server are not included. A still-running shell whose workspace was closed is listed as workspace closed, but cannot be navigated to. Without a multiplexer, plain shells count only while running and cannot survive dismissal.

Upgrading from 0.2.0's original session naming: exit existing Floax shells before upgrading. Old detached sessions are not adopted automatically because their workspace-only names cannot safely identify the owning Herdr server. Reopening after the upgrade starts tracked, server-scoped sessions. Re-run the keybinding installer to add the picker binding; it preserves the existing toggle binding. If the preserved toggle already uses prefix+i, choose another picker key with the installer's second argument.

Limitations

These apply to split mode. Popup mode, the default on herdr 0.7.4 or newer, floats over your real workspace.

The backdrop is not your real workspace. In tmux-floax, the popup floats over your live session — you see your actual panes, dimmed, behind the box. herdr-floax cannot replicate that: the plugin only controls its own pane's canvas. herdr owns the other panes' PTYs and provides no primitive for a plugin to composite a persistent popup over them (its only true-overlay placement is transient — it is torn down the moment the invoking keybinding action completes). So the area around the floating box is a solid fill matching your terminal's background, not your dimmed workspace showing through.

Related version-specific quirks this plugin works around (herdr 0.7.1):

  • overlay/zoomed pane placements vanish when opened from a keybinding action — hence the split-then-zoom approach.
  • plugin pane open --cwd <path> makes the new pane exit immediately — hence the starting directory travels via the HERDR_FLOAX_CWD env var and the shell script cds itself.

herdr 0.7.4 added that primitive, the popup placement; popup mode uses it.

Configuration

Copy floax.conf.example to the plugin config dir (herdr plugin config-dir herdr-floax, i.e. ~/.config/herdr/plugins/config/herdr-floax/floax.conf):

mode = auto       # auto, popup, or split (see Display modes)
# width_pct = 80  # box width, % (20..100); default 80 popup, 98 split
# height_pct = 80 # box height, % (20..100); default 80 popup, 96 split
key_hint = prefix+f   # split mode: shown in the bottom border (display only)
# backdrop = #102030  # split mode: optional; defaults to the terminal background

Env overrides per invocation: HERDR_FLOAX_MODE, HERDR_FLOAX_WIDTH_PCT, HERDR_FLOAX_HEIGHT_PCT, HERDR_FLOAX_KEY_HINT, HERDR_FLOAX_BACKDROP. Popup mode reads your toggle key from herdr's config, so key_hint does not affect it.

Install

From GitHub (builds with cargo at install time):

herdr plugin install Tyru5/herdr-floax

# Then install the default keybind (prefix+f) and reload herdr config:
bash "$(herdr plugin list --plugin herdr-floax --json | jq -r '.result.plugins[0].plugin_root')/scripts/install-keybinding.sh"

Or for local development:

# 1. Link the plugin (no GitHub round-trip):
herdr plugin link /path/to/herdr-floax

# 2. Install the default keybind (prefix+f), then reload herdr config:
bash /path/to/herdr-floax/scripts/install-keybinding.sh

Requires Rust 1.89 or newer (cargo) to build. The GitHub installation command above uses jq; runtime actions do not need it. For session persistence, install dtach, abduco, or tmux 3.2 or newer.

Keybinding

The defaults are prefix+f for toggle and prefix+i for the picker. Change them any of these ways:

scripts/install-keybinding.sh prefix+g          # pass a key
HERDR_FLOAX_KEY=prefix+g scripts/install-keybinding.sh
scripts/install-keybinding.sh prefix+g prefix+G # toggle, then picker
HERDR_FLOAX_INSTANCES_KEY=prefix+G scripts/install-keybinding.sh

…or add/edit the block by hand in ~/.config/herdr/config.toml:

[[keys.command]]
key = "prefix+f"
type = "plugin_action"
command = "herdr-floax.toggle"
description = "Toggle floating pane"

[[keys.command]]
key = "prefix+i"
type = "plugin_action"
command = "herdr-floax.instances"
description = "List and navigate Floax sessions"

The installer uses the built plugin binary to parse TOML and preserves existing bindings by command, including hand-written blocks without marker comments. It refuses assigned keys before appending anything and leaves existing config text unchanged. Inline-array keybinding layouts cannot be extended automatically; add the missing binding to that array by hand instead. If you installed the earlier picker default prefix+F, edit its herdr-floax.instances block to use prefix+i.

Reload herdr's config (or restart herdr) after changing it.

Files

File Purpose
herdr-plugin.toml Manifest: popup, split, and picker panes, toggle and instances actions, build.
src/ Popup host, split-mode TUI, embedded shell PTY, session inventory, toggle, and picker navigation.
scripts/floating-shell.sh The embedded program: a login shell (detach-wrapped when possible).
scripts/install-keybinding.sh Idempotently installs both overridable keybinds, including upgrades.
floax.conf.example Size/hint configuration template.

関連プロジェクトを探す

読み込み中…