feat: add configurable tab bar status (#2586)
* feat: show a zoom indicator in the desktop tab bar Reserve the right edge of the tab row for a ZOOM pill while the focused pane is zoomed, matching the accent style of the mode bars. The per-tab Z suffix stays; the pill makes the zoomed state visible at a glance like tmux's status-right flag. * feat: optionally show the hostname in the desktop tab bar Add ui.tab_bar_hostname to display the machine's hostname at the right edge of the tab row, like tmux's #h in status-right. The value resolves where the server renders, so remote sessions show the remote host. Off by default. * fix: strip control characters from the tab bar hostname * fix: hide the hostname when it would squeeze out the tab strip * feat: add configurable tab bar status * fix: harden tab bar status updates * fix: terminate tab bar status process trees * fix: disable status commands on unsupported platforms * fix: skip unchanged status command renders * fix: keep tab bar status opt-in by default --------- Co-authored-by: David Heinemeier Hansson <david@hey.com>
This commit is contained in:
co-authored by
David Heinemeier Hansson
parent
e2aa86a9e8
commit
e48d83067a
@@ -35,7 +35,9 @@ SKIPPED_SUBTREES = ("keys.command",)
|
||||
FIELD_RE = re.compile(r"^\s*pub ([a-z_][a-z0-9_]*):\s*(.+?),?\s*$")
|
||||
STRUCT_RE = re.compile(r"^\s*pub(?:\(crate\))? struct ([A-Za-z0-9_]+)\s*\{\s*$")
|
||||
ENUM_RE = re.compile(r"^\s*pub(?:\(crate\))? enum ([A-Za-z0-9_]+)\s*\{\s*$")
|
||||
VARIANT_RE = re.compile(r"^\s*([A-Z][A-Za-z0-9_]*)\s*(?:\(.*\))?\s*,?\s*$")
|
||||
VARIANT_RE = re.compile(
|
||||
r"^\s*([A-Z][A-Za-z0-9_]*)\s*(?:\(.*\)|\{)?\s*,?\s*$"
|
||||
)
|
||||
RENAME_ALL_RE = re.compile(r'rename_all\s*=\s*"([^"]+)"')
|
||||
RENAME_RE = re.compile(r'rename\s*=\s*"([^"]+)"')
|
||||
|
||||
@@ -190,11 +192,11 @@ def parse_enum_body(
|
||||
index += 1
|
||||
break
|
||||
|
||||
depth += stripped.count("{") - stripped.count("}")
|
||||
if depth == 0 and not stripped.startswith(("#[", "///")):
|
||||
match = VARIANT_RE.match(stripped)
|
||||
if match:
|
||||
variants.append(apply_rename_all(match.group(1), rename_all or "lowercase"))
|
||||
depth += stripped.count("{") - stripped.count("}")
|
||||
index += 1
|
||||
|
||||
model.enums[name] = variants
|
||||
|
||||
@@ -32,6 +32,8 @@ pub struct UiConfig {
|
||||
pub sidebar_width: u16,
|
||||
/// Host cursor policy. Default: auto.
|
||||
pub host_cursor: HostCursorModeConfig,
|
||||
/// Tab bar status entries.
|
||||
pub tab_bar_right: Vec<TabBarRightEntryConfig>,
|
||||
#[serde(rename = "accent_color")]
|
||||
pub accent: String,
|
||||
#[serde(skip)]
|
||||
@@ -63,6 +65,19 @@ pub enum HostCursorModeConfig {
|
||||
Drawn,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(tag = "type", rename_all = "snake_case")]
|
||||
pub enum TabBarRightEntryConfig {
|
||||
Hostname,
|
||||
Datetime {
|
||||
format: String,
|
||||
},
|
||||
Command {
|
||||
command: String,
|
||||
interval_seconds: u64,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum BindingConfig {
|
||||
@@ -129,6 +144,10 @@ class CollectKeysTests(unittest.TestCase):
|
||||
self.assertEqual(
|
||||
entries["ui.host_cursor"]["values"], ["auto", "native-cursor", "drawn"]
|
||||
)
|
||||
self.assertEqual(
|
||||
entries["ui.tab_bar_right"]["values"],
|
||||
["hostname", "datetime", "command"],
|
||||
)
|
||||
self.assertNotIn("values", entries["keys.zoom"])
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user