feat(settings): rebuild the settings window after the v4 design
Rewrites the settings page to the Settings design: a sidebar with search, per-page modified counts and a "Modified only" switch; quiet grouped rows with an inline Reset; and the design's own controls (switch, segmented, stepper, slider, text field, dropdown and popover menus) in a new `settings/kit.rs`. - Appearance: Light / Dark / System cards and a theme menu per slot with a live preview, search, keyboard navigation and swatches. Font menus are searchable and draw each family in itself. - Keyboard shortcuts: back link, search, "Restore N changed", Default/tmux. A recorded chord another action already has now asks Replace / Cancel instead of taking it over silently. - SSH: one column of recent hosts, "Show all" by source, search; details and a six-field editor open in place. Auth, jump/proxy, forwarding and advanced sections are no longer shown; saved values are kept. - Integrations: machine menu, agent search, install summary, agent icons, and a per-row menu (Reinstall, Reveal hook file, Uninstall). - General gains startup and restore; updates and the server move to About. - Search results group live rows by page; a Modified view lists changes. The page code moves out of settings.rs into src/ui/settings/.
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.15" stroke-linecap="round" stroke-linejoin="round"><path d="M7 1.8a5.2 5.2 0 1 0 0 10.4A5.2 5.2 0 0 0 7 1.8zM7 6.4v3.2M7 4.4h0"/></svg>
|
||||
|
After Width: | Height: | Size: 269 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.15" stroke-linecap="round" stroke-linejoin="round"><path d="M7 1.8a5.2 5.2 0 1 0 0 10.4c.9 0 1.2-.7.8-1.4-.5-.8 0-1.8 1-1.8h1.4a2 2 0 0 0 2-2A5.2 5.2 0 0 0 7 1.8zM4.3 6.2h0M6 4.2h0M8.6 4.4h0"/></svg>
|
||||
|
After Width: | Height: | Size: 333 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"><path d="M6.5 1.5L3 5l3.5 3.5"/></svg>
|
||||
|
After Width: | Height: | Size: 222 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"><path d="M2.5 6.2l2.3 2.3 4.7-5"/></svg>
|
||||
|
After Width: | Height: | Size: 224 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 3.5l3 3 3-3"/></svg>
|
||||
|
After Width: | Height: | Size: 216 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round" stroke-linejoin="round"><path d="M3.5 2l3 3-3 3"/></svg>
|
||||
|
After Width: | Height: | Size: 216 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"><path d="M1.5 1.5l7 7M8.5 1.5l-7 7"/></svg>
|
||||
|
After Width: | Height: | Size: 203 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.15" stroke-linecap="round" stroke-linejoin="round"><path d="M2 4h6M10.5 4H12M2 10h1.5M6 10h6M9.25 2.5v3M4.75 8.5v3"/></svg>
|
||||
|
After Width: | Height: | Size: 257 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.15" stroke-linecap="round" stroke-linejoin="round"><path d="M3 5.2h8v5.6H3zM5.6 5.2V3.2M8.4 5.2V3.2M1.6 8h1.4M11 8h1.4M5.4 8h0M8.6 8h0"/></svg>
|
||||
|
After Width: | Height: | Size: 277 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.15" stroke-linecap="round" stroke-linejoin="round"><path d="M1.8 3.8h10.4v6.4H1.8zM4 6h0M6 6h0M8 6h0M10 6h0M4.6 8h4.8"/></svg>
|
||||
|
After Width: | Height: | Size: 260 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round"><path d="M1.5 2.5h9v6h-9zM4 10.5h4"/></svg>
|
||||
|
After Width: | Height: | Size: 227 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.1" stroke-linecap="round" stroke-linejoin="round"><path d="M6 1.2a4.8 4.8 0 1 0 0 9.6A4.8 4.8 0 0 0 6 1.2zM1.2 6h9.6M6 1.2c1.5 1.5 1.5 8.1 0 9.6M6 1.2c-1.5 1.5-1.5 8.1 0 9.6"/></svg>
|
||||
|
After Width: | Height: | Size: 316 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="currentColor"><circle cx="2.5" cy="6" r="1"/><circle cx="6" cy="6" r="1"/><circle cx="9.5" cy="6" r="1"/></svg>
|
||||
|
After Width: | Height: | Size: 201 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 10 10" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"><path d="M5 1.5v7M1.5 5h7"/></svg>
|
||||
|
After Width: | Height: | Size: 194 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linecap="round"><circle cx="5" cy="5" r="3.9"/><path d="M8 8l2.8 2.8"/></svg>
|
||||
|
After Width: | Height: | Size: 221 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.15" stroke-linecap="round" stroke-linejoin="round"><path d="M7 1.8a5.2 5.2 0 1 0 0 10.4A5.2 5.2 0 0 0 7 1.8zM1.8 7h10.4M7 1.8c1.6 1.6 1.6 8.8 0 10.4M7 1.8c-1.6 1.6-1.6 8.8 0 10.4"/></svg>
|
||||
|
After Width: | Height: | Size: 321 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.15" stroke-linecap="round" stroke-linejoin="round"><path d="M2.2 2.2h9.6v9.6H2.2zM4.4 5.2L6 6.6 4.4 8M7.2 8.4h2.4"/></svg>
|
||||
|
After Width: | Height: | Size: 256 B |
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.15" stroke-linecap="round" stroke-linejoin="round"><path d="M2.2 4.2h7.6v7.6H2.2zM4.2 2.2h7.6v7.6"/></svg>
|
||||
|
After Width: | Height: | Size: 240 B |
@@ -266,7 +266,7 @@ fn ancestor_pids(procs: &[crate::daemon::winproc::Proc]) -> Vec<u32> {
|
||||
out
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
|
||||
pub enum HookAgent {
|
||||
Claude,
|
||||
Codex,
|
||||
|
||||
@@ -15,9 +15,8 @@ section something is in.
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="General" icon="sliders">
|
||||
Interface language, startup and layout restore, tray icon, default terminal,
|
||||
command completion notifications, update preferences and proxy, and the
|
||||
tty7 server.
|
||||
Interface language, default terminal, startup window, size and layout
|
||||
restore, tray icon, and command completion notifications.
|
||||
</Card>
|
||||
<Card title="Appearance" icon="palette" href="/customization/themes">
|
||||
Theme and colors, interface and terminal fonts, cursor, background image,
|
||||
@@ -34,30 +33,36 @@ section something is in.
|
||||
Tab position and placement, sidebar grouping, and diff previews.
|
||||
</Card>
|
||||
<Card title="SSH" icon="server" href="/remote/ssh">
|
||||
Hosts, connection defaults, security, authentication, proxies, and forwarding.
|
||||
Recent and saved hosts, each opened and edited in place, and host key
|
||||
security.
|
||||
</Card>
|
||||
<Card title="Integrations" icon="robot" href="/agents/status">
|
||||
AI agent hooks per machine and the tty7 command on PATH.
|
||||
</Card>
|
||||
<Card title="About" icon="circle-info" href="/reference/updates">
|
||||
App information, version, manual update checks, and available updates.
|
||||
Version and update checks, update preferences and proxy, the settings
|
||||
file, and the tty7 server.
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
## Search and edit
|
||||
|
||||
Search matches setting names, descriptions, English aliases, and configuration
|
||||
keys such as `mouse_zoom_modifier`. Ordinary results are editable directly;
|
||||
use the path above a result to open its category. SSH, theme editors, and
|
||||
keyboard shortcuts have dedicated views.
|
||||
keys such as `mouse_zoom_modifier`. Results are grouped by section and are
|
||||
editable directly; click a section name to open it. Press ⌘F (Ctrl+F) to jump
|
||||
to the search box.
|
||||
|
||||
Use **Modified only** to find settings that differ from their defaults. A
|
||||
modified setting offers **Reset setting**; installation and maintenance actions
|
||||
modified setting offers **Reset** beside its name; installation and maintenance actions
|
||||
do not have a generic reset.
|
||||
|
||||
Ordinary controls save automatically. Text fields commit valid values on Enter
|
||||
or when focus leaves the field. Custom theme edits are previewed until you save;
|
||||
cancel restores the original theme. SSH profiles also use explicit saving.
|
||||
cancel restores the original theme. SSH hosts also use explicit saving.
|
||||
|
||||
Recording a keyboard shortcut that another action already uses asks before
|
||||
taking it over: **Replace** moves the shortcut, **Cancel** leaves both as they
|
||||
were.
|
||||
Leaving an edited form offers save, discard, or continue editing.
|
||||
|
||||
## The settings file
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
pub use tty7_core::core::session::{
|
||||
RemoteRef, RemoteTarget, RouteSnapshot, Session, SessionAxis, SessionPane, SessionTab,
|
||||
WindowView, WindowViews, WorkspaceId,
|
||||
RemoteRef, RemoteTarget, Session, SessionAxis, SessionPane, SessionTab, WindowView,
|
||||
WindowViews, WorkspaceId,
|
||||
};
|
||||
pub use tty7_core::host::HostId;
|
||||
|
||||
|
||||
@@ -47,6 +47,36 @@ fn agent_icon(path: &str) -> Option<&'static [u8]> {
|
||||
"icons/machine-local.svg" => include_bytes!("../../assets/icons/machine-local.svg"),
|
||||
"icons/machine-remote.svg" => include_bytes!("../../assets/icons/machine-remote.svg"),
|
||||
"icons/refresh.svg" => include_bytes!("../../assets/icons/refresh.svg"),
|
||||
"icons/settings/about.svg" => include_bytes!("../../assets/icons/settings/about.svg"),
|
||||
"icons/settings/appearance.svg" => {
|
||||
include_bytes!("../../assets/icons/settings/appearance.svg")
|
||||
}
|
||||
"icons/settings/back.svg" => include_bytes!("../../assets/icons/settings/back.svg"),
|
||||
"icons/settings/check.svg" => include_bytes!("../../assets/icons/settings/check.svg"),
|
||||
"icons/settings/chevron-down.svg" => {
|
||||
include_bytes!("../../assets/icons/settings/chevron-down.svg")
|
||||
}
|
||||
"icons/settings/chevron-right.svg" => {
|
||||
include_bytes!("../../assets/icons/settings/chevron-right.svg")
|
||||
}
|
||||
"icons/settings/close.svg" => include_bytes!("../../assets/icons/settings/close.svg"),
|
||||
"icons/settings/general.svg" => include_bytes!("../../assets/icons/settings/general.svg"),
|
||||
"icons/settings/integrations.svg" => {
|
||||
include_bytes!("../../assets/icons/settings/integrations.svg")
|
||||
}
|
||||
"icons/settings/keyboard.svg" => include_bytes!("../../assets/icons/settings/keyboard.svg"),
|
||||
"icons/settings/machine-local.svg" => {
|
||||
include_bytes!("../../assets/icons/settings/machine-local.svg")
|
||||
}
|
||||
"icons/settings/machine-remote.svg" => {
|
||||
include_bytes!("../../assets/icons/settings/machine-remote.svg")
|
||||
}
|
||||
"icons/settings/more.svg" => include_bytes!("../../assets/icons/settings/more.svg"),
|
||||
"icons/settings/plus.svg" => include_bytes!("../../assets/icons/settings/plus.svg"),
|
||||
"icons/settings/search.svg" => include_bytes!("../../assets/icons/settings/search.svg"),
|
||||
"icons/settings/ssh.svg" => include_bytes!("../../assets/icons/settings/ssh.svg"),
|
||||
"icons/settings/terminal.svg" => include_bytes!("../../assets/icons/settings/terminal.svg"),
|
||||
"icons/settings/window.svg" => include_bytes!("../../assets/icons/settings/window.svg"),
|
||||
"icons/agents/claude.svg" => include_bytes!("../../assets/icons/agents/claude.svg"),
|
||||
"icons/agents/codex.svg" => include_bytes!("../../assets/icons/agents/codex.svg"),
|
||||
"icons/agents/traecli.svg" => include_bytes!("../../assets/icons/agents/traecli.svg"),
|
||||
|
||||
@@ -463,8 +463,7 @@ impl Tty7App {
|
||||
)
|
||||
})
|
||||
.when(advanced, |form| {
|
||||
form.child(self.segmented_on(
|
||||
sf,
|
||||
form.child(self.segmented(
|
||||
"ssh-managed-forward-kind",
|
||||
&[
|
||||
t(L10nKey::ForwardLocal),
|
||||
|
||||
@@ -2,6 +2,74 @@ use super::L10nKey;
|
||||
|
||||
pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
match key {
|
||||
L10nKey::SettingsNoMatchesShort => "No matches",
|
||||
L10nKey::SettingsModifiedTitle => "Modified",
|
||||
L10nKey::SettingsMatchCount => "{count} matches",
|
||||
L10nKey::SettingsNothingModified => "Nothing changed from defaults",
|
||||
L10nKey::SettingsKeyThen => "then",
|
||||
L10nKey::SettingsStartupRestore => "Startup & restore",
|
||||
L10nKey::SettingsSettingsFile => "Settings file",
|
||||
L10nKey::SettingsReveal => "Reveal",
|
||||
L10nKey::SettingsThemeModeSystem => "System",
|
||||
L10nKey::SettingsThemeModeSystemDesc => {
|
||||
"Match the system, switching between a light and a dark theme."
|
||||
}
|
||||
L10nKey::SettingsThemeModeLightDesc => "Always use a light theme.",
|
||||
L10nKey::SettingsThemeModeDarkDesc => "Always use a dark theme.",
|
||||
L10nKey::SettingsThemeSlotLightDesc => "Used while the system is in light mode.",
|
||||
L10nKey::SettingsThemeSlotDarkDesc => "Used while the system is in dark mode.",
|
||||
L10nKey::SettingsThemeSlotDesc => "Theme for the terminal and interface.",
|
||||
L10nKey::SettingsLightThemeLabel => "Light theme",
|
||||
L10nKey::SettingsDarkThemeLabel => "Dark theme",
|
||||
L10nKey::SettingsNoThemesMatch => "No themes match",
|
||||
L10nKey::SettingsRestoreChanged => "Restore {count} changed",
|
||||
L10nKey::SettingsShortcutsHint => {
|
||||
"Click a shortcut and press new keys. Press a second chord right after to make a sequence. Esc cancels, ⌫ clears."
|
||||
}
|
||||
L10nKey::SettingsShortcutsHintTmux => {
|
||||
"tmux preset: pane and tab actions use a prefix key. Click a shortcut to change it; Esc cancels, ⌫ clears."
|
||||
}
|
||||
L10nKey::SettingsShortcutConflict => {
|
||||
"{keys} is already used by “{action}”. Replacing takes it from there."
|
||||
}
|
||||
L10nKey::SettingsReplace => "Replace",
|
||||
L10nKey::SettingsNoActionsMatch => "No actions match “{query}”",
|
||||
L10nKey::SettingsSearchShortcuts => "Search actions or keys",
|
||||
L10nKey::SettingsHostsDesc => "Recently used hosts. Search to find any saved host.",
|
||||
L10nKey::SettingsAddHost => "Add host",
|
||||
L10nKey::SettingsNoHostsMatch => "No hosts match “{query}”",
|
||||
L10nKey::SettingsHostsFromFiles => "{count} hosts from {files} sources",
|
||||
L10nKey::SettingsMoreHosts => "{count} more hosts",
|
||||
L10nKey::SettingsShowRecentOnly => "Show recent only",
|
||||
L10nKey::SettingsShowAll => "Show all",
|
||||
L10nKey::SettingsUnsaved => "Unsaved",
|
||||
L10nKey::SettingsNever => "Never",
|
||||
L10nKey::SettingsDefinedIn => "Defined in",
|
||||
L10nKey::SettingsConnectInNewTab => "Connect in new tab",
|
||||
L10nKey::SettingsCopied => "Copied",
|
||||
L10nKey::SettingsCopySshCommand => "Copy ssh command",
|
||||
L10nKey::SettingsStoredInTty7 => "Stored in tty7 settings",
|
||||
L10nKey::SettingsClickAgainToRemove => "Click again to remove",
|
||||
L10nKey::SettingsRemoveHost => "Remove host",
|
||||
L10nKey::SettingsEditHost => "Edit",
|
||||
L10nKey::SettingsLive => "Connected",
|
||||
L10nKey::SettingsPressKeysShort => "Press keys…",
|
||||
L10nKey::SettingsSearchAgents => "Search agents",
|
||||
L10nKey::SettingsConnectedMachines => "Connected",
|
||||
L10nKey::SettingsInstalledCount => "{count} installed",
|
||||
L10nKey::SettingsMachine => "Machine",
|
||||
L10nKey::SettingsMachineLocalDesc => {
|
||||
"Hooks are installed per machine. Remote machines appear here while connected."
|
||||
}
|
||||
L10nKey::SettingsMachineRemoteDesc => "Installing over the active connection to {name}.",
|
||||
L10nKey::SettingsAgentsInstalledSummary => "{count} of {total} installed",
|
||||
L10nKey::SettingsNoAgentsInstalled => "No agent hooks installed on this machine yet.",
|
||||
L10nKey::SettingsNoAgentsMatch => "No agents match “{query}”",
|
||||
L10nKey::SettingsMoreAgents => "{count} more agents available",
|
||||
L10nKey::SettingsShowInstalledOnly => "Show installed only",
|
||||
L10nKey::SettingsWorking => "Working…",
|
||||
L10nKey::SettingsUpdateAvailable => "Update available",
|
||||
L10nKey::SettingsRevealHookFile => "Reveal hook file",
|
||||
L10nKey::SettingsSaveError => "Changes could not be saved: {error}",
|
||||
L10nKey::SettingsRetrySave => "Retry saving",
|
||||
|
||||
@@ -102,41 +170,26 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
L10nKey::Download => "Download",
|
||||
L10nKey::Link => "Link",
|
||||
L10nKey::SettingsThemeIntroTitle => "Theme",
|
||||
L10nKey::SettingsThemeIntroDesc => {
|
||||
"Pick a color theme. Each one sets its own light or dark look."
|
||||
}
|
||||
L10nKey::SettingsThemeIntroDesc => "Each theme sets its own light or dark look.",
|
||||
L10nKey::SettingsTypography => "Typography",
|
||||
L10nKey::SettingsFontSize => "Terminal font size",
|
||||
L10nKey::SettingsFontSizeDesc => "Terminal text size in pixels.",
|
||||
L10nKey::SettingsUiFontSize => "Interface font size",
|
||||
L10nKey::SettingsUiFontSizeDesc => {
|
||||
"Text size everywhere outside the terminal — tabs, panels and settings. \
|
||||
Raise it on a display that is not Retina."
|
||||
}
|
||||
L10nKey::SettingsUiFontSizeDesc => "Text size for tabs, panels and settings.",
|
||||
L10nKey::SettingsUiFontFamily => "Interface font",
|
||||
L10nKey::SettingsUiFontFamilyDesc => {
|
||||
"Face used for tabs, sidebars, dialogs and settings; Default uses the system UI font."
|
||||
}
|
||||
L10nKey::SettingsUiFontFamilyDesc => "For tabs, sidebars, dialogs and settings.",
|
||||
L10nKey::SettingsLineHeight => "Line height",
|
||||
L10nKey::SettingsLineHeightDesc => "Row spacing as a multiple of the font size.",
|
||||
L10nKey::SettingsFontFamily => "Terminal font",
|
||||
L10nKey::SettingsFontFamilyDesc => "Pick from fonts installed on your system.",
|
||||
L10nKey::SettingsBoldFont => "Bold font",
|
||||
L10nKey::SettingsBoldFontDesc => {
|
||||
"Face for bold text; Default synthesizes it from the primary."
|
||||
}
|
||||
L10nKey::SettingsBoldFontDesc => "Bold face; Default derives it from the main font.",
|
||||
L10nKey::SettingsItalicFont => "Italic font",
|
||||
L10nKey::SettingsItalicFontDesc => {
|
||||
"Face for italic text; Default synthesizes it from the primary."
|
||||
}
|
||||
L10nKey::SettingsItalicFontDesc => "Italic face; Default derives it from the main font.",
|
||||
L10nKey::SettingsFontLigatures => "Font ligatures",
|
||||
L10nKey::SettingsFontLigaturesDesc => {
|
||||
"Enable common programming ligature features for terminal text."
|
||||
}
|
||||
L10nKey::SettingsFontLigaturesDesc => "Programming ligatures in terminal text.",
|
||||
L10nKey::SettingsFontThicken => "Thicken strokes",
|
||||
L10nKey::SettingsFontThickenDesc => {
|
||||
"macOS font smoothing: draws text a little bolder, light text most. Takes effect after restarting tty7."
|
||||
}
|
||||
L10nKey::SettingsFontThickenDesc => "Draw text slightly bolder. Applies after a restart.",
|
||||
L10nKey::SettingsCursor => "Cursor",
|
||||
L10nKey::SettingsCursorShape => "Cursor shape",
|
||||
L10nKey::SettingsCursorShapeDesc => "How the terminal cursor is drawn.",
|
||||
@@ -150,9 +203,7 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
L10nKey::SettingsSearchLanguageKeywords => "language, locale, english, chinese",
|
||||
L10nKey::SettingsTransparency => "Transparency",
|
||||
L10nKey::SettingsOpacity => "Opacity",
|
||||
L10nKey::SettingsOpacityDesc => {
|
||||
"How opaque the window background is, for every theme. Below 100% the desktop shows through."
|
||||
}
|
||||
L10nKey::SettingsOpacityDesc => "Below 100%, the desktop shows through.",
|
||||
L10nKey::SettingsBlur => "Blur",
|
||||
L10nKey::SettingsBlurDesc => {
|
||||
if cfg!(target_os = "macos") {
|
||||
@@ -161,13 +212,9 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
"Blur whatever is behind a translucent window. Needs a compositor that offers it — KDE Plasma does; GNOME and plain X11 leave the window merely transparent."
|
||||
}
|
||||
}
|
||||
L10nKey::SettingsBlurAutoDesc => {
|
||||
"Blur whatever is behind a translucent window. Only applies while Background material is Auto."
|
||||
}
|
||||
L10nKey::SettingsBlurAutoDesc => "Blur behind a translucent window. Auto material only.",
|
||||
L10nKey::SettingsBackdrop => "Background material",
|
||||
L10nKey::SettingsBackdropDesc => {
|
||||
"Native Windows backdrop behind a translucent window. Mica needs Windows 11 22H2, Acrylic needs 1809; older builds fall back automatically."
|
||||
}
|
||||
L10nKey::SettingsBackdropDesc => "Native backdrop behind a translucent window.",
|
||||
L10nKey::SettingsSearchBackdropKeywords => {
|
||||
"material backdrop mica acrylic blur frosted window background"
|
||||
}
|
||||
@@ -180,7 +227,7 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
L10nKey::FollowTheme => "Follow theme",
|
||||
L10nKey::SettingsDimInactivePanes => "Dim inactive panes",
|
||||
L10nKey::SettingsDimInactivePanesDesc => {
|
||||
"Fade unfocused panes in a split so the active one stands out."
|
||||
"Fade unfocused panes so the active one stands out."
|
||||
}
|
||||
L10nKey::SettingsOpenThemesFolder => "Open themes folder",
|
||||
L10nKey::SettingsChangeThemeImage => "Change…",
|
||||
@@ -192,7 +239,7 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
}
|
||||
L10nKey::SettingsEditTheme => "Edit theme",
|
||||
L10nKey::SettingsEditThemeIntro => {
|
||||
"You're editing a copy. Changes save to its file in the themes folder and apply live."
|
||||
"Editing a copy. Changes apply live and save to its file."
|
||||
}
|
||||
L10nKey::SettingsBackgroundImage => "Background image",
|
||||
L10nKey::SettingsBackgroundImageDesc => {
|
||||
@@ -207,7 +254,7 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
L10nKey::ExplorerMenuOpenIn => "Open in tty7",
|
||||
L10nKey::ExplorerMenuOpenHere => "Open tty7 here",
|
||||
L10nKey::SettingsCustomThemesIntro => {
|
||||
"Duplicate a theme to edit its colors, or drop a tty7 YAML theme or iTerm2 .itermcolors file in the themes folder."
|
||||
"Duplicate a theme to edit it, or drop a YAML or .itermcolors file into the themes folder."
|
||||
}
|
||||
L10nKey::SettingsDuplicateToEdit => "Duplicate to edit",
|
||||
L10nKey::SettingsHosts => "Hosts",
|
||||
@@ -226,9 +273,7 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
L10nKey::SettingsMoreInSshConfig => "{count} more in ~/.ssh/config",
|
||||
L10nKey::SettingsAliasesLinked => "{count} aliases linked.",
|
||||
L10nKey::SettingsImportAliases => "Import aliases",
|
||||
L10nKey::SettingsImportAliasesDesc => {
|
||||
"Re-reads the file and adds anything new. Edits you make here are stored by tty7 — the file itself is never written."
|
||||
}
|
||||
L10nKey::SettingsImportAliasesDesc => "Re-read the file and add anything new.",
|
||||
L10nKey::SettingsImportNow => "Import now",
|
||||
L10nKey::SettingsImportUnreadable => "Could not read {path} — nothing was imported.",
|
||||
L10nKey::SettingsImportNoHosts => {
|
||||
@@ -242,7 +287,7 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
}
|
||||
L10nKey::SettingsImportMoreOptions => "+{count} more",
|
||||
L10nKey::SettingsDefaultsIntro => {
|
||||
"Every host starts from these. Any host can override one under its own Advanced."
|
||||
"Every host starts here; override any under its Advanced."
|
||||
}
|
||||
L10nKey::SettingsCopyAddress => "Copy Address",
|
||||
L10nKey::SettingsDuplicate => "Duplicate",
|
||||
@@ -265,16 +310,14 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
"Could not forget the saved password for {endpoint}: {error}"
|
||||
}
|
||||
L10nKey::SettingsSecurity => "Security",
|
||||
L10nKey::SettingsSecurityIntro => {
|
||||
"A host can override either of these under its own Advanced."
|
||||
}
|
||||
L10nKey::SettingsSecurityIntro => "Any host can override these under its Advanced.",
|
||||
L10nKey::SettingsVerifyHostKeys => "Verify host keys",
|
||||
L10nKey::SettingsVerifyHostKeysDesc => {
|
||||
"Check each server's key against known_hosts before connecting. Off skips the check, so a spoofed server would go unnoticed."
|
||||
"Check server keys against known_hosts. Off, a spoofed server goes unnoticed."
|
||||
}
|
||||
L10nKey::WarnBeforeClosing => "Warn before closing",
|
||||
L10nKey::SettingsWarnBeforeClosingDesc => {
|
||||
"Ask for confirmation before closing a tab or pane with a live SSH session."
|
||||
"Confirm before closing a tab with a live SSH session."
|
||||
}
|
||||
L10nKey::SettingsNewHost => "New host",
|
||||
L10nKey::SettingsDiscardChangesTitle => "Discard unsaved changes?",
|
||||
@@ -288,7 +331,7 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
L10nKey::SettingsPortInvalid => "Port must be 1-65535 — blank means 22.",
|
||||
L10nKey::SettingsUser => "User",
|
||||
L10nKey::SettingsAuth => "Auth",
|
||||
L10nKey::SettingsAuthDesc => "Authentication method. Auto tries every applicable method.",
|
||||
L10nKey::SettingsAuthDesc => "Auto tries every applicable method.",
|
||||
L10nKey::SettingsAuthModeAuto => "Auto",
|
||||
L10nKey::SettingsAuthModePassword => "Password",
|
||||
L10nKey::SettingsAuthModeKey => "Key",
|
||||
@@ -313,9 +356,7 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
"Could not save the passphrase for {key}: {error}"
|
||||
}
|
||||
L10nKey::SettingsJumpHost => "Jump host",
|
||||
L10nKey::SettingsJumpHostDesc => {
|
||||
"Name of another profile to tunnel through (blank = direct)."
|
||||
}
|
||||
L10nKey::SettingsJumpHostDesc => "Profile to tunnel through; blank connects directly.",
|
||||
L10nKey::SettingsJumpHostUnknown => "No host profile named {jump_name} — won't be saved.",
|
||||
L10nKey::SettingsJumpHostSelf => "A host can't be its own jump host — won't be saved.",
|
||||
L10nKey::SettingsNoneSummary => "(none)",
|
||||
@@ -342,7 +383,7 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
L10nKey::SettingsGroupSecurity => "Security",
|
||||
L10nKey::SettingsRemoteClipboardWrite => "Remote clipboard images",
|
||||
L10nKey::SettingsRemoteClipboardWriteDesc => {
|
||||
"Allow programs on this host to replace the local clipboard with images over OSC 5522."
|
||||
"Let this host put images on your clipboard (OSC 5522)."
|
||||
}
|
||||
L10nKey::SettingsIdentityFiles => "Identity files",
|
||||
L10nKey::SettingsIdentityFilesDesc => "Private-key paths, one per line (%h/%r expand).",
|
||||
@@ -408,7 +449,7 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
}
|
||||
L10nKey::SettingsShellIntegration => "Shell integration",
|
||||
L10nKey::SettingsShellIntegrationDesc => {
|
||||
"Let the remote shell report prompts, exit codes, and the working directory."
|
||||
"Remote shell reports prompts, exit codes and directory."
|
||||
}
|
||||
L10nKey::SettingsLoginScripts => "Login scripts",
|
||||
L10nKey::SettingsLoginScriptsDesc => "Commands sent after the shell opens, one per line.",
|
||||
@@ -421,24 +462,16 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
L10nKey::SettingsOn => "On",
|
||||
L10nKey::SettingsOff => "Off",
|
||||
L10nKey::SettingsShell => "Shell",
|
||||
L10nKey::SettingsShellIntro => {
|
||||
"The program each new terminal launches. Leave Shell program empty to use the platform default ({default})."
|
||||
}
|
||||
L10nKey::SettingsShellIntro => "The program new terminals launch. Empty uses {default}.",
|
||||
L10nKey::SettingsProgram => "Shell program",
|
||||
L10nKey::SettingsProgramDesc => {
|
||||
"Executable name on PATH or an absolute path (e.g. zsh, fish, pwsh)."
|
||||
}
|
||||
L10nKey::SettingsProgramDesc => "A name on PATH or an absolute path, e.g. zsh, fish.",
|
||||
L10nKey::SettingsArguments => "Shell arguments",
|
||||
L10nKey::SettingsArgumentsDesc => {
|
||||
"Launch flags, split like a command line — quote anything containing spaces (e.g. -l, or -c \"echo hi\")."
|
||||
}
|
||||
L10nKey::SettingsArgumentsDesc => "Split like a command line, e.g. -l or -c \"echo hi\".",
|
||||
L10nKey::SettingsArgumentsInvalid => {
|
||||
"The quotes do not balance — this value was not saved."
|
||||
}
|
||||
L10nKey::SettingsStartIn => "Starting directory",
|
||||
L10nKey::SettingsStartInDesc => {
|
||||
"What a fresh shell starts in: tty7's launch directory, your home folder, or a fixed path."
|
||||
}
|
||||
L10nKey::SettingsStartInDesc => "Launch directory, home folder, or a fixed path.",
|
||||
L10nKey::SettingsCustomPath => "Custom path",
|
||||
L10nKey::SettingsCustomPathDesc => "The directory new shells start in.",
|
||||
L10nKey::SettingsWdInherit => "Inherit",
|
||||
@@ -448,7 +481,7 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
"That directory does not exist — the value was not saved."
|
||||
}
|
||||
L10nKey::SettingsShellFooter => {
|
||||
"Applies to shells with nothing to inherit, like a window's first tab. New tabs and splits still inherit the active pane's directory; open shells keep running."
|
||||
"Only for shells with nothing to inherit, like a window's first tab. New tabs and splits take the active pane's directory."
|
||||
}
|
||||
L10nKey::SettingsScrolling => "Scrolling",
|
||||
L10nKey::SettingsScrollback => "Scrollback buffer",
|
||||
@@ -457,45 +490,37 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
L10nKey::SettingsScrollSpeedDesc => "Multiplier applied to mouse-wheel scrolling.",
|
||||
L10nKey::SettingsSmoothScroll => "Smooth scrolling",
|
||||
L10nKey::SettingsSmoothScrollDesc => {
|
||||
"Ease each wheel notch into place instead of jumping the whole way at once. \
|
||||
Trackpads scroll continuously already and are unaffected."
|
||||
"Ease each wheel notch into place. Trackpads are unaffected."
|
||||
}
|
||||
L10nKey::SettingsMouse => "Mouse",
|
||||
L10nKey::SettingsFocusFollowsMouse => "Focus follows mouse",
|
||||
L10nKey::SettingsFocusFollowsMouseDesc => "Hovering a pane focuses it without a click.",
|
||||
L10nKey::SettingsHideMouseWhileTyping => "Hide mouse while typing",
|
||||
L10nKey::SettingsHideMouseWhileTypingDesc => {
|
||||
"Hide the pointer as you type; it returns on the next move."
|
||||
"Hide the pointer while typing; moving brings it back."
|
||||
}
|
||||
L10nKey::SettingsMouseZoom => "Zoom with the wheel",
|
||||
L10nKey::SettingsMouseZoomDesc => {
|
||||
"Modifier that makes the mouse wheel resize the terminal font instead of scrolling."
|
||||
}
|
||||
L10nKey::SettingsMouseZoomDesc => "Hold it and scroll to resize the terminal font.",
|
||||
L10nKey::SettingsMouseZoomOff => "Off",
|
||||
L10nKey::SettingsReportMouseToApps => "Report mouse to apps",
|
||||
L10nKey::SettingsReportMouseToAppsDesc => {
|
||||
"Let full-screen apps (vim, tmux) handle clicks and scrolling; hold Shift to keep a gesture local. \
|
||||
Off keeps clicks from reaching them and turns the wheel into arrow keys."
|
||||
"Let vim, tmux and other apps handle clicks; Shift keeps it local."
|
||||
}
|
||||
L10nKey::SettingsBell => "Bell",
|
||||
L10nKey::SettingsTerminalBell => "Terminal bell",
|
||||
L10nKey::SettingsTerminalBellDesc => {
|
||||
"How a bell (^G) is signalled: silenced, a brief flash, the system sound, or both."
|
||||
}
|
||||
L10nKey::SettingsTerminalBellDesc => "How a bell (^G) is signalled.",
|
||||
L10nKey::SettingsLinks => "Links",
|
||||
L10nKey::DetectUrls => "Detect URLs",
|
||||
L10nKey::SettingsDetectUrlsDesc => {
|
||||
"Underline links on hover and open them on {modifier}-click."
|
||||
}
|
||||
L10nKey::SettingsDetectUrlsDesc => "Underline links on hover; {modifier}-click opens them.",
|
||||
L10nKey::ForwardSshLoopbackLinks => "Forward remote ports",
|
||||
L10nKey::SettingsForwardSshLoopbackLinksDesc => {
|
||||
"Over SSH, forward the ports a pane starts serving and open its localhost links here."
|
||||
"Open a remote pane's localhost links here."
|
||||
}
|
||||
L10nKey::SettingsOpenFilesInternal => "Built-in editor",
|
||||
L10nKey::SettingsOpenFilesSystem => "Default app",
|
||||
L10nKey::SettingsOpenFilesCommand => "Command",
|
||||
L10nKey::SettingsOpenFilesModeDesc => {
|
||||
"What a {modifier}-clicked file link opens. Only the built-in editor can jump to a line or open a file on a remote host."
|
||||
"What {modifier}-clicking a file link opens. Only the built-in editor jumps to a line or opens remote files."
|
||||
}
|
||||
L10nKey::LinkFileNotUnder => "{path} — nothing by that name under {dir}",
|
||||
L10nKey::LinkFileNoDirectory => {
|
||||
@@ -507,7 +532,7 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
}
|
||||
L10nKey::OpenFilesWith => "Open files with",
|
||||
L10nKey::SettingsOpenFilesWithDesc => {
|
||||
"Command run when {modifier}-clicking a file link. Use {path}, {line}, {column} — a flag whose value is missing is dropped. Empty uses the default app."
|
||||
"Use {path}, {line}, {column}. Empty uses the default app."
|
||||
}
|
||||
L10nKey::SettingsBellModeOff => "Off",
|
||||
L10nKey::SettingsBellModeVisual => "Visual",
|
||||
@@ -515,27 +540,27 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
L10nKey::SettingsBellModeBoth => "Both",
|
||||
L10nKey::SettingsPrompt => "Prompt & command history",
|
||||
L10nKey::SettingsPromptIntro => {
|
||||
"tty7's own editor and menus at the shell prompt. Turn one off to hand that much back to the shell."
|
||||
"tty7's own editor and menus at the prompt. Turn one off to use the shell's."
|
||||
}
|
||||
L10nKey::SettingsPromptEditor => "tty7 prompt editor",
|
||||
L10nKey::SettingsPromptEditorDesc => {
|
||||
"tty7 edits the line you type at the shell prompt: selection, undo, and the menus below. Off hands the prompt back to the shell's own editor — ZLE, readline, fish."
|
||||
"Selection, undo and menus on the line you type. Off hands it back to ZLE, readline or fish."
|
||||
}
|
||||
L10nKey::SettingsNeedsPromptEditor => {
|
||||
"Needs the prompt editor: with it off, this key already belongs to the shell."
|
||||
}
|
||||
L10nKey::SettingsTabCompletion => "Tab completion",
|
||||
L10nKey::SettingsTabCompletionDesc => {
|
||||
"Tab at the prompt opens tty7's completion menu. When off, Tab goes to the shell's own completion instead."
|
||||
"Tab opens tty7's completion menu. Off, Tab goes to the shell."
|
||||
}
|
||||
L10nKey::SettingsHistorySearch => "Command history search",
|
||||
L10nKey::SettingsHistorySearchDesc => {
|
||||
"⌃R at the prompt opens tty7's fuzzy history menu. Off sends ⌃R to the shell — its own reverse-i-search, or whatever you bound there (fzf, percol)."
|
||||
"⌃R opens tty7's fuzzy history search. Off, ⌃R goes to the shell."
|
||||
}
|
||||
L10nKey::SettingsSelectionClipboard => "Selection & clipboard",
|
||||
L10nKey::SettingsSmartSelection => "Smart selection",
|
||||
L10nKey::SettingsSmartSelectionDesc => {
|
||||
"Double-click selects the whole URL, file path, email, or bracket pair under the cursor."
|
||||
"Double-click selects a whole URL, path or bracket pair."
|
||||
}
|
||||
L10nKey::SettingsCopyOnSelect => "Copy on select",
|
||||
L10nKey::SettingsCopyOnSelectDesc => {
|
||||
@@ -551,12 +576,10 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
}
|
||||
L10nKey::SettingsKeyboard => "Keyboard",
|
||||
L10nKey::SettingsOptionAsMeta => "Option (⌥) acts as Meta",
|
||||
L10nKey::SettingsOptionAsMetaDesc => {
|
||||
"⌥+key sends the escape chord shells expect (⌥B = back one word) instead of typing a special character (∫)."
|
||||
}
|
||||
L10nKey::SettingsAgentsIntro => "AI agents",
|
||||
L10nKey::SettingsOptionAsMetaDesc => "⌥+key sends Meta, e.g. ⌥B moves back a word.",
|
||||
L10nKey::SettingsAgentsIntro => "Agent hooks",
|
||||
L10nKey::SettingsAgentsIntroDesc => {
|
||||
"Hooks give panes running these agents live status (working / waiting / done) in the tab bar. Only inside tty7."
|
||||
"Hooks show each agent's status — working, waiting, done — in the tab bar."
|
||||
}
|
||||
L10nKey::SettingsReadingAgentConfig => "Reading this machine's agent config…",
|
||||
L10nKey::SettingsStatusNotInstalled => "Not installed",
|
||||
@@ -569,14 +592,10 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
L10nKey::SettingsOfflineMachines => {
|
||||
"{count} more saved machines are not connected — open a workspace on one to install its hooks there."
|
||||
}
|
||||
L10nKey::SettingsSyncWithSystem => "Sync with system",
|
||||
L10nKey::SettingsSyncWithSystemDesc => {
|
||||
"Follow the OS appearance with separate light and dark themes."
|
||||
}
|
||||
L10nKey::SettingsSyncWithSystem => "Appearance",
|
||||
L10nKey::SettingsSyncWithSystemDesc => "Separate light and dark themes that follow the OS.",
|
||||
L10nKey::SettingsLegiblePalette => "Legible bright colors",
|
||||
L10nKey::SettingsLegiblePaletteDesc => {
|
||||
"Automatically brighten or darken bright ANSI colors that would be unreadable on the theme background."
|
||||
}
|
||||
L10nKey::SettingsLegiblePaletteDesc => "Fix bright ANSI colors that are hard to read.",
|
||||
L10nKey::SettingsChangeTheme => "Change theme",
|
||||
L10nKey::SettingsThemes => "Themes",
|
||||
L10nKey::SettingsThemesCloseTooltip => "Close Themes (Esc)",
|
||||
@@ -595,37 +614,31 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
L10nKey::SettingsStartupWindowDesc => "Window state when tty7 launches.",
|
||||
L10nKey::SettingsRememberWindowSize => "Remember window size & position",
|
||||
L10nKey::SettingsRememberWindowSizeDesc => {
|
||||
"Reopen at the size and position the window had when tty7 last quit. Off opens centered at the default size."
|
||||
"Reopen where the window was when tty7 last quit."
|
||||
}
|
||||
L10nKey::SettingsRestoreLastLayout => "Restore last layout",
|
||||
L10nKey::SettingsRestoreLastLayoutDesc => {
|
||||
"Reopen the last window's tabs, splits, and directories on launch. Off starts with a single fresh terminal."
|
||||
"Reopen last session's tabs, splits and directories."
|
||||
}
|
||||
L10nKey::SettingsShowTrayIcon => "Show tray icon",
|
||||
L10nKey::SettingsShowTrayIconDesc => {
|
||||
"A status item in the tray / menu bar: it signals when an agent needs input, and its menu jumps to agent panes."
|
||||
}
|
||||
L10nKey::SettingsShowTrayIconDesc => "Alerts when an agent needs input; jumps to its pane.",
|
||||
L10nKey::SettingsTabs => "Tabs",
|
||||
L10nKey::SettingsNewTabPosition => "New tab position",
|
||||
L10nKey::SettingsNewTabPositionDesc => "Where a freshly opened tab is inserted.",
|
||||
L10nKey::SettingsTabBarPosition => "Tab bar position",
|
||||
L10nKey::SettingsTabBarPositionDesc => {
|
||||
"Show tabs as a horizontal strip on top or a vertical sidebar on the left."
|
||||
}
|
||||
L10nKey::SettingsTabBarPositionDesc => "A strip on top or a sidebar on the left.",
|
||||
L10nKey::SettingsSidebarGrouping => "Sidebar grouping",
|
||||
L10nKey::SettingsSidebarGroupingDesc => {
|
||||
"Group sidebar tabs by git repository. Tabs outside a repo collect under Scratch, or under their working directory with \"By repo or folder\". Left sidebar only."
|
||||
"Group tabs by git repository; others go under Scratch."
|
||||
}
|
||||
L10nKey::SettingsDiffPreviewFromCounts => "Open diff preview from sidebar counts",
|
||||
L10nKey::SettingsDiffPreviewFromCountsDesc => {
|
||||
"Click a row's +N −N to open the working-tree diff in an overlay. Off leaves the counts visible, just not clickable."
|
||||
}
|
||||
L10nKey::SettingsDiffPreviewFromCountsDesc => "Click a row's +N −N to open its diff.",
|
||||
L10nKey::DocumentDock => "Dock beside terminal",
|
||||
L10nKey::DocumentFill => "Fill window",
|
||||
L10nKey::SettingsNotifications => "Notifications",
|
||||
L10nKey::SettingsNotifyOnCommandFinish => "Notify on command finish",
|
||||
L10nKey::SettingsNotifyOnCommandFinishDesc => {
|
||||
"Desktop alert after a long foreground command completes."
|
||||
"Alert when a long foreground command finishes."
|
||||
}
|
||||
L10nKey::SettingsNotifyThreshold => "Minimum command duration",
|
||||
L10nKey::SettingsNotifyThresholdDesc => {
|
||||
@@ -646,18 +659,14 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
L10nKey::SettingsByRepoOrFolder => "By repo or folder",
|
||||
L10nKey::SettingsFlat => "Flat",
|
||||
L10nKey::SettingsPreset => "Preset",
|
||||
L10nKey::SettingsPresetDesc => {
|
||||
"tmux remaps pane/tab actions onto prefix sequences (e.g. Ctrl-B then C)."
|
||||
}
|
||||
L10nKey::SettingsPresetDesc => "tmux maps pane and tab actions to prefix keys (Ctrl-B C).",
|
||||
L10nKey::SettingsPrefix => "Prefix",
|
||||
L10nKey::SettingsPressKeys => "Press keys… · ⌫ for no shortcut",
|
||||
L10nKey::SettingsPauseToSaveEsc => "pause to save · Esc",
|
||||
L10nKey::SettingsKeybindingsIntroDesc => {
|
||||
"Click a shortcut, then press the new keys — it saves after a brief pause. Chain keys for a sequence like Ctrl-B then X. Esc cancels; Backspace removes the last key, or, pressed first, leaves the action with no shortcut — Reset brings the default back."
|
||||
}
|
||||
L10nKey::SettingsPrefixNote => {
|
||||
"With a prefix active, a bare prefix key reaches the shell after a ~1s pause, and prefix + an unbound key is sent through to the terminal."
|
||||
"Click a shortcut and press new keys; chain keys for sequences like Ctrl-B X. Esc cancels, Backspace clears."
|
||||
}
|
||||
L10nKey::SettingsPrefixNote => "A lone prefix key reaches the shell after ~1s.",
|
||||
L10nKey::SettingsRestoreAllDefaults => "Restore all defaults",
|
||||
L10nKey::SettingsRestoreAllDefaultsBody => {
|
||||
"Every key you have rebound goes back to its default. There is no undo."
|
||||
@@ -670,11 +679,11 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
L10nKey::KeybindForkSessionDown => "Fork Session Down",
|
||||
L10nKey::KeybindForkSessionUp => "Fork Session Up",
|
||||
L10nKey::SettingsAboutDesc1 => {
|
||||
"A terminal workbench: persistent sessions, remote work, agents."
|
||||
"A terminal workbench for long-running work. Sessions outlive the window, remote hosts feel local, and coding agents report their status right in the sidebar."
|
||||
}
|
||||
L10nKey::SettingsDefaultTerminal => "Default terminal",
|
||||
L10nKey::SettingsDefaultTerminalDesc => {
|
||||
"Make tty7 the macOS default terminal for Unix executables, SSH links, and man-page links. tty7 can also open folders and scripts, but does not replace Finder's folder handler. Apps that choose their own terminal may ignore this setting."
|
||||
"Open Unix executables, SSH links and man pages in tty7."
|
||||
}
|
||||
L10nKey::SettingsDefaultTerminalSet => "Set as Default Terminal",
|
||||
L10nKey::SettingsDefaultTerminalSetSuccess => {
|
||||
@@ -707,17 +716,17 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
L10nKey::SettingsUpdateDiscard => "Discard",
|
||||
L10nKey::SettingsAutoDownload => "Download updates in the background",
|
||||
L10nKey::SettingsAutoDownloadDesc => {
|
||||
"Download and verify a new release as soon as it is found, so installing is just a restart. Nothing installs without asking. Packages are around 30 MB."
|
||||
"Download updates in the background so installing is just a restart. Nothing installs without asking."
|
||||
}
|
||||
L10nKey::SettingsUpdateChannel => "Update channel",
|
||||
L10nKey::SettingsUpdateChannelDesc => {
|
||||
"Stable follows published releases. Nightly rebuilds from the latest code every night — newer, but not release-tested."
|
||||
"Nightly builds the latest code every night, untested."
|
||||
}
|
||||
L10nKey::SettingsUpdateChannelStable => "Stable",
|
||||
L10nKey::SettingsUpdateChannelNightly => "Nightly",
|
||||
L10nKey::SettingsDaemonStale => "tty7 server is still running {build}.",
|
||||
L10nKey::SettingsDaemonStaleDesc => {
|
||||
"tty7 was updated in place: the app is new, your panes are still served by the old build. Restarting tty7 server picks up the new one and ends everything running in your panes. No hurry — do it when they're idle."
|
||||
"tty7 was updated, but your panes still run on the old server. Restarting it loads the new build and ends everything running in them."
|
||||
}
|
||||
L10nKey::UpdateDialogTitle => "Update available",
|
||||
L10nKey::UpdateDialogDetail => {
|
||||
@@ -764,22 +773,18 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
}
|
||||
L10nKey::SettingsVersionAvailable => "Version {version} is available.",
|
||||
L10nKey::SettingsCheckUpdatesDesc => {
|
||||
"Installations that cannot update in place open the release page instead."
|
||||
"Opens the release page if tty7 can't update in place."
|
||||
}
|
||||
L10nKey::SettingsCheckUpdatesOnLaunch => "Check for updates on launch",
|
||||
L10nKey::SettingsCommandLine => "Command line",
|
||||
L10nKey::SettingsCommandLineDesc => {
|
||||
"Make the bundled tty7 command available to scripts and AI agents. Takes effect on the next launch; turning this off does not remove an existing installation."
|
||||
}
|
||||
L10nKey::SettingsCommandLineDesc => "Put the tty7 command on PATH. Applies on next launch.",
|
||||
L10nKey::SettingsInstallCliOnPath => "Install the tty7 command on PATH",
|
||||
L10nKey::SettingsServer => "tty7 server",
|
||||
L10nKey::SettingsServerDesc => {
|
||||
"Manages terminal sessions on this computer and keeps them running in the background."
|
||||
}
|
||||
L10nKey::SettingsServerDesc => "Keeps terminal sessions running in the background.",
|
||||
L10nKey::SettingsRestartServer => "Restart tty7 server…",
|
||||
L10nKey::SettingsAppHttpProxy => "Proxy for updates",
|
||||
L10nKey::SettingsAppHttpProxyDesc => {
|
||||
"Used only for tty7's update checks and downloads, not for programs in your panes. Empty follows the system proxy."
|
||||
"For tty7's update checks. Empty uses the system proxy."
|
||||
}
|
||||
L10nKey::SettingsAppHttpProxyInvalid => {
|
||||
"Not a valid proxy address — this value was not saved."
|
||||
@@ -1756,7 +1761,7 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
L10nKey::Replace => "Replace",
|
||||
L10nKey::SftpErrorInvalidOctalMode => "invalid octal mode",
|
||||
L10nKey::SettingsDaemonStaleDescInPlace => {
|
||||
"tty7 was updated in place: the app is new, your panes still run on the old build. tty7 server can swap itself for the new one without stopping, so your shells carry straight over. Panes on tty7's built-in SSH client are the exception — those close and need reopening."
|
||||
"tty7 was updated. The server can swap itself in place and keep your shells; only built-in SSH panes close."
|
||||
}
|
||||
L10nKey::AppRestartServerBodyInPlace => {
|
||||
"tty7 server swaps itself for this build in place: your shells keep running, and the window reconnects a moment later. Panes on tty7's built-in SSH client are the exception — those close and need reopening."
|
||||
@@ -1766,7 +1771,7 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
}
|
||||
L10nKey::SettingsPerPaneHistory => "Separate command history per pane",
|
||||
L10nKey::SettingsPerPaneHistoryDescription => {
|
||||
"Up walks through what you ran in this pane, not every pane interleaved. A new pane starts from your existing history and writes back what it adds when it closes. Applies to bash and zsh panes tty7 can set up; a shell started with your own arguments is left alone."
|
||||
"↑ walks this pane's own history. bash and zsh only."
|
||||
}
|
||||
L10nKey::IntegrationNoticeBlocked => {
|
||||
"\u{201c}{wrapper}\u{201d} is intercepting shell reports in this pane, so inline completion and the Ctrl+R menu are unavailable. The shell's own history search still works."
|
||||
@@ -1911,6 +1916,18 @@ pub fn translate_en(key: L10nKey) -> &'static str {
|
||||
|
||||
pub fn translate_variant_en(key: L10nKey, branch: &'static str) -> Option<&'static str> {
|
||||
let res = match (key, branch) {
|
||||
(L10nKey::SettingsMatchCount, "zero") => "No matches",
|
||||
(L10nKey::SettingsMatchCount, "one") => "1 match",
|
||||
(L10nKey::SettingsMatchCount, "other") => "{count} matches",
|
||||
(L10nKey::SettingsRestoreChanged, "zero") => "Restore changes",
|
||||
(L10nKey::SettingsRestoreChanged, "one") => "Restore 1 changed",
|
||||
(L10nKey::SettingsRestoreChanged, "other") => "Restore {count} changed",
|
||||
(L10nKey::SettingsMoreHosts, "zero") => "No more hosts",
|
||||
(L10nKey::SettingsMoreHosts, "one") => "1 more host",
|
||||
(L10nKey::SettingsMoreHosts, "other") => "{count} more hosts",
|
||||
(L10nKey::SettingsMoreAgents, "zero") => "No more agents",
|
||||
(L10nKey::SettingsMoreAgents, "one") => "1 more agent available",
|
||||
(L10nKey::SettingsMoreAgents, "other") => "{count} more agents available",
|
||||
(L10nKey::SettingsAliasesLinked, "zero") => "No aliases linked yet.",
|
||||
(L10nKey::SettingsAliasesLinked, "one") => "1 alias linked.",
|
||||
(L10nKey::SettingsAliasesLinked, "other") => "{count} aliases linked.",
|
||||
|
||||
@@ -2,6 +2,76 @@ use super::L10nKey;
|
||||
|
||||
pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
Some(match key {
|
||||
L10nKey::SettingsNoMatchesShort => "一致なし",
|
||||
L10nKey::SettingsModifiedTitle => "変更済み",
|
||||
L10nKey::SettingsMatchCount => "{count} 件",
|
||||
L10nKey::SettingsNothingModified => "すべて既定値のままです",
|
||||
L10nKey::SettingsKeyThen => "次に",
|
||||
L10nKey::SettingsStartupRestore => "起動と復元",
|
||||
L10nKey::SettingsSettingsFile => "設定ファイル",
|
||||
L10nKey::SettingsReveal => "表示",
|
||||
L10nKey::SettingsThemeModeSystem => "システム",
|
||||
L10nKey::SettingsThemeModeSystemDesc => {
|
||||
"システムに合わせて、ライトとダークのテーマを切り替えます。"
|
||||
}
|
||||
L10nKey::SettingsThemeModeLightDesc => "常にライトテーマを使います。",
|
||||
L10nKey::SettingsThemeModeDarkDesc => "常にダークテーマを使います。",
|
||||
L10nKey::SettingsThemeSlotLightDesc => "システムがライトモードのときに使います。",
|
||||
L10nKey::SettingsThemeSlotDarkDesc => "システムがダークモードのときに使います。",
|
||||
L10nKey::SettingsThemeSlotDesc => "ターミナルとインターフェースのテーマ。",
|
||||
L10nKey::SettingsLightThemeLabel => "ライトテーマ",
|
||||
L10nKey::SettingsDarkThemeLabel => "ダークテーマ",
|
||||
L10nKey::SettingsNoThemesMatch => "一致するテーマがありません",
|
||||
L10nKey::SettingsRestoreChanged => "変更した {count} 件を戻す",
|
||||
L10nKey::SettingsShortcutsHint => {
|
||||
"ショートカットをクリックして新しいキーを押します。続けて別の組み合わせを押すとシーケンスになります。Esc で取消、⌫ で解除。"
|
||||
}
|
||||
L10nKey::SettingsShortcutsHintTmux => {
|
||||
"tmux プリセット:ペインとタブの操作はプレフィックスキーを使います。クリックで変更、Esc で取消、⌫ で解除。"
|
||||
}
|
||||
L10nKey::SettingsShortcutConflict => {
|
||||
"{keys} は「{action}」で使われています。置き換えるとそちらから外れます。"
|
||||
}
|
||||
L10nKey::SettingsReplace => "置き換え",
|
||||
L10nKey::SettingsNoActionsMatch => "「{query}」に一致する操作はありません",
|
||||
L10nKey::SettingsSearchShortcuts => "操作またはキーを検索",
|
||||
L10nKey::SettingsHostsDesc => {
|
||||
"最近使ったホスト。検索すると保存済みのすべてのホストを探せます。"
|
||||
}
|
||||
L10nKey::SettingsAddHost => "ホストを追加",
|
||||
L10nKey::SettingsNoHostsMatch => "「{query}」に一致するホストはありません",
|
||||
L10nKey::SettingsHostsFromFiles => "{files} か所から {count} 台のホスト",
|
||||
L10nKey::SettingsMoreHosts => "ほかに {count} 台のホスト",
|
||||
L10nKey::SettingsShowRecentOnly => "最近のみ表示",
|
||||
L10nKey::SettingsShowAll => "すべて表示",
|
||||
L10nKey::SettingsUnsaved => "未保存",
|
||||
L10nKey::SettingsNever => "未使用",
|
||||
L10nKey::SettingsDefinedIn => "定義元",
|
||||
L10nKey::SettingsConnectInNewTab => "新しいタブで接続",
|
||||
L10nKey::SettingsCopied => "コピーしました",
|
||||
L10nKey::SettingsCopySshCommand => "ssh コマンドをコピー",
|
||||
L10nKey::SettingsStoredInTty7 => "tty7 の設定に保存",
|
||||
L10nKey::SettingsClickAgainToRemove => "もう一度クリックで削除",
|
||||
L10nKey::SettingsRemoveHost => "ホストを削除",
|
||||
L10nKey::SettingsEditHost => "編集",
|
||||
L10nKey::SettingsLive => "接続中",
|
||||
L10nKey::SettingsPressKeysShort => "キーを押してください…",
|
||||
L10nKey::SettingsSearchAgents => "エージェントを検索",
|
||||
L10nKey::SettingsConnectedMachines => "接続中",
|
||||
L10nKey::SettingsInstalledCount => "{count} 件インストール済み",
|
||||
L10nKey::SettingsMachine => "マシン",
|
||||
L10nKey::SettingsMachineLocalDesc => {
|
||||
"フックはマシンごとにインストールされます。リモートマシンは接続中にここに表示されます。"
|
||||
}
|
||||
L10nKey::SettingsMachineRemoteDesc => "{name} への接続を通じてインストールします。",
|
||||
L10nKey::SettingsAgentsInstalledSummary => "{total} 件中 {count} 件インストール済み",
|
||||
L10nKey::SettingsNoAgentsInstalled => "このマシンにはまだエージェントフックがありません。",
|
||||
L10nKey::SettingsNoAgentsMatch => "「{query}」に一致するエージェントはありません",
|
||||
L10nKey::SettingsMoreAgents => "ほかに {count} 件のエージェント",
|
||||
L10nKey::SettingsShowInstalledOnly => "インストール済みのみ表示",
|
||||
L10nKey::SettingsWorking => "処理中…",
|
||||
L10nKey::SettingsUpdateAvailable => "アップデートあり",
|
||||
L10nKey::SettingsRevealHookFile => "フックファイルを表示",
|
||||
L10nKey::SettingsNavGeneral => "一般",
|
||||
L10nKey::SettingsEditShortcuts => "ショートカットを編集…",
|
||||
L10nKey::SettingsModifiedOnly => "変更済みのみ",
|
||||
@@ -105,40 +175,26 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::Download => "ダウンロード",
|
||||
L10nKey::Link => "リンク",
|
||||
L10nKey::SettingsThemeIntroTitle => "テーマ",
|
||||
L10nKey::SettingsThemeIntroDesc => {
|
||||
"配色テーマを選びます。明るいテーマと暗いテーマがあります"
|
||||
}
|
||||
L10nKey::SettingsThemeIntroDesc => "テーマごとにライトかダークが決まります",
|
||||
L10nKey::SettingsTypography => "タイポグラフィ",
|
||||
L10nKey::SettingsFontSize => "ターミナルの文字サイズ",
|
||||
L10nKey::SettingsFontSizeDesc => "ターミナルテキストのサイズ(ピクセル)",
|
||||
L10nKey::SettingsUiFontSize => "画面の文字サイズ",
|
||||
L10nKey::SettingsUiFontSizeDesc => {
|
||||
"ターミナル以外すべての文字サイズ(タブ・パネル・設定)。Retina でないディスプレイでは大きめに"
|
||||
}
|
||||
L10nKey::SettingsUiFontSizeDesc => "タブ・パネル・設定などの文字サイズ",
|
||||
L10nKey::SettingsUiFontFamily => "画面のフォント",
|
||||
L10nKey::SettingsUiFontFamilyDesc => {
|
||||
"タブ、サイドバー、ダイアログ、設定で使用するフォント。デフォルトではシステム UI フォントを使用します。"
|
||||
}
|
||||
L10nKey::SettingsUiFontFamilyDesc => "タブ、サイドバー、ダイアログ、設定で使うフォント",
|
||||
L10nKey::SettingsLineHeight => "行の高さ",
|
||||
L10nKey::SettingsLineHeightDesc => "フォントサイズに対する行間の倍率",
|
||||
L10nKey::SettingsFontFamily => "ターミナルのフォント",
|
||||
L10nKey::SettingsFontFamilyDesc => "システムにインストールされているフォントから選択",
|
||||
L10nKey::SettingsBoldFont => "太字フォント",
|
||||
L10nKey::SettingsBoldFontDesc => {
|
||||
"太字テキストに使用する書体。デフォルトではメインフォントから合成されます"
|
||||
}
|
||||
L10nKey::SettingsBoldFontDesc => "太字の書体。デフォルトはメインから合成",
|
||||
L10nKey::SettingsItalicFont => "斜体フォント",
|
||||
L10nKey::SettingsItalicFontDesc => {
|
||||
"斜体テキストに使用する書体。デフォルトではメインフォントから合成されます"
|
||||
}
|
||||
L10nKey::SettingsItalicFontDesc => "斜体の書体。デフォルトはメインから合成",
|
||||
L10nKey::SettingsFontLigatures => "フォントリガチャー",
|
||||
L10nKey::SettingsFontLigaturesDesc => {
|
||||
"ターミナルテキストで一般的なプログラミング用リガチャー(合字)を有効にする"
|
||||
}
|
||||
L10nKey::SettingsFontLigaturesDesc => "ターミナルでプログラミング用リガチャーを使用",
|
||||
L10nKey::SettingsFontThicken => "ストロークを太くする",
|
||||
L10nKey::SettingsFontThickenDesc => {
|
||||
"macOS のフォントスムージング:文字をやや太く描画し、明るい文字ほど太くなる。tty7 の再起動後に反映"
|
||||
}
|
||||
L10nKey::SettingsFontThickenDesc => "文字をやや太く描画します。再起動後に反映",
|
||||
L10nKey::SettingsCursor => "カーソル",
|
||||
L10nKey::SettingsCursorShape => "カーソルの形状",
|
||||
L10nKey::SettingsCursorShapeDesc => "ターミナルカーソルの描画方法",
|
||||
@@ -156,9 +212,7 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
}
|
||||
L10nKey::SettingsTransparency => "透明度",
|
||||
L10nKey::SettingsOpacity => "不透明度",
|
||||
L10nKey::SettingsOpacityDesc => {
|
||||
"すべてのテーマにおけるウィンドウ背景の不透明度。100% 未満ではデスクトップが透けて見えます"
|
||||
}
|
||||
L10nKey::SettingsOpacityDesc => "100% 未満ではデスクトップが透けて見えます",
|
||||
L10nKey::SettingsBlur => "背景のぼかし",
|
||||
L10nKey::SettingsBlurDesc => {
|
||||
if cfg!(target_os = "macos") {
|
||||
@@ -167,13 +221,9 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
"半透明ウィンドウの背後にあるものをぼかす。対応するコンポジターが必要です(KDE Plasma は対応、GNOME と素の X11 ではウィンドウが透けるだけです)"
|
||||
}
|
||||
}
|
||||
L10nKey::SettingsBlurAutoDesc => {
|
||||
"半透明ウィンドウの背後にあるものをぼかす。背景マテリアルが「自動」のときのみ有効です"
|
||||
}
|
||||
L10nKey::SettingsBlurAutoDesc => "半透明ウィンドウの背後をぼかす。「自動」のみ",
|
||||
L10nKey::SettingsBackdrop => "背景マテリアル",
|
||||
L10nKey::SettingsBackdropDesc => {
|
||||
"半透明ウィンドウの背後にあるネイティブ Windows 背景マテリアル。Mica には Windows 11 22H2、Acrylic には 1809 が必要です。古いビルドでは自動的にフォールバックします"
|
||||
}
|
||||
L10nKey::SettingsBackdropDesc => "半透明ウィンドウ背後のネイティブ背景",
|
||||
L10nKey::SettingsSearchBackdropKeywords => {
|
||||
"背景 マテリアル ぼかし すりガラス material backdrop mica acrylic blur frosted window background"
|
||||
}
|
||||
@@ -185,9 +235,7 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsBackdropOff => "オフ",
|
||||
L10nKey::FollowTheme => "テーマに従う",
|
||||
L10nKey::SettingsDimInactivePanes => "非アクティブなペインを暗くする",
|
||||
L10nKey::SettingsDimInactivePanesDesc => {
|
||||
"分割内のフォーカスされていないペインを暗くし、アクティブなペインを目立たせる"
|
||||
}
|
||||
L10nKey::SettingsDimInactivePanesDesc => "フォーカス外のペインを暗くします",
|
||||
L10nKey::SettingsOpenThemesFolder => "テーマフォルダを開く",
|
||||
L10nKey::SettingsChangeThemeImage => "変更…",
|
||||
L10nKey::SettingsChooseThemeImage => "選択…",
|
||||
@@ -195,9 +243,7 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsImageOpacity => "画像の不透明度",
|
||||
L10nKey::SettingsImageOpacityDesc => "背景色の上に画像をどれだけ強く表示するか",
|
||||
L10nKey::SettingsEditTheme => "テーマを編集",
|
||||
L10nKey::SettingsEditThemeIntro => {
|
||||
"コピーを編集します。変更はテーマフォルダ内のファイルに保存され、すぐ反映されます"
|
||||
}
|
||||
L10nKey::SettingsEditThemeIntro => "コピーを編集中。変更はすぐ反映・保存されます",
|
||||
L10nKey::SettingsBackgroundImage => "背景画像",
|
||||
L10nKey::SettingsBackgroundImageDesc => "背景色の上、テキストの下に表示されます",
|
||||
L10nKey::SettingsAnsiColors => "ANSI カラー",
|
||||
@@ -209,7 +255,7 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::ExplorerMenuOpenIn => "tty7 で開く",
|
||||
L10nKey::ExplorerMenuOpenHere => "ここで tty7 を開く",
|
||||
L10nKey::SettingsCustomThemesIntro => {
|
||||
"テーマを複製して色を編集するか、tty7 の YAML テーマや iTerm2 の .itermcolors をテーマフォルダに置いてください"
|
||||
"テーマを複製して編集するか、YAML や .itermcolors をテーマフォルダに置いてください"
|
||||
}
|
||||
L10nKey::SettingsDuplicateToEdit => "複製して編集",
|
||||
L10nKey::SettingsHosts => "ホスト",
|
||||
@@ -228,9 +274,7 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsMoreInSshConfig => "~/.ssh/config にさらに {count} 件",
|
||||
L10nKey::SettingsAliasesLinked => "{count} 件のエイリアスがリンクされています",
|
||||
L10nKey::SettingsImportAliases => "エイリアスをインポート",
|
||||
L10nKey::SettingsImportAliasesDesc => {
|
||||
"ファイルを再読み込みして新しい項目を追加します。ここでの編集は tty7 が保存します — ファイル自体には書き込まれません"
|
||||
}
|
||||
L10nKey::SettingsImportAliasesDesc => "ファイルを再読み込みし、新しい項目を追加",
|
||||
L10nKey::SettingsImportNow => "今すぐインポート",
|
||||
L10nKey::SettingsImportUnreadable => {
|
||||
"{path} を読み取れませんでした — 何もインポートされていません"
|
||||
@@ -245,9 +289,7 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
"tty7 に設定のないオプションが {count} 件あり、ファイルに残されています: {options}"
|
||||
}
|
||||
L10nKey::SettingsImportMoreOptions => "他 {count} 件",
|
||||
L10nKey::SettingsDefaultsIntro => {
|
||||
"すべてのホストはこの設定から始まります。各ホストは詳細設定で個別に上書きできます"
|
||||
}
|
||||
L10nKey::SettingsDefaultsIntro => "全ホストの既定値。各ホストの詳細設定で上書き可",
|
||||
L10nKey::SettingsCopyAddress => "アドレスをコピー",
|
||||
L10nKey::SettingsDuplicate => "複製",
|
||||
L10nKey::SettingsForgetPassword => "パスワードを消去",
|
||||
@@ -272,12 +314,10 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsSecurityIntro => "ホストは詳細設定でこれらを上書きできます",
|
||||
L10nKey::SettingsVerifyHostKeys => "ホストキーを検証",
|
||||
L10nKey::SettingsVerifyHostKeysDesc => {
|
||||
"接続前に各サーバーのキーを known_hosts と照合します。オフでは確認しないため、なりすましサーバーに気づきません"
|
||||
"サーバーのキーを known_hosts と照合します。オフではなりすましに気づけません"
|
||||
}
|
||||
L10nKey::WarnBeforeClosing => "閉じる前に警告",
|
||||
L10nKey::SettingsWarnBeforeClosingDesc => {
|
||||
"アクティブな SSH セッションのあるタブやペインを閉じる前に確認を求めます"
|
||||
}
|
||||
L10nKey::SettingsWarnBeforeClosingDesc => "SSH 接続中のタブを閉じる前に確認",
|
||||
L10nKey::SettingsNewHost => "新規ホスト",
|
||||
L10nKey::SettingsDiscardChangesTitle => "保存していない変更を破棄しますか?",
|
||||
L10nKey::SettingsDiscardChangesBody => "編集中の接続に、まだ保存していない変更があります。",
|
||||
@@ -298,9 +338,7 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsNameHint => "任意のラベル",
|
||||
L10nKey::SettingsHostHint => "ホスト名または IP",
|
||||
L10nKey::SettingsUserHint => "接続時に解決",
|
||||
L10nKey::SettingsPasswordDesc => {
|
||||
"システムのキーチェーンに保存され、設定ファイルには書き込まれません。"
|
||||
}
|
||||
L10nKey::SettingsPasswordDesc => "キーチェーンに保存され、設定ファイルには書きません",
|
||||
L10nKey::SettingsPasswordHint => "接続時に入力する",
|
||||
L10nKey::SettingsKeyPassphrase => "鍵のパスフレーズ",
|
||||
L10nKey::SettingsKeyPassphraseDesc => {
|
||||
@@ -313,9 +351,7 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsCouldntSavePassword => "{endpoint} のパスワードを保存できません: {error}",
|
||||
L10nKey::SettingsCouldntSavePassphrase => "{key} のパスフレーズを保存できません: {error}",
|
||||
L10nKey::SettingsJumpHost => "ジャンプホスト",
|
||||
L10nKey::SettingsJumpHostDesc => {
|
||||
"トンネリングに使用する別のプロファイル名 (空欄 = 直接接続)"
|
||||
}
|
||||
L10nKey::SettingsJumpHostDesc => "経由するプロファイル。空欄なら直接接続",
|
||||
L10nKey::SettingsJumpHostUnknown => {
|
||||
"{jump_name} という名前のホストプロファイルはありません — 保存されません"
|
||||
}
|
||||
@@ -346,7 +382,7 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsGroupSecurity => "セキュリティ",
|
||||
L10nKey::SettingsRemoteClipboardWrite => "リモートのクリップボード画像",
|
||||
L10nKey::SettingsRemoteClipboardWriteDesc => {
|
||||
"このホスト上のプログラムが OSC 5522 でローカルクリップボードを画像に置き換えることを許可します"
|
||||
"このホストが画像をクリップボードに書き込む(OSC 5522)"
|
||||
}
|
||||
L10nKey::SettingsIdentityFiles => "秘密鍵ファイル",
|
||||
L10nKey::SettingsIdentityFilesDesc => "秘密鍵のパス(1 行に 1 つ。%h/%r は展開されます)",
|
||||
@@ -411,9 +447,7 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
}
|
||||
}
|
||||
L10nKey::SettingsShellIntegration => "シェル統合",
|
||||
L10nKey::SettingsShellIntegrationDesc => {
|
||||
"リモートシェルにプロンプト・終了コード・作業ディレクトリを報告させる"
|
||||
}
|
||||
L10nKey::SettingsShellIntegrationDesc => "プロンプト・終了コード・ディレクトリを報告",
|
||||
L10nKey::SettingsLoginScripts => "ログインスクリプト",
|
||||
L10nKey::SettingsLoginScriptsDesc => "シェル起動後に送信するコマンド(1 行に 1 つ)",
|
||||
L10nKey::SettingsSkipBanner => "バナーをスキップ",
|
||||
@@ -427,24 +461,16 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsOn => "オン",
|
||||
L10nKey::SettingsOff => "オフ",
|
||||
L10nKey::SettingsShell => "シェル",
|
||||
L10nKey::SettingsShellIntro => {
|
||||
"新しいターミナルで起動するプログラム。「シェルプログラム」を空欄にすると、プラットフォーム既定の {default} を使います。"
|
||||
}
|
||||
L10nKey::SettingsShellIntro => "新しいターミナルで起動するプログラム。空欄なら {default}",
|
||||
L10nKey::SettingsProgram => "シェルプログラム",
|
||||
L10nKey::SettingsProgramDesc => {
|
||||
"PATH 上の実行可能ファイル名または絶対パス。例: zsh、fish、pwsh"
|
||||
}
|
||||
L10nKey::SettingsProgramDesc => "PATH 上の名前か絶対パス。例: zsh、fish",
|
||||
L10nKey::SettingsArguments => "シェル引数",
|
||||
L10nKey::SettingsArgumentsDesc => {
|
||||
"コマンドラインと同じ規則で分割される起動フラグ。空白を含むものはクォートしてください(例: -l、-c \"echo hi\")"
|
||||
}
|
||||
L10nKey::SettingsArgumentsDesc => "コマンドラインと同じ規則で分割。例: -l、-c \"echo hi\"",
|
||||
L10nKey::SettingsArgumentsInvalid => {
|
||||
"引用符が対応していないため、この値は保存されませんでした"
|
||||
}
|
||||
L10nKey::SettingsStartIn => "開始ディレクトリ",
|
||||
L10nKey::SettingsStartInDesc => {
|
||||
"新しいシェルの開始場所: tty7 の起動ディレクトリ、ホームフォルダ、または固定パス"
|
||||
}
|
||||
L10nKey::SettingsStartInDesc => "tty7 の起動ディレクトリ、ホームフォルダ、または固定パス",
|
||||
L10nKey::SettingsCustomPath => "カスタムパス",
|
||||
L10nKey::SettingsCustomPathDesc => "新しいシェルが起動するディレクトリ",
|
||||
L10nKey::SettingsWdInherit => "継承",
|
||||
@@ -454,7 +480,7 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
"このディレクトリは存在しないため、この値は保存されませんでした"
|
||||
}
|
||||
L10nKey::SettingsShellFooter => {
|
||||
"継承元のないシェル(ウィンドウの最初のタブなど)に適用されます。新しいタブと分割はアクティブなペインのディレクトリを引き継ぎ、開いているシェルは動き続けます"
|
||||
"継承元のないシェル(ウィンドウの最初のタブなど)にのみ適用。新しいタブと分割はアクティブなペインのディレクトリを使います"
|
||||
}
|
||||
L10nKey::SettingsScrolling => "スクロール",
|
||||
L10nKey::SettingsScrollback => "スクロールバックバッファー",
|
||||
@@ -465,8 +491,7 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsScrollSpeedDesc => "マウスホイールのスクロールに適用する倍率",
|
||||
L10nKey::SettingsSmoothScroll => "スムーズスクロール",
|
||||
L10nKey::SettingsSmoothScrollDesc => {
|
||||
"ホイール1ノッチ分を一気に飛ばさず、数フレームかけて動かす。\
|
||||
トラックパッドは元から連続的なので影響しない"
|
||||
"ホイールを滑らかにスクロール(トラックパッドは対象外)"
|
||||
}
|
||||
L10nKey::SettingsMouse => "マウス",
|
||||
L10nKey::SettingsFocusFollowsMouse => "フォーカスがマウスに追従する",
|
||||
@@ -478,34 +503,23 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
"入力中はポインタを隠し、次のマウス移動で再表示する"
|
||||
}
|
||||
L10nKey::SettingsMouseZoom => "ホイールで拡大縮小",
|
||||
L10nKey::SettingsMouseZoomDesc => {
|
||||
"この修飾キーを押しながらホイールを回すと、スクロールではなくフォントサイズが変わる"
|
||||
}
|
||||
L10nKey::SettingsMouseZoomDesc => "押しながらホイールを回すとフォントサイズが変わります",
|
||||
L10nKey::SettingsMouseZoomOff => "オフ",
|
||||
L10nKey::SettingsReportMouseToApps => "マウスイベントをアプリに報告",
|
||||
L10nKey::SettingsReportMouseToAppsDesc => {
|
||||
"フルスクリーンアプリ(vim、tmux)にクリックとスクロールを処理させる。Shift を押している間はローカルで処理されます。\
|
||||
オフにするとクリックは届かず、ホイールは矢印キーとして送られます"
|
||||
}
|
||||
L10nKey::SettingsReportMouseToAppsDesc => "vim や tmux にクリックを渡す。Shift で端末側に",
|
||||
L10nKey::SettingsBell => "ベル通知",
|
||||
L10nKey::SettingsTerminalBell => "ターミナルベル",
|
||||
L10nKey::SettingsTerminalBellDesc => {
|
||||
"ベル(^G)の通知方法: サイレント、短い点滅、システムサウンド、またはその両方"
|
||||
}
|
||||
L10nKey::SettingsTerminalBellDesc => "ベル(^G)の通知方法",
|
||||
L10nKey::SettingsLinks => "リンク",
|
||||
L10nKey::DetectUrls => "URL を自動検出",
|
||||
L10nKey::SettingsDetectUrlsDesc => {
|
||||
"ホバーでリンクに下線を表示し、{modifier}+クリックで開く"
|
||||
}
|
||||
L10nKey::SettingsDetectUrlsDesc => "ホバーで下線、{modifier}+クリックで開く",
|
||||
L10nKey::ForwardSshLoopbackLinks => "リモートポートを転送",
|
||||
L10nKey::SettingsForwardSshLoopbackLinksDesc => {
|
||||
"SSH 接続中、ペインが待ち受けを始めたポートを自動転送し、localhost リンクをこの端末で開く"
|
||||
}
|
||||
L10nKey::SettingsForwardSshLoopbackLinksDesc => "リモートの localhost リンクをここで開く",
|
||||
L10nKey::SettingsOpenFilesInternal => "内蔵エディタ",
|
||||
L10nKey::SettingsOpenFilesSystem => "デフォルトアプリ",
|
||||
L10nKey::SettingsOpenFilesCommand => "コマンド",
|
||||
L10nKey::SettingsOpenFilesModeDesc => {
|
||||
"ファイルリンクを {modifier}+クリックしたときに開くもの。行番号へのジャンプとリモートファイルを開けるのは内蔵エディタだけです"
|
||||
"{modifier}+クリックで開くもの。行ジャンプとリモートファイルは内蔵エディタのみ"
|
||||
}
|
||||
L10nKey::LinkFileNotUnder => "{path} — {dir} にそのファイルはありません",
|
||||
L10nKey::LinkFileNoDirectory => {
|
||||
@@ -516,37 +530,33 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
"{path} — 別のマシン上にあり、ファイルパネルで開いているどのフォルダにも含まれていません"
|
||||
}
|
||||
L10nKey::OpenFilesWith => "ファイルを開くアプリケーション",
|
||||
L10nKey::SettingsOpenFilesWithDesc => {
|
||||
"ファイルリンクを {modifier}+クリックしたときに実行するコマンド。{path}、{line}、{column} を使えます — 値のないフラグは除外されます。空欄ならデフォルトアプリ"
|
||||
}
|
||||
L10nKey::SettingsOpenFilesWithDesc => "{path}、{line}、{column} を使用。空欄ならデフォルト",
|
||||
L10nKey::SettingsBellModeOff => "オフ",
|
||||
L10nKey::SettingsBellModeVisual => "視覚的(画面点滅)",
|
||||
L10nKey::SettingsBellModeAudible => "音声(効果音)",
|
||||
L10nKey::SettingsBellModeBoth => "点滅 + 音声",
|
||||
L10nKey::SettingsPrompt => "プロンプトとコマンド履歴",
|
||||
L10nKey::SettingsPromptIntro => {
|
||||
"シェルプロンプトでの tty7 独自のエディターとメニュー。オフにするとその分がシェルに渡されます"
|
||||
"プロンプトでの tty7 独自のエディターとメニュー。オフでシェルに戻します"
|
||||
}
|
||||
L10nKey::SettingsPromptEditor => "tty7 のプロンプトエディター",
|
||||
L10nKey::SettingsPromptEditorDesc => {
|
||||
"シェルプロンプトで入力する行を tty7 が編集します — 選択、取り消し、下のメニュー。オフにするとシェル自身の行エディター(ZLE、readline、fish)に戻ります"
|
||||
"入力行で選択・取り消し・メニューを使えます。オフでは ZLE、readline、fish に戻します"
|
||||
}
|
||||
L10nKey::SettingsNeedsPromptEditor => {
|
||||
"プロンプトエディターが必要です。オフの間、このキーはすでにシェルのものです"
|
||||
}
|
||||
L10nKey::SettingsTabCompletion => "タブ補完",
|
||||
L10nKey::SettingsTabCompletionDesc => {
|
||||
"プロンプトで Tab を押すと tty7 の補完メニューが開きます。オフの場合、Tab はシェル自身の補完に渡されます"
|
||||
"Tab で tty7 の補完メニューを開きます。オフならシェルへ"
|
||||
}
|
||||
L10nKey::SettingsHistorySearch => "コマンド履歴検索",
|
||||
L10nKey::SettingsHistorySearchDesc => {
|
||||
"プロンプトで ⌃R を押すと tty7 のファジー履歴メニューが開きます。オフなら ⌃R はシェルへ — 逆方向検索や、そこでバインドしたもの(fzf、percol)"
|
||||
"⌃R で tty7 のファジー履歴検索を開きます。オフならシェルへ"
|
||||
}
|
||||
L10nKey::SettingsSelectionClipboard => "選択とクリップボード",
|
||||
L10nKey::SettingsSmartSelection => "スマート選択",
|
||||
L10nKey::SettingsSmartSelectionDesc => {
|
||||
"ダブルクリックでカーソル下の URL、ファイルパス、メールアドレス、または括弧ペア全体を選択"
|
||||
}
|
||||
L10nKey::SettingsSmartSelectionDesc => "ダブルクリックで URL やパス全体を選択",
|
||||
L10nKey::SettingsCopyOnSelect => "選択時に自動コピー",
|
||||
L10nKey::SettingsCopyOnSelectDesc => {
|
||||
if cfg!(target_os = "macos") {
|
||||
@@ -559,12 +569,10 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsTrimTrailingSpacesDesc => "コピーした各行の末尾の空白を除去する",
|
||||
L10nKey::SettingsKeyboard => "キーボード",
|
||||
L10nKey::SettingsOptionAsMeta => "Option(⌥)を Meta として使用",
|
||||
L10nKey::SettingsOptionAsMetaDesc => {
|
||||
"⌥+キーでシェルが期待するエスケープシーケンス(⌥B = 単語 1 つ戻る)を送信し、特殊文字(∫)を入力しない"
|
||||
}
|
||||
L10nKey::SettingsAgentsIntro => "AI エージェント",
|
||||
L10nKey::SettingsOptionAsMetaDesc => "⌥+キーを Meta として送る(⌥B で 1 語戻る)",
|
||||
L10nKey::SettingsAgentsIntro => "エージェントフック",
|
||||
L10nKey::SettingsAgentsIntroDesc => {
|
||||
"フックにより、これらのエージェントを実行するペインの状態(作業中 / 待機中 / 完了)がタブバーに表示されます。tty7 内でのみ有効"
|
||||
"フックでエージェントの状態(作業中 / 待機中 / 完了)をタブバーに表示します"
|
||||
}
|
||||
L10nKey::SettingsReadingAgentConfig => "このマシンのエージェント設定を読み込んでいます…",
|
||||
L10nKey::SettingsStatusNotInstalled => "未インストール",
|
||||
@@ -577,14 +585,12 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsOfflineMachines => {
|
||||
"未接続の保存済みマシンがさらに {count} 台あります。いずれかでワークスペースを開くと、そこにフックをインストールできます"
|
||||
}
|
||||
L10nKey::SettingsSyncWithSystem => "システムテーマと同期",
|
||||
L10nKey::SettingsSyncWithSystem => "外観",
|
||||
L10nKey::SettingsSyncWithSystemDesc => {
|
||||
"OS の外観に従い、ライトとダークのテーマを別々に使用する"
|
||||
}
|
||||
L10nKey::SettingsLegiblePalette => "明色の可読性",
|
||||
L10nKey::SettingsLegiblePaletteDesc => {
|
||||
"テーマ背景でコントラスト不足の明色を自動調整して、可読性を確保します。"
|
||||
}
|
||||
L10nKey::SettingsLegiblePaletteDesc => "背景上で読みにくい明色を自動調整します",
|
||||
L10nKey::SettingsChangeTheme => "テーマを変更",
|
||||
L10nKey::SettingsThemes => "テーマ一覧",
|
||||
L10nKey::SettingsThemesCloseTooltip => "テーマ一覧を閉じる (Esc)",
|
||||
@@ -602,17 +608,13 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsStartupWindow => "起動時のウィンドウ状態",
|
||||
L10nKey::SettingsStartupWindowDesc => "tty7 起動時のウィンドウ状態",
|
||||
L10nKey::SettingsRememberWindowSize => "ウィンドウサイズと位置を記憶",
|
||||
L10nKey::SettingsRememberWindowSizeDesc => {
|
||||
"tty7 が最後に終了したときのサイズと位置で開き直します。オフならデフォルトサイズで中央に開きます"
|
||||
}
|
||||
L10nKey::SettingsRememberWindowSizeDesc => "前回終了時のサイズと位置でウィンドウを開きます",
|
||||
L10nKey::SettingsRestoreLastLayout => "前回のレイアウトを復元",
|
||||
L10nKey::SettingsRestoreLastLayoutDesc => {
|
||||
"起動時に前回のウィンドウのタブ、分割、ディレクトリを復元します。オフなら新しいターミナルが 1 つだけ起動します"
|
||||
"起動時に前回のタブ、分割、ディレクトリを復元します"
|
||||
}
|
||||
L10nKey::SettingsShowTrayIcon => "システムトレイアイコンを表示",
|
||||
L10nKey::SettingsShowTrayIconDesc => {
|
||||
"システムトレイ / メニューバーの状態表示:エージェントが入力を必要とするときに通知し、メニューからそのペインへ移動できます"
|
||||
}
|
||||
L10nKey::SettingsShowTrayIconDesc => "エージェントの入力待ちを通知",
|
||||
L10nKey::SettingsTabs => "タブ",
|
||||
L10nKey::SettingsNewTabPosition => "新規タブの表示位置",
|
||||
L10nKey::SettingsNewTabPositionDesc => "新しく開いたタブが挿入される場所",
|
||||
@@ -621,20 +623,14 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
"タブを上部の横一列または左側の縦サイドバーとして表示"
|
||||
}
|
||||
L10nKey::SettingsSidebarGrouping => "サイドバーのグループ化",
|
||||
L10nKey::SettingsSidebarGroupingDesc => {
|
||||
"サイドバータブを git リポジトリごとにまとめます。リポジトリ外のタブはスクラッチに、「リポジトリ/フォルダ別」なら作業ディレクトリごとに。左サイドバーのみ"
|
||||
}
|
||||
L10nKey::SettingsSidebarGroupingDesc => "git リポジトリごとにまとめ、他はスクラッチへ",
|
||||
L10nKey::SettingsDiffPreviewFromCounts => "サイドバーのカウントから Diff プレビューを開く",
|
||||
L10nKey::SettingsDiffPreviewFromCountsDesc => {
|
||||
"行の +N −N をクリックすると、オーバーレイでワーキングツリーの Diff を開きます。オフならカウントは表示されたまま、クリックだけできません"
|
||||
}
|
||||
L10nKey::SettingsDiffPreviewFromCountsDesc => "行の +N −N をクリックして Diff を開きます",
|
||||
L10nKey::DocumentDock => "ターミナルの隣にドック",
|
||||
L10nKey::DocumentFill => "ウィンドウ全体",
|
||||
L10nKey::SettingsNotifications => "通知",
|
||||
L10nKey::SettingsNotifyOnCommandFinish => "コマンド終了時に通知",
|
||||
L10nKey::SettingsNotifyOnCommandFinishDesc => {
|
||||
"長時間のフォアグラウンドコマンドが完了したらデスクトップ通知を表示"
|
||||
}
|
||||
L10nKey::SettingsNotifyOnCommandFinishDesc => "長いコマンドの完了をデスクトップに通知",
|
||||
L10nKey::SettingsNotifyThreshold => "コマンド実行時間の下限",
|
||||
L10nKey::SettingsNotifyThresholdDesc => {
|
||||
"この時間以上実行されたコマンドの完了を通知します。"
|
||||
@@ -654,18 +650,14 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsByRepoOrFolder => "リポジトリ/フォルダ別",
|
||||
L10nKey::SettingsFlat => "フラット表示",
|
||||
L10nKey::SettingsPreset => "プリセット",
|
||||
L10nKey::SettingsPresetDesc => {
|
||||
"tmux では、ペイン/タブの操作をプレフィックスキーの後に行います(例: Ctrl-B の後に C)"
|
||||
}
|
||||
L10nKey::SettingsPresetDesc => "tmux はペイン・タブ操作をプレフィックスキーに(Ctrl-B C)",
|
||||
L10nKey::SettingsPrefix => "プレフィックスキー",
|
||||
L10nKey::SettingsPressKeys => "キーを入力… · ⌫ でショートカットなし",
|
||||
L10nKey::SettingsPauseToSaveEsc => "一時停止して保存 · Esc",
|
||||
L10nKey::SettingsKeybindingsIntroDesc => {
|
||||
"ショートカットをクリックして新しいキーを押すと、少し間を置いて保存されます。Ctrl-B の後に X のようなシーケンスはキーを続けて入力。Esc でキャンセル、Backspace は最後のキーを削除し、最初に押すとショートカットなしになり、「リセット」でデフォルトに戻せます"
|
||||
}
|
||||
L10nKey::SettingsPrefixNote => {
|
||||
"プレフィックスが有効な場合、プレフィックスキーを単独で押すと約 1 秒後にシェルに渡され、プレフィックス + 未割り当てのキーはターミナルへそのまま送信されます"
|
||||
"ショートカットをクリックして新しいキーを押します。続けて押すと Ctrl-B X のようなシーケンスに。Esc で取消、Backspace で削除"
|
||||
}
|
||||
L10nKey::SettingsPrefixNote => "プレフィックスキー単独は約 1 秒後にシェルへ",
|
||||
L10nKey::SettingsRestoreAllDefaults => "すべてのデフォルトを復元",
|
||||
L10nKey::SettingsRestoreAllDefaultsBody => {
|
||||
"変更したキーはすべてデフォルトに戻ります。元に戻すことはできません。"
|
||||
@@ -678,11 +670,11 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::KeybindForkSessionDown => "下にセッションをフォーク",
|
||||
L10nKey::KeybindForkSessionUp => "上にセッションをフォーク",
|
||||
L10nKey::SettingsAboutDesc1 => {
|
||||
"ターミナルワークベンチ: 常駐セッション、リモート作業、エージェント"
|
||||
"長く続く作業のためのターミナルワークベンチ。セッションはウィンドウを閉じても続き、リモートもローカルと同じように扱え、コーディングエージェントの状態はサイドバーに表示されます。"
|
||||
}
|
||||
L10nKey::SettingsDefaultTerminal => "デフォルトのターミナル",
|
||||
L10nKey::SettingsDefaultTerminalDesc => {
|
||||
"tty7 を Unix 実行ファイル、SSH リンク、man ページリンク用の macOS のデフォルトターミナルにします。tty7 はフォルダとスクリプトも開けますが、Finder のフォルダハンドラは置き換えません。独自のターミナルを指定するアプリはこの設定を無視することがあります。"
|
||||
"Unix 実行ファイル、SSH リンク、man ページを tty7 で開きます"
|
||||
}
|
||||
L10nKey::SettingsDefaultTerminalSet => "デフォルトのターミナルに設定",
|
||||
L10nKey::SettingsDefaultTerminalSetSuccess => {
|
||||
@@ -717,17 +709,15 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsUpdateDiscard => "破棄",
|
||||
L10nKey::SettingsAutoDownload => "アップデートをバックグラウンドでダウンロード",
|
||||
L10nKey::SettingsAutoDownloadDesc => {
|
||||
"新しいリリースを見つけ次第ダウンロードと検証を済ませ、インストールは再起動するだけにします。確認なしにインストールすることはありません。パッケージは約 30 MB"
|
||||
"更新をバックグラウンドで取得し、再起動だけで適用。確認なしにはインストールしません"
|
||||
}
|
||||
L10nKey::SettingsUpdateChannel => "更新チャンネル",
|
||||
L10nKey::SettingsUpdateChannelDesc => {
|
||||
"Stable は正式リリースを、Nightly は最新のコードから毎晩ビルドされる版を追いかけます。新しい代わりに、リリース前のテストは経ていません"
|
||||
}
|
||||
L10nKey::SettingsUpdateChannelDesc => "Nightly は毎晩最新コードからビルド(未テスト)",
|
||||
L10nKey::SettingsUpdateChannelStable => "安定版",
|
||||
L10nKey::SettingsUpdateChannelNightly => "ナイトリー",
|
||||
L10nKey::SettingsDaemonStale => "tty7 server は {build} のままです。",
|
||||
L10nKey::SettingsDaemonStaleDesc => {
|
||||
"tty7 はその場で更新されました。アプリは新しく、ペインはまだ以前のビルドの tty7 server が処理しています。再起動すると新しいビルドに切り替わり、ペインで動いているプロセスはすべて終了します。急ぐ必要はなく、ペインが空いているときにどうぞ"
|
||||
"tty7 は更新されましたが、ペインは古い server で動いています。再起動すると新しいビルドになり、ペインのプロセスはすべて終了します"
|
||||
}
|
||||
L10nKey::UpdateDialogTitle => "アップデートがあります",
|
||||
L10nKey::UpdateDialogDetail => {
|
||||
@@ -773,24 +763,16 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
"このリリースには checksums.txt がないため、tty7 は自動インストールを行いません"
|
||||
}
|
||||
L10nKey::SettingsVersionAvailable => "バージョン {version} が利用可能です",
|
||||
L10nKey::SettingsCheckUpdatesDesc => {
|
||||
"その場で更新できないインストール形式では、代わりにリリースページを開きます"
|
||||
}
|
||||
L10nKey::SettingsCheckUpdatesDesc => "自動更新できない場合はリリースページを開く",
|
||||
L10nKey::SettingsCheckUpdatesOnLaunch => "起動時にアップデートを確認",
|
||||
L10nKey::SettingsCommandLine => "コマンドライン",
|
||||
L10nKey::SettingsCommandLineDesc => {
|
||||
"付属の tty7 コマンドをスクリプトや AI エージェントから利用できます。次回起動時に反映されます。無効にしてもインストール済みのコマンドは削除されません。"
|
||||
}
|
||||
L10nKey::SettingsCommandLineDesc => "tty7 コマンドを PATH に追加。次回起動時に反映",
|
||||
L10nKey::SettingsInstallCliOnPath => "`tty7` コマンドを PATH にインストール",
|
||||
L10nKey::SettingsServer => "tty7 server",
|
||||
L10nKey::SettingsServerDesc => {
|
||||
"このコンピューターのターミナルセッションを管理し、バックグラウンドで実行し続けます。"
|
||||
}
|
||||
L10nKey::SettingsServerDesc => "ターミナルセッションをバックグラウンドで実行し続けます",
|
||||
L10nKey::SettingsRestartServer => "tty7 server を再起動…",
|
||||
L10nKey::SettingsAppHttpProxy => "アップデート用プロキシ",
|
||||
L10nKey::SettingsAppHttpProxyDesc => {
|
||||
"tty7 自身の更新チェックとダウンロードにのみ使用し、ペインで実行中のプログラムには影響しません。空欄ならシステムのプロキシに従います"
|
||||
}
|
||||
L10nKey::SettingsAppHttpProxyDesc => "tty7 の更新チェック用。空欄ならシステム設定",
|
||||
L10nKey::SettingsAppHttpProxyInvalid => {
|
||||
"プロキシアドレスとして正しくないため、この値は保存されませんでした"
|
||||
}
|
||||
@@ -1832,7 +1814,7 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::Replace => "置き換える",
|
||||
L10nKey::SftpErrorInvalidOctalMode => "無効な 8 進数モードです",
|
||||
L10nKey::SettingsDaemonStaleDescInPlace => {
|
||||
"tty7 はその場で更新されました。アプリは新しく、ペインはまだ前のビルドで動いています。tty7 server は停止せずに新しいビルドへ置き換えられるので、シェルはそのまま引き継がれます。tty7 内蔵の SSH クライアントを使うペインだけは例外で、その接続は閉じられ、開き直しが必要です"
|
||||
"tty7 が更新されました。server はその場で入れ替わり、シェルは続きます。内蔵 SSH のペインだけ閉じます"
|
||||
}
|
||||
L10nKey::AppRestartServerBodyInPlace => {
|
||||
"tty7 server は停止せずに自分自身をこのビルドへ置き換えます。シェルは動いたままで、ウィンドウはすぐに再接続します。tty7 内蔵の SSH クライアントを使うペインだけは例外で、その接続は閉じられ、開き直しが必要です"
|
||||
@@ -1841,9 +1823,7 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
"復元された画面 — 以下は新しいシェルで、これより上のものは動いていません"
|
||||
}
|
||||
L10nKey::SettingsPerPaneHistory => "ペインごとにコマンド履歴を分離",
|
||||
L10nKey::SettingsPerPaneHistoryDescription => {
|
||||
"上キーでたどるのは、全ペインが混ざったものではなくこのペインで実行したコマンドです。新しいペインは既存の履歴から始まり、追加分は閉じるときに書き戻されます。対象は tty7 が設定できる bash と zsh のペインで、独自の引数で起動したシェルはそのままです"
|
||||
}
|
||||
L10nKey::SettingsPerPaneHistoryDescription => "↑ はこのペインの履歴だけ(bash、zsh)",
|
||||
L10nKey::IntegrationNoticeBlocked => {
|
||||
"“{wrapper}”がこのペインのシェルレポートを横取りしているため、インライン補完と Ctrl+R メニューは使えません。シェル独自の履歴検索は引き続き使えます。"
|
||||
}
|
||||
@@ -1987,6 +1967,18 @@ pub fn translate_ja(key: L10nKey) -> Option<&'static str> {
|
||||
|
||||
pub fn translate_variant_ja(key: L10nKey, branch: &'static str) -> Option<&'static str> {
|
||||
let res = match (key, branch) {
|
||||
(L10nKey::SettingsMatchCount, "zero") => "0 件",
|
||||
(L10nKey::SettingsMatchCount, "one") => "1 件",
|
||||
(L10nKey::SettingsMatchCount, "other") => "{count} 件",
|
||||
(L10nKey::SettingsRestoreChanged, "zero") => "変更を戻す",
|
||||
(L10nKey::SettingsRestoreChanged, "one") => "変更した 1 件を戻す",
|
||||
(L10nKey::SettingsRestoreChanged, "other") => "変更した {count} 件を戻す",
|
||||
(L10nKey::SettingsMoreHosts, "zero") => "ほかのホストはありません",
|
||||
(L10nKey::SettingsMoreHosts, "one") => "ほかに 1 台のホスト",
|
||||
(L10nKey::SettingsMoreHosts, "other") => "ほかに {count} 台のホスト",
|
||||
(L10nKey::SettingsMoreAgents, "zero") => "ほかのエージェントはありません",
|
||||
(L10nKey::SettingsMoreAgents, "one") => "ほかに 1 件のエージェント",
|
||||
(L10nKey::SettingsMoreAgents, "other") => "ほかに {count} 件のエージェント",
|
||||
(L10nKey::SettingsDeleteProfileCascade, "one") => {
|
||||
"{endpoint} を参照しているリモートワークスペースのエントリが 1 件あり、\
|
||||
プロファイルと一緒にこのコンピュータから削除されます。リモートマシン上のセッションは\
|
||||
|
||||
@@ -68,6 +68,64 @@ macro_rules! l10n_keys {
|
||||
}
|
||||
|
||||
l10n_keys! {
|
||||
SettingsNoMatchesShort,
|
||||
SettingsModifiedTitle,
|
||||
SettingsMatchCount,
|
||||
SettingsNothingModified,
|
||||
SettingsKeyThen,
|
||||
SettingsStartupRestore,
|
||||
SettingsSettingsFile,
|
||||
SettingsReveal,
|
||||
SettingsThemeModeSystem,
|
||||
SettingsThemeModeSystemDesc,
|
||||
SettingsThemeModeLightDesc,
|
||||
SettingsThemeModeDarkDesc,
|
||||
SettingsThemeSlotLightDesc,
|
||||
SettingsThemeSlotDarkDesc,
|
||||
SettingsThemeSlotDesc,
|
||||
SettingsLightThemeLabel,
|
||||
SettingsDarkThemeLabel,
|
||||
SettingsNoThemesMatch,
|
||||
SettingsRestoreChanged,
|
||||
SettingsShortcutsHint,
|
||||
SettingsShortcutsHintTmux,
|
||||
SettingsShortcutConflict,
|
||||
SettingsReplace,
|
||||
SettingsNoActionsMatch,
|
||||
SettingsSearchShortcuts,
|
||||
SettingsHostsDesc,
|
||||
SettingsAddHost,
|
||||
SettingsNoHostsMatch,
|
||||
SettingsHostsFromFiles,
|
||||
SettingsMoreHosts,
|
||||
SettingsShowRecentOnly,
|
||||
SettingsShowAll,
|
||||
SettingsUnsaved,
|
||||
SettingsNever,
|
||||
SettingsDefinedIn,
|
||||
SettingsConnectInNewTab,
|
||||
SettingsCopied,
|
||||
SettingsCopySshCommand,
|
||||
SettingsStoredInTty7,
|
||||
SettingsClickAgainToRemove,
|
||||
SettingsRemoveHost,
|
||||
SettingsEditHost,
|
||||
SettingsLive,
|
||||
SettingsPressKeysShort,
|
||||
SettingsSearchAgents,
|
||||
SettingsConnectedMachines,
|
||||
SettingsInstalledCount,
|
||||
SettingsMachine,
|
||||
SettingsMachineLocalDesc,
|
||||
SettingsMachineRemoteDesc,
|
||||
SettingsAgentsInstalledSummary,
|
||||
SettingsNoAgentsInstalled,
|
||||
SettingsNoAgentsMatch,
|
||||
SettingsMoreAgents,
|
||||
SettingsShowInstalledOnly,
|
||||
SettingsWorking,
|
||||
SettingsUpdateAvailable,
|
||||
SettingsRevealHookFile,
|
||||
SettingsSaveError,
|
||||
SettingsRetrySave,
|
||||
|
||||
@@ -1723,6 +1781,10 @@ mod tests {
|
||||
let plural_keys = [
|
||||
L10nKey::SettingsDeleteProfileCascade,
|
||||
L10nKey::SettingsAliasesLinked,
|
||||
L10nKey::SettingsMoreAgents,
|
||||
L10nKey::SettingsMoreHosts,
|
||||
L10nKey::SettingsRestoreChanged,
|
||||
L10nKey::SettingsMatchCount,
|
||||
L10nKey::SettingsImportSummary,
|
||||
L10nKey::SettingsImportIgnored,
|
||||
L10nKey::SettingsRulesOpenedWithConnection,
|
||||
|
||||
@@ -2,6 +2,68 @@ use super::L10nKey;
|
||||
|
||||
pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
Some(match key {
|
||||
L10nKey::SettingsNoMatchesShort => "没有匹配项",
|
||||
L10nKey::SettingsModifiedTitle => "已修改",
|
||||
L10nKey::SettingsMatchCount => "{count} 个结果",
|
||||
L10nKey::SettingsNothingModified => "所有设置均为默认值",
|
||||
L10nKey::SettingsKeyThen => "再按",
|
||||
L10nKey::SettingsStartupRestore => "启动与恢复",
|
||||
L10nKey::SettingsSettingsFile => "设置文件",
|
||||
L10nKey::SettingsReveal => "显示",
|
||||
L10nKey::SettingsThemeModeSystem => "跟随系统",
|
||||
L10nKey::SettingsThemeModeSystemDesc => "跟随系统外观,在浅色与深色主题之间切换。",
|
||||
L10nKey::SettingsThemeModeLightDesc => "始终使用浅色主题。",
|
||||
L10nKey::SettingsThemeModeDarkDesc => "始终使用深色主题。",
|
||||
L10nKey::SettingsThemeSlotLightDesc => "系统处于浅色模式时使用。",
|
||||
L10nKey::SettingsThemeSlotDarkDesc => "系统处于深色模式时使用。",
|
||||
L10nKey::SettingsThemeSlotDesc => "终端和界面使用的主题。",
|
||||
L10nKey::SettingsLightThemeLabel => "浅色主题",
|
||||
L10nKey::SettingsDarkThemeLabel => "深色主题",
|
||||
L10nKey::SettingsNoThemesMatch => "没有匹配的主题",
|
||||
L10nKey::SettingsRestoreChanged => "恢复 {count} 项修改",
|
||||
L10nKey::SettingsShortcutsHint => {
|
||||
"点击快捷键后按下新组合键;紧接着再按一组即可组成序列。Esc 取消,⌫ 清除。"
|
||||
}
|
||||
L10nKey::SettingsShortcutsHintTmux => {
|
||||
"tmux 预设:窗格与标签页操作使用前缀键。点击快捷键即可修改;Esc 取消,⌫ 清除。"
|
||||
}
|
||||
L10nKey::SettingsShortcutConflict => "{keys} 已被「{action}」使用,替换后将从那里移除。",
|
||||
L10nKey::SettingsReplace => "替换",
|
||||
L10nKey::SettingsNoActionsMatch => "没有与「{query}」匹配的操作",
|
||||
L10nKey::SettingsSearchShortcuts => "搜索操作或按键",
|
||||
L10nKey::SettingsHostsDesc => "最近使用的主机。搜索可找到任意已保存的主机。",
|
||||
L10nKey::SettingsAddHost => "添加主机",
|
||||
L10nKey::SettingsNoHostsMatch => "没有与「{query}」匹配的主机",
|
||||
L10nKey::SettingsHostsFromFiles => "{count} 台主机,来自 {files} 个来源",
|
||||
L10nKey::SettingsMoreHosts => "还有 {count} 台主机",
|
||||
L10nKey::SettingsShowRecentOnly => "只显示最近",
|
||||
L10nKey::SettingsShowAll => "显示全部",
|
||||
L10nKey::SettingsUnsaved => "未保存",
|
||||
L10nKey::SettingsNever => "从未",
|
||||
L10nKey::SettingsDefinedIn => "定义于",
|
||||
L10nKey::SettingsConnectInNewTab => "在新标签页中连接",
|
||||
L10nKey::SettingsCopied => "已复制",
|
||||
L10nKey::SettingsCopySshCommand => "复制 ssh 命令",
|
||||
L10nKey::SettingsStoredInTty7 => "保存在 tty7 设置中",
|
||||
L10nKey::SettingsClickAgainToRemove => "再次点击以删除",
|
||||
L10nKey::SettingsRemoveHost => "删除主机",
|
||||
L10nKey::SettingsEditHost => "编辑",
|
||||
L10nKey::SettingsLive => "已连接",
|
||||
L10nKey::SettingsPressKeysShort => "按下按键…",
|
||||
L10nKey::SettingsSearchAgents => "搜索 Agent",
|
||||
L10nKey::SettingsConnectedMachines => "已连接",
|
||||
L10nKey::SettingsInstalledCount => "已安装 {count} 个",
|
||||
L10nKey::SettingsMachine => "机器",
|
||||
L10nKey::SettingsMachineLocalDesc => "钩子按机器安装。远程机器在连接期间会出现在这里。",
|
||||
L10nKey::SettingsMachineRemoteDesc => "通过当前与 {name} 的连接安装。",
|
||||
L10nKey::SettingsAgentsInstalledSummary => "已安装 {count} / {total}",
|
||||
L10nKey::SettingsNoAgentsInstalled => "这台机器上还没有安装 Agent 钩子。",
|
||||
L10nKey::SettingsNoAgentsMatch => "没有与「{query}」匹配的 Agent",
|
||||
L10nKey::SettingsMoreAgents => "还有 {count} 个可用 Agent",
|
||||
L10nKey::SettingsShowInstalledOnly => "只显示已安装",
|
||||
L10nKey::SettingsWorking => "处理中…",
|
||||
L10nKey::SettingsUpdateAvailable => "有可用更新",
|
||||
L10nKey::SettingsRevealHookFile => "显示钩子文件",
|
||||
L10nKey::SettingsNavGeneral => "常规",
|
||||
L10nKey::SettingsEditShortcuts => "编辑快捷键…",
|
||||
L10nKey::SettingsModifiedOnly => "仅显示已修改",
|
||||
@@ -97,32 +159,26 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::Download => "下载",
|
||||
L10nKey::Link => "关联",
|
||||
L10nKey::SettingsThemeIntroTitle => "主题",
|
||||
L10nKey::SettingsThemeIntroDesc => "选择配色主题。每个主题都有各自的浅色或深色外观。",
|
||||
L10nKey::SettingsThemeIntroDesc => "每个主题自带浅色或深色外观。",
|
||||
L10nKey::SettingsTypography => "字体排版",
|
||||
L10nKey::SettingsFontSize => "终端字号",
|
||||
L10nKey::SettingsFontSizeDesc => "终端文字大小(像素)。",
|
||||
L10nKey::SettingsUiFontSize => "界面字号",
|
||||
L10nKey::SettingsUiFontSizeDesc => {
|
||||
"终端以外所有地方的文字大小——标签页、面板、设置。非 Retina 显示器上可以调大。"
|
||||
}
|
||||
L10nKey::SettingsUiFontSizeDesc => "标签页、面板、设置等非终端文字的大小。",
|
||||
L10nKey::SettingsUiFontFamily => "界面字体",
|
||||
L10nKey::SettingsUiFontFamilyDesc => {
|
||||
"用于标签页、侧栏、弹窗和设置的字体;默认使用系统 UI 字体。"
|
||||
}
|
||||
L10nKey::SettingsUiFontFamilyDesc => "用于标签页、侧栏、弹窗和设置。",
|
||||
L10nKey::SettingsLineHeight => "行高",
|
||||
L10nKey::SettingsLineHeightDesc => "行间距为字号的倍数。",
|
||||
L10nKey::SettingsFontFamily => "终端字体",
|
||||
L10nKey::SettingsFontFamilyDesc => "从系统已安装的字体中选择。",
|
||||
L10nKey::SettingsBoldFont => "粗体字体",
|
||||
L10nKey::SettingsBoldFontDesc => "粗体文字使用的字体;默认由主字体合成。",
|
||||
L10nKey::SettingsBoldFontDesc => "粗体字形;默认由主字体合成。",
|
||||
L10nKey::SettingsItalicFont => "斜体字体",
|
||||
L10nKey::SettingsItalicFontDesc => "斜体文字使用的字体;默认由主字体合成。",
|
||||
L10nKey::SettingsItalicFontDesc => "斜体字形;默认由主字体合成。",
|
||||
L10nKey::SettingsFontLigatures => "字体连字",
|
||||
L10nKey::SettingsFontLigaturesDesc => "为终端文字启用常见的编程连字特性。",
|
||||
L10nKey::SettingsFontLigaturesDesc => "终端文字启用编程连字。",
|
||||
L10nKey::SettingsFontThicken => "笔画加粗",
|
||||
L10nKey::SettingsFontThickenDesc => {
|
||||
"macOS 字体平滑:文字画得稍粗,浅色文字最明显。重启 tty7 后生效。"
|
||||
}
|
||||
L10nKey::SettingsFontThickenDesc => "文字画得稍粗一些,重启后生效。",
|
||||
L10nKey::SettingsCursor => "光标",
|
||||
L10nKey::SettingsCursorShape => "光标形状",
|
||||
L10nKey::SettingsCursorShapeDesc => "终端光标的绘制方式。",
|
||||
@@ -138,9 +194,7 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
}
|
||||
L10nKey::SettingsTransparency => "透明度",
|
||||
L10nKey::SettingsOpacity => "不透明度",
|
||||
L10nKey::SettingsOpacityDesc => {
|
||||
"窗口背景的不透明度,适用于所有主题。低于 100% 时可以看到桌面。"
|
||||
}
|
||||
L10nKey::SettingsOpacityDesc => "低于 100% 时可透出桌面。",
|
||||
L10nKey::SettingsBlur => "模糊",
|
||||
L10nKey::SettingsBlurDesc => {
|
||||
if cfg!(target_os = "macos") {
|
||||
@@ -149,13 +203,9 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
"模糊半透明窗口背后的内容。需要合成器支持——KDE Plasma 可以;GNOME 和裸 X11 下窗口只会变透明。"
|
||||
}
|
||||
}
|
||||
L10nKey::SettingsBlurAutoDesc => {
|
||||
"模糊半透明窗口背后的内容。仅在「背景材质」为「自动」时生效。"
|
||||
}
|
||||
L10nKey::SettingsBlurAutoDesc => "模糊窗口背后的内容,仅限「自动」材质。",
|
||||
L10nKey::SettingsBackdrop => "背景材质",
|
||||
L10nKey::SettingsBackdropDesc => {
|
||||
"半透明窗口背后的原生 Windows 背景材质。云母需要 Windows 11 22H2,亚克力需要 1809;更旧的系统会自动回退。"
|
||||
}
|
||||
L10nKey::SettingsBackdropDesc => "半透明窗口背后的原生背景材质。",
|
||||
L10nKey::SettingsSearchBackdropKeywords => {
|
||||
"材质 背景 云母 亚克力 模糊 毛玻璃 窗口 material backdrop mica acrylic blur frosted window background"
|
||||
}
|
||||
@@ -175,9 +225,7 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsImageOpacity => "图片不透明度",
|
||||
L10nKey::SettingsImageOpacityDesc => "图片叠加在背景色上的显示强度。",
|
||||
L10nKey::SettingsEditTheme => "编辑主题",
|
||||
L10nKey::SettingsEditThemeIntro => {
|
||||
"你正在编辑一份副本。更改会保存到主题文件夹中的对应文件并实时生效。"
|
||||
}
|
||||
L10nKey::SettingsEditThemeIntro => "正在编辑副本,更改实时生效并保存到主题文件夹。",
|
||||
L10nKey::SettingsBackgroundImage => "背景图片",
|
||||
L10nKey::SettingsBackgroundImageDesc => "叠加在背景色之上、文字之下。",
|
||||
L10nKey::SettingsAnsiColors => "ANSI 颜色",
|
||||
@@ -189,7 +237,7 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::ExplorerMenuOpenIn => "在 tty7 中打开",
|
||||
L10nKey::ExplorerMenuOpenHere => "在此处打开 tty7",
|
||||
L10nKey::SettingsCustomThemesIntro => {
|
||||
"复制一个主题即可在此编辑颜色,或把 tty7 YAML 主题、iTerm2 .itermcolors 文件放进主题文件夹。"
|
||||
"复制主题后即可编辑,或把 YAML、.itermcolors 文件放进主题文件夹。"
|
||||
}
|
||||
L10nKey::SettingsDuplicateToEdit => "复制以编辑",
|
||||
L10nKey::SettingsHosts => "主机",
|
||||
@@ -206,9 +254,7 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsMoreInSshConfig => "~/.ssh/config 中还有 {count} 个",
|
||||
L10nKey::SettingsAliasesLinked => "已关联 {count} 个别名。",
|
||||
L10nKey::SettingsImportAliases => "导入别名",
|
||||
L10nKey::SettingsImportAliasesDesc => {
|
||||
"重新读取文件并添加新内容。你在这里做的编辑由 tty7 保存——不会写入该文件本身。"
|
||||
}
|
||||
L10nKey::SettingsImportAliasesDesc => "重新读取文件并添加新条目,不会改动文件本身。",
|
||||
L10nKey::SettingsImportNow => "立即导入",
|
||||
L10nKey::SettingsImportUnreadable => "无法读取 {path}——没有导入任何内容。",
|
||||
L10nKey::SettingsImportNoHosts => "{path} 中没有可导入的主机——只有通配符或 Match 规则。",
|
||||
@@ -219,9 +265,7 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
"有 {count} 个选项在 tty7 中没有对应设置,仍留在文件里:{options}"
|
||||
}
|
||||
L10nKey::SettingsImportMoreOptions => "还有 {count} 个",
|
||||
L10nKey::SettingsDefaultsIntro => {
|
||||
"所有主机都从这些设置开始。每个主机都可以在自己的高级选项中覆盖某项。"
|
||||
}
|
||||
L10nKey::SettingsDefaultsIntro => "所有主机都以此为默认值,可在各自的高级选项中覆盖。",
|
||||
L10nKey::SettingsCopyAddress => "复制地址",
|
||||
L10nKey::SettingsDuplicate => "复制",
|
||||
L10nKey::SettingsForgetPassword => "清除已保存的密码",
|
||||
@@ -244,12 +288,10 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsSecurityIntro => "主机可以在自己的高级选项中覆盖这些设置。",
|
||||
L10nKey::SettingsVerifyHostKeys => "校验主机密钥",
|
||||
L10nKey::SettingsVerifyHostKeysDesc => {
|
||||
"连接前对照 known_hosts 检查服务器密钥。关闭后不做检查,被仿冒的服务器也不会被察觉。"
|
||||
"连接前对照 known_hosts 校验服务器密钥。关闭后无法察觉仿冒的服务器。"
|
||||
}
|
||||
L10nKey::WarnBeforeClosing => "关闭前警告",
|
||||
L10nKey::SettingsWarnBeforeClosingDesc => {
|
||||
"在关闭带有活动 SSH 会话的标签页或窗格前请求确认。"
|
||||
}
|
||||
L10nKey::SettingsWarnBeforeClosingDesc => "关闭有活动 SSH 会话的标签页前确认。",
|
||||
L10nKey::SettingsNewHost => "新主机",
|
||||
L10nKey::SettingsDiscardChangesTitle => "放弃未保存的更改?",
|
||||
L10nKey::SettingsDiscardChangesBody => "当前连接有未保存的更改。",
|
||||
@@ -301,9 +343,7 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsGroupSession => "会话",
|
||||
L10nKey::SettingsGroupSecurity => "安全",
|
||||
L10nKey::SettingsRemoteClipboardWrite => "远端剪贴板图片",
|
||||
L10nKey::SettingsRemoteClipboardWriteDesc => {
|
||||
"允许此主机上的程序通过 OSC 5522 用图片覆盖本机剪贴板。"
|
||||
}
|
||||
L10nKey::SettingsRemoteClipboardWriteDesc => "允许此主机通过 OSC 5522 写入图片到剪贴板。",
|
||||
L10nKey::SettingsIdentityFiles => "身份文件",
|
||||
L10nKey::SettingsIdentityFilesDesc => "私钥路径,每行一个(支持 %h/%r 展开)。",
|
||||
L10nKey::SettingsAgentForwarding => "ssh-agent 转发",
|
||||
@@ -375,18 +415,14 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsOn => "开",
|
||||
L10nKey::SettingsOff => "关",
|
||||
L10nKey::SettingsShell => "Shell",
|
||||
L10nKey::SettingsShellIntro => {
|
||||
"每个新终端启动的程序。将“Shell 程序”留空可使用平台默认值({default})。"
|
||||
}
|
||||
L10nKey::SettingsShellIntro => "新终端启动的程序,留空则使用 {default}。",
|
||||
L10nKey::SettingsProgram => "Shell 程序",
|
||||
L10nKey::SettingsProgramDesc => "PATH 中的可执行文件名或绝对路径,例如 zsh、fish、pwsh。",
|
||||
L10nKey::SettingsProgramDesc => "PATH 中的命令名或绝对路径,如 zsh、fish。",
|
||||
L10nKey::SettingsArguments => "Shell 参数",
|
||||
L10nKey::SettingsArgumentsDesc => {
|
||||
"启动参数,按命令行规则切分——含空格的参数请用引号包住(例如 -l,或 -c \"echo hi\")。"
|
||||
}
|
||||
L10nKey::SettingsArgumentsDesc => "按命令行规则切分,例如 -l 或 -c \"echo hi\"。",
|
||||
L10nKey::SettingsArgumentsInvalid => "引号不配对,该值未保存。",
|
||||
L10nKey::SettingsStartIn => "启动目录",
|
||||
L10nKey::SettingsStartInDesc => "新 shell 的启动目录:tty7 的启动目录、主目录或固定路径。",
|
||||
L10nKey::SettingsStartInDesc => "tty7 的启动目录、主目录或固定路径。",
|
||||
L10nKey::SettingsCustomPath => "自定义路径",
|
||||
L10nKey::SettingsCustomPathDesc => "新 shell 启动的目录。",
|
||||
L10nKey::SettingsWdInherit => "继承",
|
||||
@@ -394,7 +430,7 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsWdCustom => "自定义",
|
||||
L10nKey::SettingsWdPathInvalid => "这个目录不存在,该值未保存。",
|
||||
L10nKey::SettingsShellFooter => {
|
||||
"仅适用于没有目录可继承的 shell,例如窗口的第一个标签页。新标签页和分屏仍继承活动窗格的目录,已打开的 shell 继续运行。"
|
||||
"仅用于没有目录可继承的 shell,例如窗口的第一个标签页;新标签页和分屏沿用当前窗格的目录。"
|
||||
}
|
||||
L10nKey::SettingsScrolling => "滚动",
|
||||
L10nKey::SettingsScrollback => "终端输出历史行数",
|
||||
@@ -402,39 +438,32 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsScrollSpeed => "滚动速度",
|
||||
L10nKey::SettingsScrollSpeedDesc => "应用于鼠标滚轮滚动的倍率。",
|
||||
L10nKey::SettingsSmoothScroll => "平滑滚动",
|
||||
L10nKey::SettingsSmoothScrollDesc => {
|
||||
"滚轮每一格分几帧滚到位,而不是一次跳完。触控板本来就是连续滚动,不受影响。"
|
||||
}
|
||||
L10nKey::SettingsSmoothScrollDesc => "滚轮每格分几帧滚动,触控板不受影响。",
|
||||
L10nKey::SettingsMouse => "鼠标",
|
||||
L10nKey::SettingsFocusFollowsMouse => "焦点跟随鼠标",
|
||||
L10nKey::SettingsFocusFollowsMouseDesc => "悬停窗格即聚焦,无需点击。",
|
||||
L10nKey::SettingsHideMouseWhileTyping => "输入时隐藏鼠标",
|
||||
L10nKey::SettingsHideMouseWhileTypingDesc => "输入时隐藏指针;下次移动鼠标时恢复。",
|
||||
L10nKey::SettingsMouseZoom => "滚轮缩放",
|
||||
L10nKey::SettingsMouseZoomDesc => "按住该修饰键滚轮时缩放终端字号,而不是滚动。",
|
||||
L10nKey::SettingsMouseZoomDesc => "按住它滚动滚轮可缩放终端字号。",
|
||||
L10nKey::SettingsMouseZoomOff => "关闭",
|
||||
L10nKey::SettingsReportMouseToApps => "向应用报告鼠标",
|
||||
L10nKey::SettingsReportMouseToAppsDesc => {
|
||||
"让全屏应用(如 vim、tmux)处理点击和滚动;按住 Shift 可让操作保持本地。\
|
||||
关闭后点击不再传给它们,滚轮也会变成方向键。"
|
||||
"让 vim、tmux 等应用处理点击,按住 Shift 则留在本地。"
|
||||
}
|
||||
L10nKey::SettingsBell => "铃声",
|
||||
L10nKey::SettingsTerminalBell => "终端铃声",
|
||||
L10nKey::SettingsTerminalBellDesc => {
|
||||
"铃声(^G)的通知方式:静音、短暂闪烁、系统声音,或两者同时。"
|
||||
}
|
||||
L10nKey::SettingsTerminalBellDesc => "铃声(^G)的提示方式。",
|
||||
L10nKey::SettingsLinks => "链接",
|
||||
L10nKey::DetectUrls => "检测 URL",
|
||||
L10nKey::SettingsDetectUrlsDesc => "悬停时给链接加下划线,通过 {modifier}+点击 打开。",
|
||||
L10nKey::SettingsDetectUrlsDesc => "悬停显示下划线,{modifier}+点击 打开。",
|
||||
L10nKey::ForwardSshLoopbackLinks => "转发远程端口",
|
||||
L10nKey::SettingsForwardSshLoopbackLinksDesc => {
|
||||
"SSH 会话里,自动转发窗格开始监听的端口,并在本机打开它的 localhost 链接。"
|
||||
}
|
||||
L10nKey::SettingsForwardSshLoopbackLinksDesc => "在本机打开远程窗格的 localhost 链接。",
|
||||
L10nKey::SettingsOpenFilesInternal => "内置编辑器",
|
||||
L10nKey::SettingsOpenFilesSystem => "默认应用",
|
||||
L10nKey::SettingsOpenFilesCommand => "自定义命令",
|
||||
L10nKey::SettingsOpenFilesModeDesc => {
|
||||
"{modifier}+点击 文件链接时用什么打开。只有内置编辑器能跳到指定行、能打开远程主机上的文件。"
|
||||
"{modifier}+点击 文件链接时用什么打开。只有内置编辑器能跳到指定行、打开远程文件。"
|
||||
}
|
||||
L10nKey::LinkFileNotUnder => "{path} —— {dir} 下没有这个文件",
|
||||
L10nKey::LinkFileNoDirectory => {
|
||||
@@ -443,37 +472,27 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::LinkFileMissing => "{path} —— 这个路径下什么也没有",
|
||||
L10nKey::LinkDirOutsideTree => "{path} —— 它在另一台机器上,也不在文件面板打开的任何目录里",
|
||||
L10nKey::OpenFilesWith => "打开文件方式",
|
||||
L10nKey::SettingsOpenFilesWithDesc => {
|
||||
"{modifier}+点击 文件链接时运行的命令。可用 {path}、{line}、{column}——取值缺失的标志会被丢弃。留空则用默认应用。"
|
||||
}
|
||||
L10nKey::SettingsOpenFilesWithDesc => "可用 {path}、{line}、{column},留空用默认应用。",
|
||||
L10nKey::SettingsBellModeOff => "关",
|
||||
L10nKey::SettingsBellModeVisual => "闪烁",
|
||||
L10nKey::SettingsBellModeAudible => "声音",
|
||||
L10nKey::SettingsBellModeBoth => "闪烁 + 声音",
|
||||
L10nKey::SettingsPrompt => "提示符与命令历史",
|
||||
L10nKey::SettingsPromptIntro => {
|
||||
"shell 提示符处的 tty7 自带编辑器与菜单。关闭某项即可把这部分交还给 shell。"
|
||||
}
|
||||
L10nKey::SettingsPromptIntro => "提示符上 tty7 自带的编辑器和菜单,关闭即交还给 shell。",
|
||||
L10nKey::SettingsPromptEditor => "tty7 提示符编辑器",
|
||||
L10nKey::SettingsPromptEditorDesc => {
|
||||
"由 tty7 编辑你在 shell 提示符上敲的这一行:选择、撤销,以及下面这些菜单。关闭后交还给 shell 自己的行编辑器——ZLE、readline、fish。"
|
||||
"在输入行上提供选择、撤销和菜单。关闭后交还给 ZLE、readline 或 fish。"
|
||||
}
|
||||
L10nKey::SettingsNeedsPromptEditor => {
|
||||
"需要提示符编辑器:它关闭时,这个按键本就归 shell 所有。"
|
||||
}
|
||||
L10nKey::SettingsTabCompletion => "Tab 补全",
|
||||
L10nKey::SettingsTabCompletionDesc => {
|
||||
"在提示符按 Tab 打开 tty7 的补全菜单。关闭后 Tab 交由 shell 自身的补全处理。"
|
||||
}
|
||||
L10nKey::SettingsTabCompletionDesc => "Tab 打开 tty7 的补全菜单,关闭后交给 shell。",
|
||||
L10nKey::SettingsHistorySearch => "命令历史搜索",
|
||||
L10nKey::SettingsHistorySearchDesc => {
|
||||
"在提示符按 ⌃R 打开 tty7 的模糊历史菜单。关闭后 ⌃R 交给 shell——它自带的反向搜索,或你绑定的其它功能(fzf、percol)。"
|
||||
}
|
||||
L10nKey::SettingsHistorySearchDesc => "⌃R 打开 tty7 的模糊历史搜索,关闭后交给 shell。",
|
||||
L10nKey::SettingsSelectionClipboard => "选择与剪贴板",
|
||||
L10nKey::SettingsSmartSelection => "智能选择",
|
||||
L10nKey::SettingsSmartSelectionDesc => {
|
||||
"双击选择光标下的完整 URL、文件路径、邮箱或成对的括号。"
|
||||
}
|
||||
L10nKey::SettingsSmartSelectionDesc => "双击选中完整的 URL、路径、邮箱或括号对。",
|
||||
L10nKey::SettingsCopyOnSelect => "选中即复制",
|
||||
L10nKey::SettingsCopyOnSelectDesc => {
|
||||
if cfg!(target_os = "macos") {
|
||||
@@ -486,12 +505,10 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsTrimTrailingSpacesDesc => "去除每行复制文本末尾的空白。",
|
||||
L10nKey::SettingsKeyboard => "键盘",
|
||||
L10nKey::SettingsOptionAsMeta => "Option (⌥) 作为 Meta",
|
||||
L10nKey::SettingsOptionAsMetaDesc => {
|
||||
"⌥+按键 发送 shell 期望的转义组合键(⌥B = 后退一个词),而不是输入特殊字符(∫)。"
|
||||
}
|
||||
L10nKey::SettingsAgentsIntro => "AI agent",
|
||||
L10nKey::SettingsOptionAsMetaDesc => "⌥+按键 作为 Meta,如 ⌥B 后退一词。",
|
||||
L10nKey::SettingsAgentsIntro => "Agent 钩子",
|
||||
L10nKey::SettingsAgentsIntroDesc => {
|
||||
"安装 hook,让运行 AI agent 的窗格在标签栏显示实时状态(进行中 / 等待中 / 已完成)。仅在 tty7 内生效。"
|
||||
"安装 hook 后,agent 的状态(进行中 / 等待中 / 已完成)会显示在标签栏。"
|
||||
}
|
||||
L10nKey::SettingsReadingAgentConfig => "正在读取这台机器的 AI agent 配置…",
|
||||
L10nKey::SettingsStatusNotInstalled => "未安装",
|
||||
@@ -504,10 +521,10 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsOfflineMachines => {
|
||||
"还有 {count} 台已保存的机器未连接——在其中一台上打开工作区,即可在那台机器上安装 hook。"
|
||||
}
|
||||
L10nKey::SettingsSyncWithSystem => "跟随系统",
|
||||
L10nKey::SettingsSyncWithSystem => "外观",
|
||||
L10nKey::SettingsSyncWithSystemDesc => "跟随操作系统外观,并分别使用浅色与深色主题。",
|
||||
L10nKey::SettingsLegiblePalette => "低对比度颜色纠偏",
|
||||
L10nKey::SettingsLegiblePaletteDesc => "自动把主题背景上对比度不足的颜色调整到可读级别。",
|
||||
L10nKey::SettingsLegiblePaletteDesc => "自动调整在背景上看不清的亮色。",
|
||||
L10nKey::SettingsChangeTheme => "更换主题",
|
||||
L10nKey::SettingsThemes => "主题",
|
||||
L10nKey::SettingsThemesCloseTooltip => "关闭主题面板 (Esc)",
|
||||
@@ -525,30 +542,20 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsStartupWindow => "启动窗口",
|
||||
L10nKey::SettingsStartupWindowDesc => "tty7 启动时的窗口状态。",
|
||||
L10nKey::SettingsRememberWindowSize => "记住窗口大小与位置",
|
||||
L10nKey::SettingsRememberWindowSizeDesc => {
|
||||
"以 tty7 上次退出时窗口的大小和位置重新打开。关闭时以默认大小居中打开。"
|
||||
}
|
||||
L10nKey::SettingsRememberWindowSizeDesc => "按上次退出时的大小和位置打开窗口。",
|
||||
L10nKey::SettingsRestoreLastLayout => "恢复上次布局",
|
||||
L10nKey::SettingsRestoreLastLayoutDesc => {
|
||||
"启动时恢复上次窗口的标签页、分屏和目录。关闭时从单个新终端开始。"
|
||||
}
|
||||
L10nKey::SettingsRestoreLastLayoutDesc => "启动时恢复上次的标签页、分屏和目录。",
|
||||
L10nKey::SettingsShowTrayIcon => "显示托盘图标",
|
||||
L10nKey::SettingsShowTrayIconDesc => {
|
||||
"在系统托盘/菜单栏保留状态项:agent 需要输入时发出提示,菜单可跳到该 agent 的窗格。"
|
||||
}
|
||||
L10nKey::SettingsShowTrayIconDesc => "agent 等待输入时提醒,可跳到对应窗格。",
|
||||
L10nKey::SettingsTabs => "标签页",
|
||||
L10nKey::SettingsNewTabPosition => "新标签页位置",
|
||||
L10nKey::SettingsNewTabPositionDesc => "新打开的标签页插入的位置。",
|
||||
L10nKey::SettingsTabBarPosition => "标签栏位置",
|
||||
L10nKey::SettingsTabBarPositionDesc => "将标签页显示为顶部横向条或左侧垂直侧栏。",
|
||||
L10nKey::SettingsSidebarGrouping => "侧栏分组",
|
||||
L10nKey::SettingsSidebarGroupingDesc => {
|
||||
"按 git 仓库给侧栏标签页分组。仓库外的标签页归到“草稿”,选“按仓库或文件夹”时则按工作目录分。仅左侧栏。"
|
||||
}
|
||||
L10nKey::SettingsSidebarGroupingDesc => "按 git 仓库分组侧栏标签页,其余归入“草稿”。",
|
||||
L10nKey::SettingsDiffPreviewFromCounts => "从侧栏计数打开 diff 预览",
|
||||
L10nKey::SettingsDiffPreviewFromCountsDesc => {
|
||||
"点击行上的 +N −N 在浮层中打开 worktree diff。关闭后计数仍显示,只是不可点击。"
|
||||
}
|
||||
L10nKey::SettingsDiffPreviewFromCountsDesc => "点击行上的 +N −N 打开 diff。",
|
||||
L10nKey::DocumentDock => "停靠在终端旁",
|
||||
L10nKey::DocumentFill => "铺满窗口",
|
||||
L10nKey::SettingsNotifications => "通知",
|
||||
@@ -571,18 +578,14 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsByRepoOrFolder => "按仓库或文件夹",
|
||||
L10nKey::SettingsFlat => "平铺",
|
||||
L10nKey::SettingsPreset => "预设",
|
||||
L10nKey::SettingsPresetDesc => {
|
||||
"tmux 预设把窗格/标签页操作映射为前缀序列(例如 Ctrl-B 后按 C)。"
|
||||
}
|
||||
L10nKey::SettingsPresetDesc => "tmux 预设把操作映射为前缀键(如 Ctrl-B C)。",
|
||||
L10nKey::SettingsPrefix => "前缀",
|
||||
L10nKey::SettingsPressKeys => "按下按键… · ⌫ 表示不设快捷键",
|
||||
L10nKey::SettingsPauseToSaveEsc => "暂停以保存 · Esc",
|
||||
L10nKey::SettingsKeybindingsIntroDesc => {
|
||||
"点击某个快捷键,再按下新按键,短暂停顿后保存。连续按键可组成序列,例如 Ctrl-B 后按 X。Esc 取消;Backspace 移除最后一个按键,最先按下则不设快捷键,点「重置」可恢复默认。"
|
||||
}
|
||||
L10nKey::SettingsPrefixNote => {
|
||||
"启用前缀后,单独按前缀键约 1 秒后会传给 shell,前缀 + 未绑定的按键会直接发送到终端。"
|
||||
"点击快捷键后按新按键,连按可组成序列(如 Ctrl-B X)。Esc 取消,Backspace 清除。"
|
||||
}
|
||||
L10nKey::SettingsPrefixNote => "单独按前缀键,约 1 秒后传给 shell。",
|
||||
L10nKey::SettingsRestoreAllDefaults => "恢复全部默认值",
|
||||
L10nKey::SettingsRestoreAllDefaultsBody => "你改过的每一个按键都会退回默认值,且无法撤销。",
|
||||
L10nKey::KeybindGoToTab => "跳到第 {n} 个标签页",
|
||||
@@ -592,10 +595,12 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::KeybindForkSessionLeft => "向左 Fork 会话",
|
||||
L10nKey::KeybindForkSessionDown => "向下 Fork 会话",
|
||||
L10nKey::KeybindForkSessionUp => "向上 Fork 会话",
|
||||
L10nKey::SettingsAboutDesc1 => "终端工作台:持久会话、远程开发、AI agent。",
|
||||
L10nKey::SettingsAboutDesc1 => {
|
||||
"为长时间工作打造的终端工作台。会话不随窗口关闭而结束,远程主机用起来和本地一样,编程 agent 的状态直接显示在侧栏里。"
|
||||
}
|
||||
L10nKey::SettingsDefaultTerminal => "默认终端",
|
||||
L10nKey::SettingsDefaultTerminalDesc => {
|
||||
"将 tty7 设为 Unix 可执行文件、SSH 链接和 man 页面链接的 macOS 默认终端。tty7 仍可打开文件夹和脚本,但不会替换 Finder 的文件夹处理程序。自行指定终端的应用可能不会遵循此设置。"
|
||||
"用 tty7 打开 Unix 可执行文件、SSH 链接和 man 页面。"
|
||||
}
|
||||
L10nKey::SettingsDefaultTerminalSet => "设为默认终端",
|
||||
L10nKey::SettingsDefaultTerminalSetSuccess => {
|
||||
@@ -623,18 +628,14 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsUpdateInstallNow => "安装并重启",
|
||||
L10nKey::SettingsUpdateDiscard => "丢弃",
|
||||
L10nKey::SettingsAutoDownload => "后台下载更新",
|
||||
L10nKey::SettingsAutoDownloadDesc => {
|
||||
"发现新版本就先下载并校验好,安装时只需重启一下。不会未经确认就安装。安装包约 30 MB。"
|
||||
}
|
||||
L10nKey::SettingsAutoDownloadDesc => "后台下载新版本,安装时只需重启;不会未经确认就安装。",
|
||||
L10nKey::SettingsUpdateChannel => "更新通道",
|
||||
L10nKey::SettingsUpdateChannelDesc => {
|
||||
"稳定版(Stable)跟随正式发布的版本;每夜构建(Nightly)跟随每晚从最新代码构建的版本,更新更快,但未经发布测试。"
|
||||
}
|
||||
L10nKey::SettingsUpdateChannelDesc => "Nightly 每晚从最新代码构建,未经发布测试。",
|
||||
L10nKey::SettingsUpdateChannelStable => "稳定版",
|
||||
L10nKey::SettingsUpdateChannelNightly => "每夜构建",
|
||||
L10nKey::SettingsDaemonStale => "tty7 server 仍运行在 {build}。",
|
||||
L10nKey::SettingsDaemonStaleDesc => {
|
||||
"tty7 是原地升级的:界面已是新版,窗格还由旧版 tty7 server 托管。重启 tty7 server 换成新版,代价是窗格里正在跑的进程全部结束。不急,挑窗格空闲时再重启。"
|
||||
"tty7 已更新,但窗格仍跑在旧版 server 上。重启后换用新版,窗格中运行的进程会全部结束。"
|
||||
}
|
||||
L10nKey::UpdateDialogTitle => "有可用更新",
|
||||
L10nKey::UpdateDialogDetail => {
|
||||
@@ -679,17 +680,13 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::SettingsCheckUpdatesDesc => "无法就地更新的安装方式会改为打开发布页面。",
|
||||
L10nKey::SettingsCheckUpdatesOnLaunch => "启动时检查更新",
|
||||
L10nKey::SettingsCommandLine => "命令行",
|
||||
L10nKey::SettingsCommandLineDesc => {
|
||||
"让脚本和 AI agent 使用随应用提供的 tty7 命令。下次启动生效;关闭后不会移除已安装的命令。"
|
||||
}
|
||||
L10nKey::SettingsCommandLineDesc => "把 tty7 命令加入 PATH,下次启动生效。",
|
||||
L10nKey::SettingsInstallCliOnPath => "将 tty7 命令安装到 PATH",
|
||||
L10nKey::SettingsServer => "tty7 server",
|
||||
L10nKey::SettingsServerDesc => "管理这台计算机上的终端会话,让会话在后台持续运行。",
|
||||
L10nKey::SettingsServerDesc => "让终端会话在后台持续运行。",
|
||||
L10nKey::SettingsRestartServer => "重启 tty7 server…",
|
||||
L10nKey::SettingsAppHttpProxy => "更新代理",
|
||||
L10nKey::SettingsAppHttpProxyDesc => {
|
||||
"仅用于 tty7 自身的更新检查和下载,不影响窗格中运行的程序。留空则跟随系统代理。"
|
||||
}
|
||||
L10nKey::SettingsAppHttpProxyDesc => "仅用于 tty7 的更新检查,留空跟随系统。",
|
||||
L10nKey::SettingsAppHttpProxyInvalid => "不是有效的代理地址,该值未保存。",
|
||||
L10nKey::SettingsAgentClaudeCode => "Claude Code",
|
||||
L10nKey::SettingsAgentCodex => "Codex",
|
||||
@@ -1655,7 +1652,7 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
L10nKey::Replace => "覆盖",
|
||||
L10nKey::SftpErrorInvalidOctalMode => "无效的八进制模式",
|
||||
L10nKey::SettingsDaemonStaleDescInPlace => {
|
||||
"tty7 是原地更新的:应用是新的,窗格还跑在旧版上。tty7 server 可以不停机就换成新版,shell 直接延续下来。用 tty7 内置 SSH 客户端的窗格除外——那些连接会断开,需要重新打开。"
|
||||
"tty7 已更新。server 可原地替换,shell 不受影响;只有内置 SSH 的窗格会断开。"
|
||||
}
|
||||
L10nKey::AppRestartServerBodyInPlace => {
|
||||
"tty7 server 会原地把自己换成当前这个版本:shell 继续运行,窗口稍后自动连回去。用 tty7 内置 SSH 客户端的窗格除外——那些连接会断开,需要重新打开。"
|
||||
@@ -1664,9 +1661,7 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
"已恢复的画面 —— 下面是新的 shell,上面的内容都已不在运行"
|
||||
}
|
||||
L10nKey::SettingsPerPaneHistory => "各窗格使用独立命令历史",
|
||||
L10nKey::SettingsPerPaneHistoryDescription => {
|
||||
"上方向键翻的是这个窗格里跑过的命令,而不是所有窗格混在一起。新窗格从已有历史开始,关闭时把新增的写回去。只对 tty7 能接管的 bash 和 zsh 窗格生效;用你自己参数启动的 shell 不受影响。"
|
||||
}
|
||||
L10nKey::SettingsPerPaneHistoryDescription => "↑ 只翻本窗格的历史,仅限 bash 和 zsh。",
|
||||
L10nKey::IntegrationNoticeBlocked => {
|
||||
"“{wrapper}”截获了此窗格的 shell 上报,内联补全和 Ctrl+R 菜单不可用。shell 自带的历史搜索仍可使用。"
|
||||
}
|
||||
@@ -1806,6 +1801,18 @@ pub fn translate_zh(key: L10nKey) -> Option<&'static str> {
|
||||
|
||||
pub fn translate_variant_zh(key: L10nKey, branch: &'static str) -> Option<&'static str> {
|
||||
let res = match (key, branch) {
|
||||
(L10nKey::SettingsMatchCount, "zero") => "没有结果",
|
||||
(L10nKey::SettingsMatchCount, "one") => "1 个结果",
|
||||
(L10nKey::SettingsMatchCount, "other") => "{count} 个结果",
|
||||
(L10nKey::SettingsRestoreChanged, "zero") => "恢复修改",
|
||||
(L10nKey::SettingsRestoreChanged, "one") => "恢复 1 项修改",
|
||||
(L10nKey::SettingsRestoreChanged, "other") => "恢复 {count} 项修改",
|
||||
(L10nKey::SettingsMoreHosts, "zero") => "没有更多主机",
|
||||
(L10nKey::SettingsMoreHosts, "one") => "还有 1 台主机",
|
||||
(L10nKey::SettingsMoreHosts, "other") => "还有 {count} 台主机",
|
||||
(L10nKey::SettingsMoreAgents, "zero") => "没有更多 Agent",
|
||||
(L10nKey::SettingsMoreAgents, "one") => "还有 1 个可用 Agent",
|
||||
(L10nKey::SettingsMoreAgents, "other") => "还有 {count} 个可用 Agent",
|
||||
(L10nKey::SettingsDeleteProfileCascade, "one") => {
|
||||
"有 1 个已保存的远程工作区条目指向 {endpoint},将随配置一并从本机清除;\
|
||||
远端机器上的会话不受影响,新建配置连上同一台机器后即可在工作区列表找回。"
|
||||
|
||||
@@ -11,9 +11,11 @@ pub(crate) trait RoundedCorners: Styled + Sized {
|
||||
|
||||
impl<T: Styled + Sized> RoundedCorners for T {}
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(crate) const TRACK_RADIUS: Pixels = px(8.);
|
||||
|
||||
/// Inset cards, interactive rows, and floating panels share the A style scale.
|
||||
#[allow(dead_code)]
|
||||
pub(crate) const CARD_RADIUS: Pixels = px(10.);
|
||||
pub(crate) const ROW_RADIUS: Pixels = px(7.);
|
||||
pub(crate) const POPOVER_RADIUS: Pixels = px(10.);
|
||||
|
||||
@@ -0,0 +1,525 @@
|
||||
//! Integrations: the agent hooks that put each agent's live status in the
|
||||
//! sidebar, per machine, and the `tty7` command on PATH.
|
||||
|
||||
use crate::core::agent_hooks::{HookAgent, HooksState};
|
||||
|
||||
use super::kit::{self, BtnKind, Tk, fs};
|
||||
use super::shell::MenuEntry;
|
||||
use super::*;
|
||||
|
||||
/// The agent the tab bar draws for this hook, so the two show the same mark.
|
||||
fn cli_agent(agent: HookAgent) -> crate::core::cli_agent::CLIAgent {
|
||||
use crate::core::cli_agent::CLIAgent as C;
|
||||
match agent {
|
||||
HookAgent::Claude => C::Claude,
|
||||
HookAgent::Codex => C::Codex,
|
||||
HookAgent::TraeCode => C::TraeCode,
|
||||
HookAgent::Copilot => C::Copilot,
|
||||
HookAgent::OpenCode => C::OpenCode,
|
||||
HookAgent::Pi => C::Pi,
|
||||
HookAgent::Grok => C::Grok,
|
||||
HookAgent::OhMyPi => C::OhMyPi,
|
||||
HookAgent::Gemini => C::Gemini,
|
||||
HookAgent::Droid => C::Droid,
|
||||
HookAgent::Qwen => C::Qwen,
|
||||
HookAgent::Goose => C::Goose,
|
||||
HookAgent::Kimi => C::Kimi,
|
||||
HookAgent::QoderCLI => C::QoderCLI,
|
||||
HookAgent::Crush => C::Crush,
|
||||
HookAgent::CodeBuddy => C::CodeBuddy,
|
||||
HookAgent::Cursor => C::Cursor,
|
||||
}
|
||||
}
|
||||
|
||||
impl Tty7App {
|
||||
pub(crate) fn render_settings_agents(&self, cx: &mut Context<Self>) -> AnyElement {
|
||||
Self::settings_page([
|
||||
self.render_agent_hooks_group(cx),
|
||||
self.render_command_line_rows(cx),
|
||||
])
|
||||
}
|
||||
|
||||
pub(crate) fn render_command_line_rows(&self, cx: &mut Context<Self>) -> AnyElement {
|
||||
let on = cx.global::<Config>().install_cli_on_path;
|
||||
let control = self.settings_switch("install-cli-on-path", on, cx, |this, on, _, cx| {
|
||||
this.set_install_cli_on_path(on, cx)
|
||||
});
|
||||
self.settings_group(
|
||||
Some(t(L10nKey::SettingsCommandLine)),
|
||||
None,
|
||||
[self
|
||||
.settings_row(
|
||||
t(L10nKey::SettingsInstallCliOnPath),
|
||||
t(L10nKey::SettingsCommandLineDesc),
|
||||
control,
|
||||
cx,
|
||||
)
|
||||
.into_any_element()],
|
||||
cx,
|
||||
)
|
||||
}
|
||||
|
||||
fn render_agent_hooks_group(&self, cx: &mut Context<Self>) -> AnyElement {
|
||||
let tk = Tk::of(cx);
|
||||
let Some(s) = self.active_settings() else {
|
||||
return div().into_any_element();
|
||||
};
|
||||
let view = s.agent_hooks_states.clone();
|
||||
let note = s.agent_hooks_note.clone();
|
||||
let selected = s.agent_hooks_host;
|
||||
let query_input = s.agent_query.clone();
|
||||
let query = query_input.read(cx).value().trim().to_lowercase();
|
||||
let show_all = s.agent_show_all;
|
||||
let touched = s.agent_touched.clone();
|
||||
let busy = s.agent_busy.clone();
|
||||
let focused = s.focused_setting;
|
||||
let menu_open = s.menu.clone();
|
||||
|
||||
// The machine the hooks below belong to.
|
||||
let machines = self.agent_hooks_machines(cx);
|
||||
let offline = self.agent_hooks_offline_count(cx);
|
||||
let current = machines
|
||||
.iter()
|
||||
.find(|m| m.host == selected)
|
||||
.map(|m| m.label.clone())
|
||||
.unwrap_or_default();
|
||||
let rows: Vec<AgentHookRow> = match &view {
|
||||
AgentHooksView::Ready(rows) => rows.clone(),
|
||||
_ => Vec::new(),
|
||||
};
|
||||
let installed = rows
|
||||
.iter()
|
||||
.filter(|r| r.state != HooksState::NotInstalled)
|
||||
.count();
|
||||
let mut entries = vec![MenuEntry::Heading(
|
||||
t(L10nKey::SettingsConnectedMachines).into(),
|
||||
)];
|
||||
for m in &machines {
|
||||
let host = m.host;
|
||||
entries.push(MenuEntry::Item {
|
||||
label: m.label.clone().into(),
|
||||
checked: host == selected,
|
||||
font: None,
|
||||
danger: false,
|
||||
trailing: (host == selected && matches!(view, AgentHooksView::Ready(_))).then(
|
||||
|| {
|
||||
t_fmt(
|
||||
L10nKey::SettingsInstalledCount,
|
||||
&[("count", &installed.to_string())],
|
||||
)
|
||||
.into()
|
||||
},
|
||||
),
|
||||
on_pick: std::rc::Rc::new(move |this, _w, cx| {
|
||||
if let Some(s) = this.active_settings_mut() {
|
||||
s.agent_touched.clear();
|
||||
}
|
||||
this.select_agent_hooks_host(host, cx)
|
||||
}),
|
||||
});
|
||||
}
|
||||
if offline > 0 {
|
||||
entries.push(MenuEntry::Separator);
|
||||
entries.push(MenuEntry::Note(
|
||||
t_plural(L10nKey::SettingsOfflineMachines, offline, &[]).into(),
|
||||
));
|
||||
}
|
||||
let machine_icon = Icon::empty()
|
||||
.path(if selected.is_local() {
|
||||
"icons/settings/machine-local.svg"
|
||||
} else {
|
||||
"icons/settings/machine-remote.svg"
|
||||
})
|
||||
.size(px(12.))
|
||||
.text_color(tk.k5)
|
||||
.into_any_element();
|
||||
let machine = self.settings_dropdown(
|
||||
"agent-hooks-machine",
|
||||
current.clone(),
|
||||
Some(machine_icon),
|
||||
entries,
|
||||
cx,
|
||||
);
|
||||
let machine_desc = if selected.is_local() {
|
||||
t(L10nKey::SettingsMachineLocalDesc).to_string()
|
||||
} else {
|
||||
t_fmt(L10nKey::SettingsMachineRemoteDesc, &[("name", ¤t)])
|
||||
};
|
||||
let machine_row = h_flex()
|
||||
.min_h(px(52.))
|
||||
.py(px(12.))
|
||||
.gap(px(32.))
|
||||
.items_center()
|
||||
.justify_between()
|
||||
.child(
|
||||
v_flex()
|
||||
.min_w_0()
|
||||
.gap(px(2.))
|
||||
.child(div().text_size(fs(13.)).child(t(L10nKey::SettingsMachine)))
|
||||
.child(
|
||||
div()
|
||||
.text_size(fs(12.))
|
||||
.line_height(px(17.))
|
||||
.text_color(tk.k5)
|
||||
.child(machine_desc),
|
||||
),
|
||||
)
|
||||
.child(machine)
|
||||
.into_any_element();
|
||||
|
||||
let total = HookAgent::ALL.len();
|
||||
let toolbar = h_flex()
|
||||
.gap(px(12.))
|
||||
.items_center()
|
||||
.pt(px(10.))
|
||||
.pb(px(8.))
|
||||
.child(
|
||||
kit::search_field(&query_input, &tk)
|
||||
.w(px(240.))
|
||||
.capture_key_down(cx.listener(|this, ev: &KeyDownEvent, window, cx| {
|
||||
if ev.keystroke.key.as_str() == "escape" {
|
||||
let input = this.active_settings().map(|s| s.agent_query.clone());
|
||||
if let Some(input) = input
|
||||
&& !input.read(cx).value().is_empty()
|
||||
{
|
||||
input.update(cx, |i, cx| i.set_value("", window, cx));
|
||||
cx.stop_propagation();
|
||||
}
|
||||
}
|
||||
})),
|
||||
)
|
||||
.child(div().flex_1())
|
||||
.when(matches!(view, AgentHooksView::Ready(_)), |r| {
|
||||
r.child(div().text_size(fs(12.)).text_color(tk.k45).child(t_fmt(
|
||||
L10nKey::SettingsAgentsInstalledSummary,
|
||||
&[
|
||||
("count", &installed.to_string()),
|
||||
("total", &total.to_string()),
|
||||
],
|
||||
)))
|
||||
})
|
||||
.into_any_element();
|
||||
|
||||
let mut body: Vec<AnyElement> = vec![machine_row, toolbar];
|
||||
match &view {
|
||||
AgentHooksView::Loading => body.push(
|
||||
div()
|
||||
.h(px(44.))
|
||||
.flex()
|
||||
.items_center()
|
||||
.text_color(tk.k35)
|
||||
.child(t(L10nKey::SettingsReadingAgentConfig))
|
||||
.into_any_element(),
|
||||
),
|
||||
AgentHooksView::Unavailable(reason) => body.push(
|
||||
div()
|
||||
.py(px(12.))
|
||||
.text_size(fs(12.5))
|
||||
.text_color(tk.warn_text)
|
||||
.child(reason.clone())
|
||||
.into_any_element(),
|
||||
),
|
||||
AgentHooksView::Ready(rows) => {
|
||||
let has = |r: &AgentHookRow| r.state != HooksState::NotInstalled;
|
||||
let is_focused =
|
||||
|r: &AgentHookRow| focused.is_some_and(|k| t(k) == r.agent.display_name());
|
||||
let mut list: Vec<&AgentHookRow> = rows
|
||||
.iter()
|
||||
.filter(|r| {
|
||||
if !query.is_empty() {
|
||||
return format!("{} {}", r.agent.display_name(), r.target)
|
||||
.to_lowercase()
|
||||
.contains(&query);
|
||||
}
|
||||
show_all || has(r) || touched.contains(&r.agent) || is_focused(r)
|
||||
})
|
||||
.collect();
|
||||
let rank = |r: &AgentHookRow| match r.state {
|
||||
HooksState::Outdated => 0,
|
||||
HooksState::Installed => 1,
|
||||
HooksState::NotInstalled => 2,
|
||||
};
|
||||
list.sort_by_key(|r| {
|
||||
(
|
||||
rank(r),
|
||||
HookAgent::ALL
|
||||
.iter()
|
||||
.position(|a| *a == r.agent)
|
||||
.unwrap_or(0),
|
||||
)
|
||||
});
|
||||
let none = list.is_empty();
|
||||
let mut col = v_flex()
|
||||
.id("agent-hook-list")
|
||||
.when(!query.is_empty() || show_all, |c| {
|
||||
c.max_h(px(416.)).overflow_y_scroll()
|
||||
});
|
||||
for (i, row) in list.into_iter().enumerate() {
|
||||
let row_note = note
|
||||
.as_ref()
|
||||
.filter(|(a, _)| *a == row.agent)
|
||||
.map(|(_, text)| text.clone());
|
||||
col = col.child(self.render_agent_row(
|
||||
i,
|
||||
row,
|
||||
busy.contains(&row.agent),
|
||||
row_note,
|
||||
menu_open.as_deref(),
|
||||
cx,
|
||||
));
|
||||
}
|
||||
body.push(col.into_any_element());
|
||||
if none {
|
||||
body.push(
|
||||
div()
|
||||
.h(px(44.))
|
||||
.flex()
|
||||
.items_center()
|
||||
.text_color(tk.k35)
|
||||
.child(if query.is_empty() {
|
||||
t(L10nKey::SettingsNoAgentsInstalled).to_string()
|
||||
} else {
|
||||
t_fmt(L10nKey::SettingsNoAgentsMatch, &[("query", &query)])
|
||||
})
|
||||
.into_any_element(),
|
||||
);
|
||||
}
|
||||
let rest = total - installed;
|
||||
if query.is_empty() && rest > 0 {
|
||||
body.push(
|
||||
h_flex()
|
||||
.h(px(40.))
|
||||
.gap(px(8.))
|
||||
.items_center()
|
||||
.text_size(fs(12.))
|
||||
.text_color(tk.k45)
|
||||
.when(!show_all, |r| {
|
||||
r.child(t_plural(L10nKey::SettingsMoreAgents, rest, &[]))
|
||||
})
|
||||
.child(
|
||||
kit::button(
|
||||
"agent-show-all",
|
||||
if show_all {
|
||||
t(L10nKey::SettingsShowInstalledOnly)
|
||||
} else {
|
||||
t(L10nKey::SettingsShowAll)
|
||||
},
|
||||
BtnKind::Link,
|
||||
)
|
||||
.on_click(cx.listener(
|
||||
|this, _, _w, cx| {
|
||||
if let Some(s) = this.active_settings_mut() {
|
||||
s.agent_show_all = !s.agent_show_all;
|
||||
s.agent_touched.clear();
|
||||
}
|
||||
cx.notify();
|
||||
},
|
||||
)),
|
||||
)
|
||||
.into_any_element(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.settings_group(
|
||||
Some(t(L10nKey::SettingsAgentsIntro)),
|
||||
Some(t(L10nKey::SettingsAgentsIntroDesc).to_string()),
|
||||
body,
|
||||
cx,
|
||||
)
|
||||
}
|
||||
|
||||
fn render_agent_row(
|
||||
&self,
|
||||
i: usize,
|
||||
row: &AgentHookRow,
|
||||
busy: bool,
|
||||
note: Option<String>,
|
||||
menu_open: Option<&str>,
|
||||
cx: &mut Context<Self>,
|
||||
) -> AnyElement {
|
||||
let tk = Tk::of(cx);
|
||||
let agent = row.agent;
|
||||
let mark = cli_agent(agent);
|
||||
let (status, dot) = if busy {
|
||||
(Some(t(L10nKey::SettingsWorking)), tk.k3)
|
||||
} else {
|
||||
match row.state {
|
||||
HooksState::Installed => (Some(t(L10nKey::SettingsStatusInstalled)), tk.ok),
|
||||
HooksState::Outdated => (Some(t(L10nKey::SettingsUpdateAvailable)), tk.warn),
|
||||
HooksState::NotInstalled => (None, tk.k3),
|
||||
}
|
||||
};
|
||||
let action = (!busy)
|
||||
.then(|| match row.state {
|
||||
HooksState::NotInstalled => Some(t(L10nKey::SettingsInstall)),
|
||||
HooksState::Outdated => Some(t(L10nKey::SettingsUpdate)),
|
||||
HooksState::Installed => None,
|
||||
})
|
||||
.flatten();
|
||||
let has_menu = row.state != HooksState::NotInstalled && !busy;
|
||||
let menu_id: SharedString = format!("agent-menu-{i}").into();
|
||||
let open = menu_open == Some(menu_id.as_ref());
|
||||
let local = self
|
||||
.active_settings()
|
||||
.is_some_and(|s| s.agent_hooks_host.is_local());
|
||||
let target = row.target.clone();
|
||||
let menu = has_menu.then(|| {
|
||||
let mut entries = vec![MenuEntry::item(
|
||||
t(L10nKey::SettingsReinstall),
|
||||
false,
|
||||
move |this, _w, cx| this.settings_install_agent_hooks(agent, cx),
|
||||
)];
|
||||
if local {
|
||||
entries.push(MenuEntry::item(
|
||||
t(L10nKey::SettingsRevealHookFile),
|
||||
false,
|
||||
move |_this, _w, cx| {
|
||||
let path = crate::core::ssh_profile::expand_tilde(&target);
|
||||
cx.reveal_path(std::path::Path::new(&path));
|
||||
},
|
||||
));
|
||||
}
|
||||
entries.push(MenuEntry::Item {
|
||||
label: t(L10nKey::SettingsUninstall).into(),
|
||||
checked: false,
|
||||
font: None,
|
||||
danger: true,
|
||||
trailing: None,
|
||||
on_pick: std::rc::Rc::new(move |this, _w, cx| {
|
||||
this.settings_uninstall_agent_hooks(agent, cx)
|
||||
}),
|
||||
});
|
||||
let toggle = menu_id.clone();
|
||||
div()
|
||||
.relative()
|
||||
.child(
|
||||
div()
|
||||
.id(ElementId::Name(SharedString::from(format!(
|
||||
"{menu_id}-trigger"
|
||||
))))
|
||||
.size(px(26.))
|
||||
.rounded(px(6.))
|
||||
.flex()
|
||||
.items_center()
|
||||
.justify_center()
|
||||
.cursor_pointer()
|
||||
.when(open, |d| d.bg(tk.k05))
|
||||
.hover(move |s| s.bg(tk.k05))
|
||||
.child(
|
||||
Icon::empty()
|
||||
.path("icons/settings/more.svg")
|
||||
.size(px(12.))
|
||||
.text_color(tk.k5),
|
||||
)
|
||||
.on_click(cx.listener(move |this, _, window, cx| {
|
||||
this.toggle_settings_menu(toggle.clone(), 0, false, window, cx)
|
||||
})),
|
||||
)
|
||||
.when(open, |d| {
|
||||
// Built only while open: the entries hold callbacks, and
|
||||
// the panel is where they are wired to the rows.
|
||||
d.child(kit::popover_below(
|
||||
true,
|
||||
4.,
|
||||
self.settings_menu_panel(&menu_id, entries, cx)
|
||||
.min_w(px(170.)),
|
||||
))
|
||||
})
|
||||
});
|
||||
|
||||
v_flex()
|
||||
.id(SharedString::from(format!("agent-row-{i}")))
|
||||
.anchor_scroll(self.first_hit_anchor(agent.display_name(), cx))
|
||||
.child(
|
||||
h_flex()
|
||||
.min_h(px(52.))
|
||||
.py(px(8.))
|
||||
.gap(px(12.))
|
||||
.items_center()
|
||||
.child(
|
||||
// The tab bar's agent disc: the brand field, the mark
|
||||
// on it, and a hairline where the field is the page.
|
||||
div()
|
||||
.size(px(20.))
|
||||
.flex_shrink_0()
|
||||
.rounded_full()
|
||||
.bg(rgb(mark.accent_rgb()))
|
||||
.when(presets::needs_edge(mark.accent_rgb(), tk.page), |d| {
|
||||
d.shadow(vec![kit::ring(tk.k15, 0.5, false)])
|
||||
})
|
||||
.flex()
|
||||
.items_center()
|
||||
.justify_center()
|
||||
.child(
|
||||
gpui::svg()
|
||||
.path(mark.icon_path())
|
||||
.size(px(11.))
|
||||
.text_color(rgb(mark.icon_rgb())),
|
||||
),
|
||||
)
|
||||
.child(
|
||||
v_flex()
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.gap(px(2.))
|
||||
.child(agent.display_name())
|
||||
.child(
|
||||
div()
|
||||
.font_family(Tk::mono(cx))
|
||||
.text_size(fs(11.5))
|
||||
.text_color(tk.k45)
|
||||
.truncate()
|
||||
.child(row.target.clone()),
|
||||
),
|
||||
)
|
||||
.child(
|
||||
h_flex()
|
||||
.flex_shrink_0()
|
||||
.gap(px(10.))
|
||||
.items_center()
|
||||
.when_some(status, |r, text| {
|
||||
r.child(
|
||||
h_flex()
|
||||
.gap(px(6.))
|
||||
.items_center()
|
||||
.text_size(fs(12.))
|
||||
.text_color(tk.k5)
|
||||
.whitespace_nowrap()
|
||||
.child(div().size(px(6.)).rounded_full().bg(dot))
|
||||
.child(text),
|
||||
)
|
||||
})
|
||||
.when_some(action, |r, label| {
|
||||
r.child(
|
||||
kit::button(
|
||||
("agent-hooks-install", i),
|
||||
label,
|
||||
BtnKind::Secondary,
|
||||
)
|
||||
.on_click(cx.listener(
|
||||
move |this, _, _w, cx| {
|
||||
this.settings_install_agent_hooks(agent, cx)
|
||||
},
|
||||
)),
|
||||
)
|
||||
})
|
||||
.children(menu),
|
||||
),
|
||||
)
|
||||
.when_some(note, |col, text| {
|
||||
col.child(
|
||||
div()
|
||||
.pl(px(32.))
|
||||
.pb(px(8.))
|
||||
.mt(px(-4.))
|
||||
.text_size(fs(12.))
|
||||
.line_height(px(17.))
|
||||
.text_color(tk.k45)
|
||||
.child(text),
|
||||
)
|
||||
})
|
||||
.into_any_element()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,872 @@
|
||||
//! The SSH page: one column of hosts — the few used most recently, or every
|
||||
//! one grouped by where it came from, or whatever a search finds — each of
|
||||
//! which opens in place to show its details or to be edited.
|
||||
|
||||
use super::kit::{self, BtnKind, Tk, fs};
|
||||
use super::*;
|
||||
|
||||
/// How many hosts the page shows before "Show all".
|
||||
const RECENT_HOSTS: usize = 5;
|
||||
|
||||
/// A list line: a group's heading, or a host.
|
||||
enum HostLine {
|
||||
Head {
|
||||
key: String,
|
||||
count: usize,
|
||||
collapsed: bool,
|
||||
},
|
||||
Host(SshProfile),
|
||||
}
|
||||
|
||||
impl Tty7App {
|
||||
pub(crate) fn render_settings_ssh(&self, cx: &mut Context<Self>) -> AnyElement {
|
||||
Self::settings_page([
|
||||
self.render_hosts_group(cx),
|
||||
self.render_ssh_connection_rows(cx),
|
||||
])
|
||||
}
|
||||
|
||||
/// The settings that are rows: they are what search finds on this page.
|
||||
pub(crate) fn render_ssh_connection_rows(&self, cx: &mut Context<Self>) -> AnyElement {
|
||||
let cfg = cx.global::<Config>();
|
||||
let (verify, warn) = (cfg.verify_host_keys, cfg.ssh_warn_on_close);
|
||||
let verify = self.settings_switch("ssh-verify-host-keys", verify, cx, |this, on, _, cx| {
|
||||
this.set_verify_host_keys(on, cx)
|
||||
});
|
||||
let warn = self.settings_switch("ssh-warn-on-close", warn, cx, |this, on, _, cx| {
|
||||
this.set_ssh_warn_on_close(on, cx)
|
||||
});
|
||||
self.settings_group(
|
||||
Some(t(L10nKey::SettingsSecurity)),
|
||||
Some(t(L10nKey::SettingsSecurityIntro).to_string()),
|
||||
[
|
||||
self.settings_row(
|
||||
t(L10nKey::SettingsVerifyHostKeys),
|
||||
t(L10nKey::SettingsVerifyHostKeysDesc),
|
||||
verify,
|
||||
cx,
|
||||
),
|
||||
self.settings_row(
|
||||
t(L10nKey::WarnBeforeClosing),
|
||||
t(L10nKey::SettingsWarnBeforeClosingDesc),
|
||||
warn,
|
||||
cx,
|
||||
),
|
||||
]
|
||||
.map(IntoElement::into_any_element),
|
||||
cx,
|
||||
)
|
||||
}
|
||||
|
||||
fn render_hosts_group(&self, cx: &mut Context<Self>) -> AnyElement {
|
||||
let tk = Tk::of(cx);
|
||||
let Some(s) = self.active_settings() else {
|
||||
return div().into_any_element();
|
||||
};
|
||||
let filter = s.ssh_filter.clone();
|
||||
let query = filter.read(cx).value().trim().to_lowercase();
|
||||
let show_all = s.ssh_show_all;
|
||||
let collapsed = s.ssh_collapsed_groups.clone();
|
||||
let editing = s.ssh_form.as_ref().map(|f| f.editing);
|
||||
let cfg = cx.global::<Config>();
|
||||
let profiles = cfg.ssh_profiles.clone();
|
||||
let adding = editing.filter(|id| !profiles.iter().any(|p| p.id == *id));
|
||||
let by_name = |a: &SshProfile, b: &SshProfile| {
|
||||
host_title(a)
|
||||
.to_lowercase()
|
||||
.cmp(&host_title(b).to_lowercase())
|
||||
};
|
||||
|
||||
// The recent few: the ones actually connected to, most-used first,
|
||||
// topped up alphabetically on a fresh install.
|
||||
let recent: Vec<SshProfile> = crate::ui::ssh_connect::ssh_profiles_by_frecency(cx)
|
||||
.into_iter()
|
||||
.take(RECENT_HOSTS)
|
||||
.collect();
|
||||
let mut lines: Vec<HostLine> = Vec::new();
|
||||
if !query.is_empty() {
|
||||
let mut hits: Vec<SshProfile> = profiles
|
||||
.iter()
|
||||
.filter(|p| ssh_row_matches(p, &query))
|
||||
.cloned()
|
||||
.collect();
|
||||
hits.sort_by(by_name);
|
||||
lines.extend(hits.into_iter().map(HostLine::Host));
|
||||
} else if show_all {
|
||||
let mut groups: Vec<(String, Vec<SshProfile>)> = Vec::new();
|
||||
for p in &profiles {
|
||||
let key = ssh_group_key(p).to_string();
|
||||
match groups.iter_mut().find(|(k, _)| *k == key) {
|
||||
Some((_, bucket)) => bucket.push(p.clone()),
|
||||
None => groups.push((key, vec![p.clone()])),
|
||||
}
|
||||
}
|
||||
groups.sort_by(|a, b| {
|
||||
ssh_group_rank(&a.0)
|
||||
.cmp(&ssh_group_rank(&b.0))
|
||||
.then_with(|| a.0.cmp(&b.0))
|
||||
});
|
||||
for (key, mut bucket) in groups {
|
||||
bucket.sort_by(by_name);
|
||||
let is_collapsed = collapsed.contains(&key);
|
||||
lines.push(HostLine::Head {
|
||||
key,
|
||||
count: bucket.len(),
|
||||
collapsed: is_collapsed,
|
||||
});
|
||||
if !is_collapsed {
|
||||
lines.extend(bucket.into_iter().map(HostLine::Host));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
lines.extend(recent.iter().cloned().map(HostLine::Host));
|
||||
}
|
||||
let visible: Vec<Uuid> = lines
|
||||
.iter()
|
||||
.filter_map(|l| match l {
|
||||
HostLine::Host(p) => Some(p.id),
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
|
||||
let total = profiles.len();
|
||||
let files = profiles
|
||||
.iter()
|
||||
.map(|p| ssh_group_key(p).to_string())
|
||||
.collect::<std::collections::HashSet<_>>()
|
||||
.len();
|
||||
let rest = total.saturating_sub(recent.len());
|
||||
|
||||
let toolbar = h_flex()
|
||||
.gap(px(12.))
|
||||
.items_center()
|
||||
.pb(px(8.))
|
||||
.child(
|
||||
kit::search_field(&filter, &tk)
|
||||
.w(px(240.))
|
||||
.capture_key_down(cx.listener(move |this, ev: &KeyDownEvent, window, cx| {
|
||||
let key = ev.keystroke.key.as_str();
|
||||
match key {
|
||||
"down" | "up" if !visible.is_empty() => {
|
||||
let current = this.active_settings().and_then(|s| s.ssh_open);
|
||||
let at =
|
||||
current.and_then(|id| visible.iter().position(|v| *v == id));
|
||||
let next = match (at, key) {
|
||||
(None, _) => 0,
|
||||
(Some(i), "down") => (i + 1).min(visible.len() - 1),
|
||||
(Some(i), _) => i.saturating_sub(1),
|
||||
};
|
||||
if this.active_settings().is_some_and(|s| s.ssh_form.is_none()) {
|
||||
if let Some(s) = this.active_settings_mut() {
|
||||
s.ssh_open = Some(visible[next]);
|
||||
}
|
||||
}
|
||||
cx.stop_propagation();
|
||||
cx.notify();
|
||||
}
|
||||
"escape" => {
|
||||
let filter = this.active_settings().map(|s| s.ssh_filter.clone());
|
||||
if let Some(filter) = filter
|
||||
&& !filter.read(cx).value().is_empty()
|
||||
{
|
||||
filter.update(cx, |f, cx| f.set_value("", window, cx));
|
||||
cx.stop_propagation();
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
})),
|
||||
)
|
||||
.child(div().flex_1())
|
||||
.child(
|
||||
kit::button(
|
||||
"ssh-import-config",
|
||||
t(L10nKey::SettingsImportFromSshConfig),
|
||||
BtnKind::Link,
|
||||
)
|
||||
.text_size(fs(12.5))
|
||||
.on_click(
|
||||
cx.listener(|this, _, window, cx| this.import_ssh_config_profiles(window, cx)),
|
||||
),
|
||||
)
|
||||
.child(
|
||||
kit::button(
|
||||
"ssh-add-host",
|
||||
t(L10nKey::SettingsAddHost),
|
||||
BtnKind::Secondary,
|
||||
)
|
||||
.icon("icons/settings/plus.svg")
|
||||
.dimmed(adding.is_some())
|
||||
.on_click(cx.listener(|this, _, window, cx| {
|
||||
if this
|
||||
.active_settings()
|
||||
.and_then(|s| s.ssh_form.as_ref())
|
||||
.is_some_and(|f| {
|
||||
!cx.global::<Config>()
|
||||
.ssh_profiles
|
||||
.iter()
|
||||
.any(|p| p.id == f.editing)
|
||||
})
|
||||
{
|
||||
return;
|
||||
}
|
||||
let filter = this.active_settings().map(|s| s.ssh_filter.clone());
|
||||
if let Some(filter) = filter {
|
||||
filter.update(cx, |f, cx| f.set_value("", window, cx));
|
||||
}
|
||||
this.add_new_profile(window, cx);
|
||||
})),
|
||||
);
|
||||
|
||||
let mut list = v_flex()
|
||||
.id("ssh-host-list")
|
||||
.mx(px(-10.))
|
||||
.px(px(10.))
|
||||
.when(!query.is_empty() || show_all, |l| {
|
||||
l.max_h(px(360.)).overflow_y_scroll()
|
||||
});
|
||||
if let Some(id) = adding {
|
||||
list = list.child(self.render_host_row(None, id, cx));
|
||||
}
|
||||
for line in lines {
|
||||
list = match line {
|
||||
HostLine::Head {
|
||||
key,
|
||||
count,
|
||||
collapsed,
|
||||
} => list.child(self.render_host_group_head(&key, count, collapsed, cx)),
|
||||
HostLine::Host(p) => list.child(self.render_host_row(Some(&p), p.id, cx)),
|
||||
};
|
||||
}
|
||||
|
||||
let empty = visible_is_empty(&profiles, &query) && adding.is_none();
|
||||
let footer = if !query.is_empty() {
|
||||
empty.then(|| {
|
||||
div()
|
||||
.h(px(40.))
|
||||
.flex()
|
||||
.items_center()
|
||||
.text_color(tk.k35)
|
||||
.child(t_fmt(L10nKey::SettingsNoHostsMatch, &[("query", &query)]))
|
||||
.into_any_element()
|
||||
})
|
||||
} else if total == 0 && adding.is_none() {
|
||||
Some(
|
||||
div()
|
||||
.h(px(40.))
|
||||
.flex()
|
||||
.items_center()
|
||||
.text_color(tk.k35)
|
||||
.child(t(L10nKey::SettingsNoHostsYet))
|
||||
.into_any_element(),
|
||||
)
|
||||
} else if rest > 0 || show_all {
|
||||
Some(
|
||||
h_flex()
|
||||
.h(px(36.))
|
||||
.mt(px(6.))
|
||||
.gap(px(8.))
|
||||
.items_center()
|
||||
.text_size(fs(12.))
|
||||
.text_color(tk.k45)
|
||||
.child(if show_all {
|
||||
t_fmt(
|
||||
L10nKey::SettingsHostsFromFiles,
|
||||
&[("count", &total.to_string()), ("files", &files.to_string())],
|
||||
)
|
||||
} else {
|
||||
t_plural(L10nKey::SettingsMoreHosts, rest, &[])
|
||||
})
|
||||
.child(
|
||||
kit::button(
|
||||
"ssh-show-all",
|
||||
if show_all {
|
||||
t(L10nKey::SettingsShowRecentOnly)
|
||||
} else {
|
||||
t(L10nKey::SettingsShowAll)
|
||||
},
|
||||
BtnKind::Link,
|
||||
)
|
||||
.on_click(cx.listener(|this, _, _w, cx| {
|
||||
if let Some(s) = this.active_settings_mut() {
|
||||
s.ssh_show_all = !s.ssh_show_all;
|
||||
}
|
||||
cx.notify();
|
||||
})),
|
||||
)
|
||||
.into_any_element(),
|
||||
)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
self.settings_group(
|
||||
Some(t(L10nKey::SettingsHosts)),
|
||||
Some(t(L10nKey::SettingsHostsDesc).to_string()),
|
||||
[v_flex()
|
||||
.pt(px(2.))
|
||||
.child(toolbar)
|
||||
.child(list)
|
||||
.children(footer)
|
||||
.into_any_element()],
|
||||
cx,
|
||||
)
|
||||
}
|
||||
|
||||
fn render_host_group_head(
|
||||
&self,
|
||||
key: &str,
|
||||
count: usize,
|
||||
collapsed: bool,
|
||||
cx: &mut Context<Self>,
|
||||
) -> AnyElement {
|
||||
let tk = Tk::of(cx);
|
||||
let owned = key.to_string();
|
||||
h_flex()
|
||||
.id(SharedString::from(format!("ssh-group-{key}")))
|
||||
.h(px(34.))
|
||||
.flex_shrink_0()
|
||||
.items_end()
|
||||
.pb(px(7.))
|
||||
.gap(px(6.))
|
||||
.cursor_pointer()
|
||||
.text_size(fs(11.5))
|
||||
.font_weight(FontWeight::SEMIBOLD)
|
||||
.text_color(tk.heading)
|
||||
.hover(move |s| s.text_color(tk.fg))
|
||||
.child(
|
||||
div().mb(px(1.)).child(
|
||||
Icon::empty()
|
||||
.path(if collapsed {
|
||||
"icons/settings/chevron-right.svg"
|
||||
} else {
|
||||
"icons/settings/chevron-down.svg"
|
||||
})
|
||||
.size(px(9.)),
|
||||
),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.flex_1()
|
||||
.truncate()
|
||||
.child(ssh_group_label(key).to_string()),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.font_weight(FontWeight::NORMAL)
|
||||
.text_color(tk.k35)
|
||||
.child(count.to_string()),
|
||||
)
|
||||
.on_click(cx.listener(move |this, _, _w, cx| this.toggle_ssh_group(owned.clone(), cx)))
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
/// One host: the row, and under it either the host's details or, while it
|
||||
/// is being edited, the editor. `p` is `None` for a host not saved yet.
|
||||
fn render_host_row(
|
||||
&self,
|
||||
p: Option<&SshProfile>,
|
||||
id: Uuid,
|
||||
cx: &mut Context<Self>,
|
||||
) -> AnyElement {
|
||||
let tk = Tk::of(cx);
|
||||
let Some(s) = self.active_settings() else {
|
||||
return div().into_any_element();
|
||||
};
|
||||
let editing = s.ssh_form.as_ref().is_some_and(|f| f.editing == id);
|
||||
let open = editing || s.ssh_open == Some(id);
|
||||
let live = self.live_ssh_profiles(cx).contains(&id);
|
||||
let dirty = editing && self.ssh_form_dirty(cx);
|
||||
|
||||
// While editing, the row shows what the form would save.
|
||||
let (title, address) = match (editing, p) {
|
||||
(true, _) => {
|
||||
let form = s.ssh_form.as_ref().unwrap();
|
||||
let name = form.name.read(cx).value().trim().to_string();
|
||||
let host = form.host.read(cx).value().trim().to_string();
|
||||
let user = form.user.read(cx).value().trim().to_string();
|
||||
let port = form.port.read(cx).value().trim().to_string();
|
||||
let jump = form.jump.read(cx).value().trim().to_string();
|
||||
let mut addr = String::new();
|
||||
if !user.is_empty() {
|
||||
addr.push_str(&user);
|
||||
addr.push('@');
|
||||
}
|
||||
addr.push_str(if host.is_empty() { "…" } else { &host });
|
||||
if !port.is_empty() && port != "22" {
|
||||
addr.push(':');
|
||||
addr.push_str(&port);
|
||||
}
|
||||
if !jump.is_empty() {
|
||||
addr.push_str(&format!(" via {jump}"));
|
||||
}
|
||||
let host_empty = host.is_empty();
|
||||
let title = match (name.is_empty(), host_empty) {
|
||||
(false, _) => name,
|
||||
(true, false) => host,
|
||||
(true, true) => t(L10nKey::SettingsNewHost).to_string(),
|
||||
};
|
||||
(
|
||||
title,
|
||||
if host_empty {
|
||||
"user@hostname".to_string()
|
||||
} else {
|
||||
addr
|
||||
},
|
||||
)
|
||||
}
|
||||
(false, Some(p)) => (host_title(p), host_address(p, cx)),
|
||||
(false, None) => (t(L10nKey::SettingsNewHost).to_string(), String::new()),
|
||||
};
|
||||
let blank_title = editing && p.is_none() && title == t(L10nKey::SettingsNewHost);
|
||||
let (meta, meta_color) = if dirty {
|
||||
(t(L10nKey::SettingsUnsaved).to_string(), tk.warn_text)
|
||||
} else if live {
|
||||
(t(L10nKey::SettingsLive).to_string(), tk.ok)
|
||||
} else {
|
||||
let used = cx
|
||||
.global::<Config>()
|
||||
.ssh_profile_frecency
|
||||
.get(&id)
|
||||
.map(|u| u.last_used)
|
||||
.filter(|&t| t > 0);
|
||||
let text = match (used, p) {
|
||||
(_, None) => String::new(),
|
||||
(Some(then), _) => {
|
||||
crate::ui::home::relative_time(crate::core::config::unix_now(), then)
|
||||
}
|
||||
(None, _) => t(L10nKey::SettingsNever).to_string(),
|
||||
};
|
||||
(text, tk.k4)
|
||||
};
|
||||
|
||||
let head = div()
|
||||
.id(SharedString::from(format!("ssh-host-{}", id.as_u128())))
|
||||
.h(px(40.))
|
||||
.px(px(10.))
|
||||
.flex()
|
||||
.items_center()
|
||||
.gap(px(12.))
|
||||
.rounded(px(8.))
|
||||
.cursor_pointer()
|
||||
.when(!open, |r| r.hover(move |s| s.bg(tk.k04)))
|
||||
.child(
|
||||
v_flex()
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.gap(px(1.))
|
||||
.child(
|
||||
div()
|
||||
.line_height(px(17.))
|
||||
.truncate()
|
||||
.when(open, |d| d.font_weight(FontWeight::MEDIUM))
|
||||
.text_color(if blank_title { tk.k4 } else { tk.fg })
|
||||
.child(title),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.font_family(Tk::mono(cx))
|
||||
.text_size(fs(11.))
|
||||
.line_height(px(15.))
|
||||
.text_color(tk.k45)
|
||||
.truncate()
|
||||
.child(address),
|
||||
),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.flex_shrink_0()
|
||||
.whitespace_nowrap()
|
||||
.text_size(fs(12.))
|
||||
.text_color(meta_color)
|
||||
.child(meta),
|
||||
)
|
||||
.child(
|
||||
div().size(px(10.)).flex_shrink_0().child(
|
||||
Icon::empty()
|
||||
.path(if open {
|
||||
"icons/settings/chevron-down.svg"
|
||||
} else {
|
||||
"icons/settings/chevron-right.svg"
|
||||
})
|
||||
.size(px(10.))
|
||||
.text_color(tk.k35),
|
||||
),
|
||||
)
|
||||
.on_click(cx.listener(move |this, _, _w, cx| {
|
||||
if this
|
||||
.active_settings()
|
||||
.and_then(|s| s.ssh_form.as_ref())
|
||||
.is_some_and(|f| f.editing == id)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if let Some(s) = this.active_settings_mut() {
|
||||
s.ssh_open = if s.ssh_open == Some(id) {
|
||||
None
|
||||
} else {
|
||||
Some(id)
|
||||
};
|
||||
}
|
||||
cx.notify();
|
||||
}));
|
||||
|
||||
let body = if editing {
|
||||
Some(self.render_host_editor(p.is_some(), cx))
|
||||
} else if open {
|
||||
p.map(|p| self.render_host_details(p, cx))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
v_flex()
|
||||
.flex_shrink_0()
|
||||
.mx(px(-10.))
|
||||
.rounded(px(8.))
|
||||
.when(open, |d| d.bg(tk.k04))
|
||||
.child(head)
|
||||
.children(body)
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
fn render_host_details(&self, p: &SshProfile, cx: &mut Context<Self>) -> AnyElement {
|
||||
let tk = Tk::of(cx);
|
||||
let id = p.id;
|
||||
let cfg = cx.global::<Config>();
|
||||
let jump = p.jump_host.and_then(|j| {
|
||||
cfg.ssh_profiles
|
||||
.iter()
|
||||
.find(|q| q.id == j)
|
||||
.map(|q| host_title(q))
|
||||
});
|
||||
let fields: Vec<(&str, String)> = [
|
||||
("HostName", Some(p.host.clone())),
|
||||
(
|
||||
"User",
|
||||
Some(if p.user.is_empty() {
|
||||
"$USER".to_string()
|
||||
} else {
|
||||
p.user.clone()
|
||||
}),
|
||||
),
|
||||
("Port", Some(p.port.to_string())),
|
||||
("IdentityFile", p.identity_files.first().cloned()),
|
||||
("ProxyJump", jump),
|
||||
(
|
||||
t(L10nKey::SettingsDefinedIn),
|
||||
Some(ssh_group_label(ssh_group_key(p)).to_string()),
|
||||
),
|
||||
]
|
||||
.into_iter()
|
||||
.filter_map(|(k, v)| v.filter(|v| !v.is_empty()).map(|v| (k, v)))
|
||||
.collect();
|
||||
let copied = self.active_settings().and_then(|s| s.ssh_copied) == Some(id);
|
||||
let command = ssh_command(p);
|
||||
let mono = Tk::mono(cx);
|
||||
v_flex()
|
||||
.gap(px(14.))
|
||||
.px(px(10.))
|
||||
.pt(px(4.))
|
||||
.pb(px(14.))
|
||||
.child(
|
||||
v_flex()
|
||||
.gap(px(6.))
|
||||
.text_size(fs(12.))
|
||||
.children(fields.into_iter().map(|(k, v)| {
|
||||
h_flex()
|
||||
.line_height(px(17.))
|
||||
.child(
|
||||
div()
|
||||
.w(px(96.))
|
||||
.flex_shrink_0()
|
||||
.text_color(tk.k45)
|
||||
.child(k.to_string()),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.truncate()
|
||||
.font_family(mono.clone())
|
||||
.text_size(fs(11.5))
|
||||
.text_color(tk.fg)
|
||||
.child(v),
|
||||
)
|
||||
})),
|
||||
)
|
||||
.child(
|
||||
h_flex()
|
||||
.gap(px(8.))
|
||||
.items_center()
|
||||
.child(
|
||||
kit::button(
|
||||
"ssh-host-connect",
|
||||
t(L10nKey::SettingsConnectInNewTab),
|
||||
BtnKind::Primary,
|
||||
)
|
||||
.on_click(cx.listener(
|
||||
move |this, _, window, cx| {
|
||||
this.close_settings_then(window, cx, move |this, window, cx| {
|
||||
this.connect_ssh_profile(id, window, cx)
|
||||
});
|
||||
},
|
||||
)),
|
||||
)
|
||||
.child(
|
||||
kit::button(
|
||||
"ssh-host-edit",
|
||||
t(L10nKey::SettingsEditHost),
|
||||
BtnKind::Secondary,
|
||||
)
|
||||
.on_click(cx.listener(
|
||||
move |this, _, window, cx| {
|
||||
if let Some(profile) = cx
|
||||
.global::<Config>()
|
||||
.ssh_profiles
|
||||
.iter()
|
||||
.find(|p| p.id == id)
|
||||
.cloned()
|
||||
{
|
||||
this.ssh_form_load(&profile, window, cx);
|
||||
}
|
||||
},
|
||||
)),
|
||||
)
|
||||
.child(div().flex_1())
|
||||
.child(
|
||||
kit::button(
|
||||
"ssh-host-copy",
|
||||
if copied {
|
||||
t(L10nKey::SettingsCopied)
|
||||
} else {
|
||||
t(L10nKey::SettingsCopySshCommand)
|
||||
},
|
||||
BtnKind::Link,
|
||||
)
|
||||
.on_click(cx.listener(move |this, _, _w, cx| {
|
||||
cx.write_to_clipboard(gpui::ClipboardItem::new_string(command.clone()));
|
||||
if let Some(s) = this.active_settings_mut() {
|
||||
s.ssh_copied = Some(id);
|
||||
}
|
||||
cx.notify();
|
||||
cx.spawn(async move |this, cx| {
|
||||
smol::Timer::after(std::time::Duration::from_millis(1500)).await;
|
||||
let _ = this.update(cx, |this, cx| {
|
||||
if let Some(s) = this.active_settings_mut()
|
||||
&& s.ssh_copied == Some(id)
|
||||
{
|
||||
s.ssh_copied = None;
|
||||
cx.notify();
|
||||
}
|
||||
});
|
||||
})
|
||||
.detach();
|
||||
})),
|
||||
),
|
||||
)
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
fn render_host_editor(&self, saved: bool, cx: &mut Context<Self>) -> AnyElement {
|
||||
let tk = Tk::of(cx);
|
||||
let Some(form) = self.active_settings().and_then(|s| s.ssh_form.as_ref()) else {
|
||||
return div().into_any_element();
|
||||
};
|
||||
let id = form.editing;
|
||||
let confirm_remove = self.active_settings().is_some_and(|s| s.ssh_confirm_remove);
|
||||
let (_, errors) = self.ssh_form_collect(cx).unzip();
|
||||
let errors = errors.unwrap_or_default();
|
||||
let dirty = self.ssh_form_dirty(cx);
|
||||
// A brand-new host is not told it needs a host before anyone had the
|
||||
// chance to type one; a malformed value says so at once.
|
||||
let core_blank = form.core_is_blank(cx);
|
||||
let host_error = errors.host.as_ref().filter(|_| !core_blank);
|
||||
let error = host_error
|
||||
.or(errors.port.as_ref())
|
||||
.or(errors.jump.as_ref())
|
||||
.or(errors.socks.as_ref())
|
||||
.or(errors.http.as_ref())
|
||||
.map(|e| e.message());
|
||||
let can_save = errors.is_empty() && (dirty || !saved);
|
||||
|
||||
let field = |label: &'static str, input: &Entity<InputState>, bad: bool| {
|
||||
let focused = self.settings_input_focused(input, cx);
|
||||
h_flex()
|
||||
.items_center()
|
||||
.child(
|
||||
div()
|
||||
.w(px(SSH_LABEL_W))
|
||||
.flex_shrink_0()
|
||||
.text_size(fs(12.))
|
||||
.text_color(tk.k45)
|
||||
.child(label),
|
||||
)
|
||||
.child(
|
||||
kit::text_field(input, focused, bad, &tk, cx)
|
||||
.bg(tk.page)
|
||||
.text_size(fs(11.5))
|
||||
.flex_1()
|
||||
.max_w(px(FORM_FIELD_W)),
|
||||
)
|
||||
};
|
||||
let fields = v_flex()
|
||||
.gap(px(6.))
|
||||
.child(field("Alias", &form.name, false))
|
||||
.child(field("HostName", &form.host, host_error.is_some()))
|
||||
.child(field("User", &form.user, false))
|
||||
.child(field("Port", &form.port, errors.port.is_some()))
|
||||
.child(field("IdentityFile", &form.identity_files, false))
|
||||
.child(field("ProxyJump", &form.jump, errors.jump.is_some()));
|
||||
|
||||
v_flex()
|
||||
.gap(px(14.))
|
||||
.px(px(10.))
|
||||
.pt(px(4.))
|
||||
.pb(px(14.))
|
||||
.capture_key_down(cx.listener(move |this, ev: &KeyDownEvent, window, cx| {
|
||||
match ev.keystroke.key.as_str() {
|
||||
"enter" => {
|
||||
this.save_host_form(window, cx);
|
||||
cx.stop_propagation();
|
||||
}
|
||||
"escape" => {
|
||||
this.cancel_ssh_form(cx);
|
||||
cx.stop_propagation();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}))
|
||||
.child(fields)
|
||||
.when_some(error, |v, e| {
|
||||
v.child(div().text_size(fs(12.)).text_color(tk.danger).child(e))
|
||||
})
|
||||
.child(
|
||||
h_flex()
|
||||
.gap(px(8.))
|
||||
.items_center()
|
||||
.child(
|
||||
kit::button(
|
||||
"ssh-form-save",
|
||||
if saved {
|
||||
t(L10nKey::Save)
|
||||
} else {
|
||||
t(L10nKey::SettingsAddHost)
|
||||
},
|
||||
BtnKind::Primary,
|
||||
)
|
||||
.dimmed(!can_save)
|
||||
.on_click(
|
||||
cx.listener(|this, _, window, cx| this.save_host_form(window, cx)),
|
||||
),
|
||||
)
|
||||
.child(
|
||||
kit::button("ssh-form-cancel", t(L10nKey::Cancel), BtnKind::Secondary)
|
||||
.on_click(cx.listener(|this, _, _w, cx| this.cancel_ssh_form(cx))),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.pl(px(4.))
|
||||
.text_size(fs(11.5))
|
||||
.text_color(tk.k4)
|
||||
.child(t(L10nKey::SettingsStoredInTty7)),
|
||||
)
|
||||
.child(div().flex_1())
|
||||
.when(saved, |r| {
|
||||
r.child(
|
||||
kit::button(
|
||||
"ssh-form-remove",
|
||||
if confirm_remove {
|
||||
t(L10nKey::SettingsClickAgainToRemove)
|
||||
} else {
|
||||
t(L10nKey::SettingsRemoveHost)
|
||||
},
|
||||
if confirm_remove {
|
||||
BtnKind::Danger
|
||||
} else {
|
||||
BtnKind::Link
|
||||
},
|
||||
)
|
||||
.on_click(cx.listener(
|
||||
move |this, _, _w, cx| {
|
||||
let confirmed = this
|
||||
.active_settings()
|
||||
.is_some_and(|s| s.ssh_confirm_remove);
|
||||
if confirmed {
|
||||
this.delete_profile_confirmed(id, cx);
|
||||
} else if let Some(s) = this.active_settings_mut() {
|
||||
s.ssh_confirm_remove = true;
|
||||
cx.notify();
|
||||
}
|
||||
},
|
||||
)),
|
||||
)
|
||||
}),
|
||||
)
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
fn save_host_form(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
||||
if let Some(id) = self.save_editing_profile(window, cx) {
|
||||
if let Some(s) = self.active_settings_mut() {
|
||||
s.ssh_form = None;
|
||||
s.ssh_open = Some(id);
|
||||
s.ssh_confirm_remove = false;
|
||||
}
|
||||
cx.notify();
|
||||
} else {
|
||||
cx.notify();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn host_title(p: &SshProfile) -> String {
|
||||
if p.name.is_empty() {
|
||||
to_connect_string(p)
|
||||
} else {
|
||||
p.name.clone()
|
||||
}
|
||||
}
|
||||
|
||||
/// `user@host:port via jump`, the way the row's second line reads.
|
||||
fn host_address(p: &SshProfile, cx: &App) -> String {
|
||||
let mut addr = String::new();
|
||||
if !p.user.is_empty() {
|
||||
addr.push_str(&p.user);
|
||||
addr.push('@');
|
||||
}
|
||||
addr.push_str(&p.host);
|
||||
if p.port != DEFAULT_SSH_PORT {
|
||||
addr.push_str(&format!(":{}", p.port));
|
||||
}
|
||||
if let Some(jump) = p.jump_host.and_then(|j| {
|
||||
cx.global::<Config>()
|
||||
.ssh_profiles
|
||||
.iter()
|
||||
.find(|q| q.id == j)
|
||||
.map(host_title)
|
||||
}) {
|
||||
addr.push_str(&format!(" via {jump}"));
|
||||
}
|
||||
addr
|
||||
}
|
||||
|
||||
/// The command a terminal elsewhere would reach this host with.
|
||||
fn ssh_command(p: &SshProfile) -> String {
|
||||
let mut cmd = String::from("ssh");
|
||||
if p.port != DEFAULT_SSH_PORT {
|
||||
cmd.push_str(&format!(" -p {}", p.port));
|
||||
}
|
||||
if let Some(key) = p.identity_files.first() {
|
||||
cmd.push_str(&format!(" -i {key}"));
|
||||
}
|
||||
cmd.push(' ');
|
||||
if !p.user.is_empty() {
|
||||
cmd.push_str(&p.user);
|
||||
cmd.push('@');
|
||||
}
|
||||
cmd.push_str(&p.host);
|
||||
cmd
|
||||
}
|
||||
|
||||
fn visible_is_empty(profiles: &[SshProfile], query: &str) -> bool {
|
||||
!profiles.iter().any(|p| ssh_row_matches(p, query))
|
||||
}
|
||||
@@ -0,0 +1,804 @@
|
||||
//! The settings page's own controls.
|
||||
//!
|
||||
//! Settings is drawn to one design, and that design is quieter than the rest
|
||||
//! of the app: ink at a handful of fixed strengths instead of the theme's named
|
||||
//! roles, hairline rings instead of borders, and controls that sit on the page
|
||||
//! rather than on cards. Everything here derives from the active theme's
|
||||
//! foreground and background, so the page follows every theme — light, dark,
|
||||
//! and the tinted ones in between — without a palette of its own.
|
||||
//!
|
||||
//! Sizes are in rems off a 16px base, written as the pixel sizes the design
|
||||
//! calls for, so the page still grows with the interface font.
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
use gpui::{
|
||||
AnyElement, App, BoxShadow, ClickEvent, Div, ElementId, FontWeight, Hsla, IntoElement,
|
||||
MouseButton, Rems, SharedString, Stateful, Window, div, point, prelude::*, px, rems,
|
||||
};
|
||||
use gpui_component::input::{Input, InputState};
|
||||
use gpui_component::{ActiveTheme as _, Icon, h_flex, v_flex};
|
||||
|
||||
/// A size from the design, in pixels at the default 16px interface font.
|
||||
pub(crate) fn fs(px_at_16: f32) -> Rems {
|
||||
rems(px_at_16 / 16.)
|
||||
}
|
||||
|
||||
/// The page's ink at the strengths the design uses, plus the few surfaces it
|
||||
/// lifts off the page.
|
||||
#[derive(Clone, Copy)]
|
||||
pub(crate) struct Tk {
|
||||
pub dark: bool,
|
||||
pub fg: Hsla,
|
||||
pub page: Hsla,
|
||||
pub k04: Hsla,
|
||||
pub k05: Hsla,
|
||||
pub k06: Hsla,
|
||||
pub k07: Hsla,
|
||||
pub k08: Hsla,
|
||||
pub k15: Hsla,
|
||||
pub k3: Hsla,
|
||||
pub k35: Hsla,
|
||||
pub k4: Hsla,
|
||||
pub k45: Hsla,
|
||||
pub k5: Hsla,
|
||||
pub k6: Hsla,
|
||||
/// A group heading: quieter than a label, but still read at a glance.
|
||||
pub heading: Hsla,
|
||||
/// A nav item at rest.
|
||||
pub nav: Hsla,
|
||||
/// A raised button's fill.
|
||||
pub btn: Hsla,
|
||||
/// A popover's fill.
|
||||
pub menu: Hsla,
|
||||
/// A switch or slider knob at rest.
|
||||
pub knob: Hsla,
|
||||
/// The chosen cell of a segmented control.
|
||||
pub chip: Hsla,
|
||||
pub warn: Hsla,
|
||||
pub warn_text: Hsla,
|
||||
pub danger: Hsla,
|
||||
pub ok: Hsla,
|
||||
}
|
||||
|
||||
fn lift(c: Hsla, by: f32) -> Hsla {
|
||||
Hsla {
|
||||
l: (c.l + by).clamp(0., 1.),
|
||||
..c
|
||||
}
|
||||
}
|
||||
|
||||
impl Tk {
|
||||
pub(crate) fn of(cx: &App) -> Self {
|
||||
let theme = cx.theme();
|
||||
let dark = theme.is_dark();
|
||||
let fg = theme.foreground;
|
||||
let page = theme.background;
|
||||
let a = |light: f32, dark_a: f32| fg.opacity(if dark { dark_a } else { light });
|
||||
let white = gpui::white();
|
||||
Self {
|
||||
dark,
|
||||
fg,
|
||||
page,
|
||||
k04: a(0.04, 0.055),
|
||||
k05: a(0.05, 0.07),
|
||||
k06: a(0.06, 0.08),
|
||||
k07: a(0.07, 0.09),
|
||||
k08: a(0.08, 0.08),
|
||||
k15: a(0.15, 0.16),
|
||||
k3: a(0.3, 0.3),
|
||||
k35: a(0.35, 0.36),
|
||||
k4: a(0.4, 0.45),
|
||||
k45: a(0.45, 0.5),
|
||||
k5: a(0.5, 0.55),
|
||||
k6: a(0.6, 0.65),
|
||||
heading: a(0.9, 0.9),
|
||||
nav: a(0.82, 0.8),
|
||||
btn: if dark { fg.opacity(0.1) } else { white },
|
||||
menu: if dark { lift(page, 0.06) } else { white },
|
||||
knob: if dark { fg } else { white },
|
||||
chip: if dark { fg.opacity(0.16) } else { white },
|
||||
warn: gpui::rgb(0xe0a100).into(),
|
||||
warn_text: gpui::rgb(0xb07d00).into(),
|
||||
danger: gpui::rgb(0xd93025).into(),
|
||||
ok: gpui::rgb(0x34a853).into(),
|
||||
}
|
||||
}
|
||||
|
||||
/// The hairline ring and the faint drop a raised control sits on.
|
||||
pub(crate) fn raised(&self) -> Vec<BoxShadow> {
|
||||
if self.dark {
|
||||
vec![ring(self.fg.opacity(0.1), 0.5, false)]
|
||||
} else {
|
||||
vec![
|
||||
ring(gpui::black().opacity(0.08), 0.5, false),
|
||||
drop(gpui::black().opacity(0.06), 1., 2., 0.),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
/// The same, a step firmer, for a hovered raised control.
|
||||
pub(crate) fn raised_hover(&self) -> Vec<BoxShadow> {
|
||||
if self.dark {
|
||||
vec![ring(self.fg.opacity(0.2), 0.5, false)]
|
||||
} else {
|
||||
vec![
|
||||
ring(gpui::black().opacity(0.16), 0.5, false),
|
||||
drop(gpui::black().opacity(0.08), 1., 2., 0.),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn popover(&self) -> Vec<BoxShadow> {
|
||||
if self.dark {
|
||||
vec![
|
||||
ring(self.fg.opacity(0.12), 0.5, false),
|
||||
drop(gpui::black().opacity(0.6), 16., 40., -8.),
|
||||
]
|
||||
} else {
|
||||
vec![
|
||||
ring(gpui::black().opacity(0.12), 0.5, false),
|
||||
drop(gpui::black().opacity(0.22), 16., 40., -8.),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn mono(cx: &App) -> SharedString {
|
||||
cx.theme().mono_font_family.clone()
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn ring(color: Hsla, width: f32, inset: bool) -> BoxShadow {
|
||||
BoxShadow {
|
||||
color,
|
||||
offset: point(px(0.), px(0.)),
|
||||
blur_radius: px(0.),
|
||||
spread_radius: px(width),
|
||||
inset,
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn drop(color: Hsla, y: f32, blur: f32, spread: f32) -> BoxShadow {
|
||||
BoxShadow {
|
||||
color,
|
||||
offset: point(px(0.), px(y)),
|
||||
blur_radius: px(blur),
|
||||
spread_radius: px(spread),
|
||||
inset: false,
|
||||
}
|
||||
}
|
||||
|
||||
type ClickHandler = Rc<dyn Fn(&ClickEvent, &mut Window, &mut App)>;
|
||||
type ToggleHandler = Rc<dyn Fn(&bool, &mut Window, &mut App)>;
|
||||
|
||||
/// An on/off switch: ink when on, a hairline track when off.
|
||||
#[derive(IntoElement)]
|
||||
pub(crate) struct Switch {
|
||||
id: ElementId,
|
||||
on: bool,
|
||||
disabled: bool,
|
||||
small: bool,
|
||||
handler: Option<ToggleHandler>,
|
||||
}
|
||||
|
||||
pub(crate) fn switch(id: impl Into<ElementId>) -> Switch {
|
||||
Switch {
|
||||
id: id.into(),
|
||||
on: false,
|
||||
disabled: false,
|
||||
small: false,
|
||||
handler: None,
|
||||
}
|
||||
}
|
||||
|
||||
impl Switch {
|
||||
pub(crate) fn checked(mut self, on: bool) -> Self {
|
||||
self.on = on;
|
||||
self
|
||||
}
|
||||
pub(crate) fn disabled(mut self, disabled: bool) -> Self {
|
||||
self.disabled = disabled;
|
||||
self
|
||||
}
|
||||
pub(crate) fn small(mut self) -> Self {
|
||||
self.small = true;
|
||||
self
|
||||
}
|
||||
pub(crate) fn on_click(mut self, f: impl Fn(&bool, &mut Window, &mut App) + 'static) -> Self {
|
||||
self.handler = Some(Rc::new(f));
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl RenderOnce for Switch {
|
||||
fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement {
|
||||
let tk = Tk::of(cx);
|
||||
let (w, h, knob) = if self.small {
|
||||
(26., 16., 12.)
|
||||
} else {
|
||||
(30., 18., 14.)
|
||||
};
|
||||
let on = self.on;
|
||||
let left = if on { w - knob - 2. } else { 2. };
|
||||
div()
|
||||
.id(self.id)
|
||||
.flex_shrink_0()
|
||||
.relative()
|
||||
.w(px(w))
|
||||
.h(px(h))
|
||||
.rounded(px(h / 2.))
|
||||
.bg(if on { tk.fg } else { tk.k15 })
|
||||
.when(self.disabled, |d| d.opacity(0.4))
|
||||
.child(
|
||||
div()
|
||||
.absolute()
|
||||
.top(px(2.))
|
||||
.left(px(left))
|
||||
.size(px(knob))
|
||||
.rounded_full()
|
||||
.bg(if on { tk.page } else { tk.knob })
|
||||
.shadow(vec![drop(gpui::black().opacity(0.2), 1., 2., 0.)]),
|
||||
)
|
||||
.when_some(self.handler.filter(|_| !self.disabled), |d, handler| {
|
||||
d.cursor_pointer()
|
||||
.on_click(move |_, window, cx| handler(&!on, window, cx))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq)]
|
||||
pub(crate) enum BtnKind {
|
||||
/// A raised button on the page.
|
||||
Secondary,
|
||||
/// Solid ink: the one action a block exists for.
|
||||
Primary,
|
||||
/// Text that darkens on hover, for actions beside other actions.
|
||||
Link,
|
||||
/// A link in red, for the destructive one.
|
||||
Danger,
|
||||
}
|
||||
|
||||
#[derive(IntoElement)]
|
||||
pub(crate) struct Btn {
|
||||
id: ElementId,
|
||||
label: SharedString,
|
||||
kind: BtnKind,
|
||||
disabled: bool,
|
||||
dimmed: bool,
|
||||
icon: Option<SharedString>,
|
||||
size: Option<Rems>,
|
||||
handler: Option<ClickHandler>,
|
||||
}
|
||||
|
||||
pub(crate) fn button(
|
||||
id: impl Into<ElementId>,
|
||||
label: impl Into<SharedString>,
|
||||
kind: BtnKind,
|
||||
) -> Btn {
|
||||
Btn {
|
||||
id: id.into(),
|
||||
label: label.into(),
|
||||
kind,
|
||||
disabled: false,
|
||||
dimmed: false,
|
||||
icon: None,
|
||||
size: None,
|
||||
handler: None,
|
||||
}
|
||||
}
|
||||
|
||||
impl Btn {
|
||||
pub(crate) fn disabled(mut self, disabled: bool) -> Self {
|
||||
self.disabled = disabled;
|
||||
self
|
||||
}
|
||||
/// Clickable, but drawn at rest — a Save with nothing to save yet.
|
||||
pub(crate) fn dimmed(mut self, dimmed: bool) -> Self {
|
||||
self.dimmed = dimmed;
|
||||
self
|
||||
}
|
||||
pub(crate) fn icon(mut self, path: impl Into<SharedString>) -> Self {
|
||||
self.icon = Some(path.into());
|
||||
self
|
||||
}
|
||||
pub(crate) fn text_size(mut self, size: Rems) -> Self {
|
||||
self.size = Some(size);
|
||||
self
|
||||
}
|
||||
pub(crate) fn on_click(
|
||||
mut self,
|
||||
f: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static,
|
||||
) -> Self {
|
||||
self.handler = Some(Rc::new(f));
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl RenderOnce for Btn {
|
||||
fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement {
|
||||
let tk = Tk::of(cx);
|
||||
let kind = self.kind;
|
||||
let base = h_flex()
|
||||
.id(self.id)
|
||||
.flex_shrink_0()
|
||||
.items_center()
|
||||
.gap(px(6.))
|
||||
.whitespace_nowrap();
|
||||
let el = match kind {
|
||||
BtnKind::Secondary => base
|
||||
.h(px(26.))
|
||||
.px(px(12.))
|
||||
.when(self.icon.is_some(), |b| b.pl(px(9.)).pr(px(11.)))
|
||||
.rounded(px(6.))
|
||||
.bg(tk.btn)
|
||||
.shadow(tk.raised())
|
||||
.text_size(self.size.unwrap_or(fs(12.5)))
|
||||
.text_color(tk.fg)
|
||||
.when(!self.disabled, |b| {
|
||||
b.hover(move |s| s.shadow(tk.raised_hover()))
|
||||
.active(move |s| s.bg(tk.k05))
|
||||
}),
|
||||
BtnKind::Primary => base
|
||||
.h(px(26.))
|
||||
.px(px(12.))
|
||||
.rounded(px(6.))
|
||||
.bg(tk.fg)
|
||||
.text_size(self.size.unwrap_or(fs(12.5)))
|
||||
.font_weight(FontWeight::MEDIUM)
|
||||
.text_color(tk.page)
|
||||
.when(!self.disabled, |b| b.hover(|s| s.opacity(0.88))),
|
||||
BtnKind::Link | BtnKind::Danger => base
|
||||
.text_size(self.size.unwrap_or(fs(12.)))
|
||||
.text_color(if kind == BtnKind::Danger {
|
||||
tk.danger
|
||||
} else {
|
||||
tk.k6
|
||||
})
|
||||
.when(!self.disabled, |b| {
|
||||
b.hover(move |s| {
|
||||
s.text_color(if kind == BtnKind::Danger {
|
||||
tk.danger
|
||||
} else {
|
||||
tk.fg
|
||||
})
|
||||
})
|
||||
}),
|
||||
};
|
||||
el.when(self.disabled, |b| b.opacity(0.45))
|
||||
.when(self.dimmed && !self.disabled, |b| b.opacity(0.55))
|
||||
.when_some(self.icon, |b, path| {
|
||||
b.child(Icon::empty().path(path).size(px(10.)).text_color(tk.k6))
|
||||
})
|
||||
.child(self.label)
|
||||
.when_some(self.handler.filter(|_| !self.disabled), |b, handler| {
|
||||
b.cursor_pointer()
|
||||
.on_click(move |ev, window, cx| handler(ev, window, cx))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/// A key on a keycap: `⌘`, `T`, `Space`.
|
||||
pub(crate) fn keycap(key: impl Into<SharedString>, tk: &Tk) -> Div {
|
||||
div()
|
||||
.flex_shrink_0()
|
||||
.min_w(px(20.))
|
||||
.h(px(20.))
|
||||
.px(px(5.))
|
||||
.rounded(px(4.))
|
||||
.bg(tk.k05)
|
||||
.shadow(vec![BoxShadow {
|
||||
color: tk.k15,
|
||||
offset: point(px(0.), px(-0.5)),
|
||||
blur_radius: px(0.),
|
||||
spread_radius: px(0.),
|
||||
inset: true,
|
||||
}])
|
||||
.flex()
|
||||
.items_center()
|
||||
.justify_center()
|
||||
.text_size(fs(11.5))
|
||||
.text_color(tk.k6)
|
||||
.child(key.into())
|
||||
}
|
||||
|
||||
/// A search glass the size the design draws it beside a field.
|
||||
pub(crate) fn search_glass(size: f32, tk: &Tk) -> Icon {
|
||||
Icon::empty()
|
||||
.path("icons/settings/search.svg")
|
||||
.size(px(size))
|
||||
.text_color(tk.k35)
|
||||
}
|
||||
|
||||
/// A search field with a hairline ring, for filtering a list on the page.
|
||||
pub(crate) fn search_field(input: &gpui::Entity<InputState>, tk: &Tk) -> Div {
|
||||
h_flex()
|
||||
.h(px(26.))
|
||||
.px(px(8.))
|
||||
.gap(px(6.))
|
||||
.items_center()
|
||||
.rounded(px(6.))
|
||||
.shadow(vec![ring(tk.k15, 0.5, true)])
|
||||
.child(search_glass(10., tk))
|
||||
.child(
|
||||
div()
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.text_size(fs(12.5))
|
||||
.child(Input::new(input).appearance(false).px_0().py_0().h(px(24.))),
|
||||
)
|
||||
}
|
||||
|
||||
/// A text field the way the page draws one: a hairline ring on the page, in
|
||||
/// the terminal's monospace, with a firmer ring while it has focus.
|
||||
pub(crate) fn text_field(
|
||||
input: &gpui::Entity<InputState>,
|
||||
focused: bool,
|
||||
invalid: bool,
|
||||
tk: &Tk,
|
||||
cx: &App,
|
||||
) -> Div {
|
||||
let ring_color = if invalid {
|
||||
tk.danger
|
||||
} else if focused {
|
||||
tk.k45
|
||||
} else {
|
||||
tk.k15
|
||||
};
|
||||
div()
|
||||
.h(px(26.))
|
||||
.px(px(10.))
|
||||
.flex()
|
||||
.items_center()
|
||||
.rounded(px(6.))
|
||||
.shadow(vec![ring(
|
||||
ring_color,
|
||||
if focused || invalid { 1. } else { 0.5 },
|
||||
true,
|
||||
)])
|
||||
.font_family(Tk::mono(cx))
|
||||
.text_size(fs(12.))
|
||||
.text_color(tk.fg)
|
||||
.child(
|
||||
div()
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.child(Input::new(input).appearance(false).px_0().py_0().h(px(24.))),
|
||||
)
|
||||
}
|
||||
|
||||
/// A group's heading and, when it has one, the sentence under it.
|
||||
pub(crate) fn section_head(title: &str, desc: Option<String>, tk: &Tk) -> Div {
|
||||
v_flex()
|
||||
.gap(px(3.))
|
||||
.pb(px(8.))
|
||||
.child(
|
||||
div()
|
||||
.text_size(fs(11.5))
|
||||
.font_weight(FontWeight::SEMIBOLD)
|
||||
.text_color(tk.heading)
|
||||
.child(title.to_string()),
|
||||
)
|
||||
.when_some(desc.filter(|d| !d.is_empty()), |col, desc| {
|
||||
col.child(
|
||||
div()
|
||||
.text_size(fs(12.))
|
||||
.line_height(px(17.))
|
||||
.text_color(tk.k6)
|
||||
.child(desc),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
/// The trigger of a dropdown: a raised button with the current value, an
|
||||
/// optional mark before it, and a chevron.
|
||||
pub(crate) fn select_trigger(
|
||||
id: impl Into<ElementId>,
|
||||
label: impl Into<SharedString>,
|
||||
leading: Option<AnyElement>,
|
||||
open: bool,
|
||||
tk: &Tk,
|
||||
) -> Stateful<Div> {
|
||||
h_flex()
|
||||
.id(id)
|
||||
.h(px(26.))
|
||||
.min_w(px(148.))
|
||||
.max_w(px(260.))
|
||||
.pl(px(if leading.is_some() { 8. } else { 10. }))
|
||||
.pr(px(7.))
|
||||
.gap(px(8.))
|
||||
.items_center()
|
||||
.rounded(px(6.))
|
||||
.bg(if open { tk.k05 } else { tk.btn })
|
||||
.shadow(tk.raised())
|
||||
.hover(move |s| s.shadow(tk.raised_hover()))
|
||||
.cursor_pointer()
|
||||
.text_size(fs(12.5))
|
||||
.text_color(tk.fg)
|
||||
.whitespace_nowrap()
|
||||
.children(leading)
|
||||
.child(div().flex_1().min_w_0().truncate().child(label.into()))
|
||||
.child(chevron_down(tk))
|
||||
}
|
||||
|
||||
pub(crate) fn chevron_down(tk: &Tk) -> Icon {
|
||||
Icon::empty()
|
||||
.path("icons/settings/chevron-down.svg")
|
||||
.size(px(10.))
|
||||
.text_color(tk.k45)
|
||||
}
|
||||
|
||||
pub(crate) fn check_mark(visible: bool, tk: &Tk) -> Div {
|
||||
div().size(px(12.)).flex_shrink_0().when(visible, |d| {
|
||||
d.child(
|
||||
Icon::empty()
|
||||
.path("icons/settings/check.svg")
|
||||
.size(px(12.))
|
||||
.text_color(tk.fg),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
/// A popover's surface.
|
||||
pub(crate) fn menu_panel(tk: &Tk) -> Div {
|
||||
v_flex()
|
||||
.p(px(4.))
|
||||
.gap(px(1.))
|
||||
.rounded(px(8.))
|
||||
.bg(tk.menu)
|
||||
.shadow(tk.popover())
|
||||
.text_size(fs(12.5))
|
||||
.text_color(tk.fg)
|
||||
}
|
||||
|
||||
/// One pickable row in a popover menu.
|
||||
pub(crate) fn menu_row(id: impl Into<ElementId>, highlighted: bool, tk: &Tk) -> Stateful<Div> {
|
||||
h_flex()
|
||||
.id(id)
|
||||
.flex_shrink_0()
|
||||
.h(px(26.))
|
||||
.pl(px(6.))
|
||||
.pr(px(12.))
|
||||
.gap(px(6.))
|
||||
.items_center()
|
||||
.rounded(px(5.))
|
||||
.whitespace_nowrap()
|
||||
.cursor_pointer()
|
||||
.when(highlighted, |r| r.bg(tk.k06))
|
||||
.hover(move |s| s.bg(tk.k06))
|
||||
}
|
||||
|
||||
pub(crate) fn menu_heading(label: impl Into<SharedString>, tk: &Tk) -> Div {
|
||||
div()
|
||||
.h(px(24.))
|
||||
.px(px(8.))
|
||||
.flex()
|
||||
.items_center()
|
||||
.text_size(fs(11.))
|
||||
.font_weight(FontWeight::MEDIUM)
|
||||
.text_color(tk.k45)
|
||||
.child(label.into())
|
||||
}
|
||||
|
||||
pub(crate) fn menu_separator(tk: &Tk) -> Div {
|
||||
div().h(px(1.)).mx(px(6.)).my(px(4.)).bg(tk.k08)
|
||||
}
|
||||
|
||||
/// Where a trigger's popover hangs: under the trigger, its right edge on the
|
||||
/// trigger's (or its left on the trigger's), painted over the rest of the page
|
||||
/// and pushed back inside the window when it would run off it.
|
||||
pub(crate) fn popover_below(align_right: bool, gap: f32, content: impl IntoElement) -> Div {
|
||||
let anchor = if align_right {
|
||||
gpui::Anchor::TopRight
|
||||
} else {
|
||||
gpui::Anchor::TopLeft
|
||||
};
|
||||
div()
|
||||
.absolute()
|
||||
.top(px(26. + gap))
|
||||
.when(align_right, |d| d.right_0())
|
||||
.when(!align_right, |d| d.left_0())
|
||||
.child(
|
||||
gpui::deferred(
|
||||
gpui::anchored()
|
||||
.anchor(anchor)
|
||||
.snap_to_window_with_margin(px(8.))
|
||||
.child(
|
||||
div()
|
||||
.occlude()
|
||||
// A click inside the popover is not a click on the
|
||||
// page under it, which would close it.
|
||||
.on_mouse_down(MouseButton::Left, |_, _, cx| cx.stop_propagation())
|
||||
.child(content),
|
||||
),
|
||||
)
|
||||
.with_priority(2),
|
||||
)
|
||||
}
|
||||
|
||||
/// The stepper: − value +, one raised control with hairline dividers.
|
||||
pub(crate) struct Stepper {
|
||||
pub value: String,
|
||||
pub unit: String,
|
||||
pub can_dec: bool,
|
||||
pub can_inc: bool,
|
||||
}
|
||||
|
||||
pub(crate) fn stepper(
|
||||
id: &'static str,
|
||||
s: Stepper,
|
||||
tk: &Tk,
|
||||
on_dec: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static,
|
||||
on_inc: impl Fn(&ClickEvent, &mut Window, &mut App) + 'static,
|
||||
) -> AnyElement {
|
||||
let end = |suffix: &'static str, glyph: &'static str, enabled: bool| {
|
||||
div()
|
||||
.id(SharedString::from(format!("{id}-{suffix}")))
|
||||
.w(px(28.))
|
||||
.h(px(26.))
|
||||
.flex()
|
||||
.items_center()
|
||||
.justify_center()
|
||||
.text_size(fs(13.))
|
||||
.text_color(tk.k6)
|
||||
.when(!enabled, |d| d.opacity(0.35))
|
||||
.when(enabled, |d| {
|
||||
d.cursor_pointer().active(move |s| s.bg(tk.k05))
|
||||
})
|
||||
.child(glyph)
|
||||
};
|
||||
let divider = || div().h(px(14.)).w(px(1.)).bg(tk.k15);
|
||||
h_flex()
|
||||
.id(id)
|
||||
.h(px(26.))
|
||||
.items_center()
|
||||
.rounded(px(6.))
|
||||
.bg(tk.btn)
|
||||
.shadow(tk.raised())
|
||||
.child(
|
||||
end("dec", "−", s.can_dec)
|
||||
.rounded_l(px(6.))
|
||||
.when(s.can_dec, |d| d.on_click(on_dec)),
|
||||
)
|
||||
.child(divider())
|
||||
.child(
|
||||
h_flex()
|
||||
.min_w(px(52.))
|
||||
.px(px(6.))
|
||||
.justify_center()
|
||||
.text_size(fs(12.5))
|
||||
.text_color(tk.fg)
|
||||
.child(s.value)
|
||||
.child(div().text_color(tk.k4).child(s.unit)),
|
||||
)
|
||||
.child(divider())
|
||||
.child(
|
||||
end("inc", "+", s.can_inc)
|
||||
.rounded_r(px(6.))
|
||||
.when(s.can_inc, |d| d.on_click(on_inc)),
|
||||
)
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
/// What a slider is being dragged by; the id tells two sliders apart.
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct SliderDrag(pub SharedString);
|
||||
|
||||
impl Render for SliderDrag {
|
||||
fn render(&mut self, _: &mut Window, _: &mut gpui::Context<Self>) -> impl IntoElement {
|
||||
div()
|
||||
}
|
||||
}
|
||||
|
||||
/// A thin track with an ink fill and a raised knob, 148 wide, with its value
|
||||
/// read out beside it. `on_set` takes the fraction along the track the pointer
|
||||
/// is at; `on_release` is where a drag's value gets written down for good.
|
||||
pub(crate) fn slider(
|
||||
id: impl Into<SharedString>,
|
||||
fraction: f32,
|
||||
readout: String,
|
||||
tk: &Tk,
|
||||
on_set: Rc<dyn Fn(f32, &mut Window, &mut App)>,
|
||||
on_release: Rc<dyn Fn(&mut Window, &mut App)>,
|
||||
) -> AnyElement {
|
||||
let id: SharedString = id.into();
|
||||
let f = fraction.clamp(0., 1.);
|
||||
const W: f32 = 148.;
|
||||
let frac_at = |bounds: gpui::Bounds<gpui::Pixels>, x: gpui::Pixels| -> f32 {
|
||||
let w = bounds.size.width.as_f32().max(1.);
|
||||
((x - bounds.origin.x).as_f32() / w).clamp(0., 1.)
|
||||
};
|
||||
let set_down = on_set.clone();
|
||||
let set_move = on_set;
|
||||
let drag_id = id.clone();
|
||||
let release_up = on_release.clone();
|
||||
let release_out = on_release;
|
||||
let bounds = Rc::new(std::cell::Cell::new(gpui::Bounds::<gpui::Pixels>::default()));
|
||||
h_flex()
|
||||
.gap(px(8.))
|
||||
.items_center()
|
||||
.child(
|
||||
div()
|
||||
.id(ElementId::Name(id.clone()))
|
||||
.relative()
|
||||
.w(px(W))
|
||||
.h(px(18.))
|
||||
.cursor_pointer()
|
||||
.child(
|
||||
div()
|
||||
.absolute()
|
||||
.left_0()
|
||||
.right_0()
|
||||
.top(px(8.))
|
||||
.h(px(2.))
|
||||
.rounded(px(1.))
|
||||
.bg(tk.k15),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.absolute()
|
||||
.left_0()
|
||||
.top(px(8.))
|
||||
.h(px(2.))
|
||||
.w(px(W * f))
|
||||
.rounded(px(1.))
|
||||
.bg(tk.fg),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.absolute()
|
||||
.top(px(2.))
|
||||
.left(px(W * f - 7.))
|
||||
.size(px(14.))
|
||||
.rounded_full()
|
||||
.bg(tk.knob)
|
||||
.shadow(vec![
|
||||
ring(gpui::black().opacity(0.18), 0.5, false),
|
||||
drop(gpui::black().opacity(0.18), 1., 3., 0.),
|
||||
]),
|
||||
)
|
||||
.child({
|
||||
// The track's bounds for a click that never becomes a
|
||||
// drag: a mouse-down event carries a position but not the
|
||||
// box it landed in.
|
||||
let bounds = bounds.clone();
|
||||
gpui::canvas(move |b, _, _| bounds.set(b), |_, _, _, _| {})
|
||||
.absolute()
|
||||
.size_full()
|
||||
})
|
||||
.on_mouse_down(MouseButton::Left, {
|
||||
let bounds = bounds.clone();
|
||||
move |ev: &gpui::MouseDownEvent, window, cx| {
|
||||
set_down(frac_at(bounds.get(), ev.position.x), window, cx);
|
||||
}
|
||||
})
|
||||
.on_drag(SliderDrag(drag_id), |drag, _, _, cx| {
|
||||
cx.new(|_| drag.clone())
|
||||
})
|
||||
.on_drag_move({
|
||||
let id = id.clone();
|
||||
move |ev: &gpui::DragMoveEvent<SliderDrag>, window, cx| {
|
||||
if ev.drag(cx).0 != id {
|
||||
return;
|
||||
}
|
||||
set_move(frac_at(ev.bounds, ev.event.position.x), window, cx);
|
||||
}
|
||||
})
|
||||
.on_mouse_up(MouseButton::Left, move |_, window, cx| {
|
||||
release_up(window, cx)
|
||||
})
|
||||
.on_mouse_up_out(MouseButton::Left, move |_, window, cx| {
|
||||
release_out(window, cx)
|
||||
}),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.w(px(40.))
|
||||
.flex_shrink_0()
|
||||
.text_right()
|
||||
.whitespace_nowrap()
|
||||
.text_size(fs(12.5))
|
||||
.text_color(tk.k6)
|
||||
.child(readout),
|
||||
)
|
||||
.into_any_element()
|
||||
}
|
||||
@@ -0,0 +1,339 @@
|
||||
//! Keyboard shortcuts: every action in the palette's groups, each with its
|
||||
//! keys as keycaps. Click the keys to record new ones; a chord another action
|
||||
//! already has asks before it is taken over.
|
||||
|
||||
use super::kit::{BtnKind, Tk, fs};
|
||||
use super::*;
|
||||
|
||||
impl Tty7App {
|
||||
pub(crate) fn render_settings_keybindings(&self, cx: &mut Context<Self>) -> AnyElement {
|
||||
let tk = Tk::of(cx);
|
||||
let Some(s) = self.active_settings() else {
|
||||
return div().into_any_element();
|
||||
};
|
||||
let search = s.shortcut_search.clone();
|
||||
let query = search.read(cx).value().trim().to_lowercase();
|
||||
let recording = s
|
||||
.recording
|
||||
.as_ref()
|
||||
.map(|r| (r.action.clone(), r.chords.clone()));
|
||||
let conflict = s
|
||||
.kb_conflict
|
||||
.as_ref()
|
||||
.map(|c| (c.action.clone(), c.spec.clone(), c.other.clone()));
|
||||
let note = s.rebinding_note.clone();
|
||||
|
||||
let (preset, prefix, overridden) = {
|
||||
let cfg = cx.global::<Config>();
|
||||
let overridden: std::collections::HashSet<String> =
|
||||
cfg.keybindings.keys().cloned().collect();
|
||||
(
|
||||
cfg.keybinding_preset.clone(),
|
||||
cfg.prefix.clone(),
|
||||
overridden,
|
||||
)
|
||||
};
|
||||
let tmux = preset == "tmux";
|
||||
let changed = overridden.len();
|
||||
let effective = crate::ui::keymap::effective_chords(cx);
|
||||
|
||||
// The toolbar: the filter, a way back from every change at once, and
|
||||
// the preset the whole table starts from.
|
||||
let presets = self.segmented(
|
||||
"kb-preset",
|
||||
&[t(L10nKey::SettingsDefault), "tmux"],
|
||||
usize::from(tmux),
|
||||
cx,
|
||||
|this, ix, _w, cx| {
|
||||
this.set_keybinding_preset(if ix == 0 { "default" } else { "tmux" }, cx)
|
||||
},
|
||||
);
|
||||
let toolbar =
|
||||
h_flex()
|
||||
.gap(px(12.))
|
||||
.items_center()
|
||||
.child(
|
||||
kit::search_field(&search, &tk)
|
||||
.h(px(28.))
|
||||
.flex_1()
|
||||
.max_w(px(300.)),
|
||||
)
|
||||
.child(div().flex_1())
|
||||
.when(changed > 0, |r| {
|
||||
r.child(
|
||||
kit::button(
|
||||
"kb-restore-all",
|
||||
t_plural(L10nKey::SettingsRestoreChanged, changed, &[]),
|
||||
BtnKind::Link,
|
||||
)
|
||||
.on_click(cx.listener(|this, _, _w, cx| {
|
||||
this.restore_default_keybindings_confirmed(cx)
|
||||
})),
|
||||
)
|
||||
})
|
||||
.child(presets);
|
||||
let hint = div()
|
||||
.text_size(fs(12.))
|
||||
.line_height(px(17.))
|
||||
.text_color(tk.k45)
|
||||
.child(if tmux {
|
||||
t(L10nKey::SettingsShortcutsHintTmux)
|
||||
} else {
|
||||
t(L10nKey::SettingsShortcutsHint)
|
||||
});
|
||||
let prefix_row = tmux.then(|| {
|
||||
h_flex()
|
||||
.gap(px(10.))
|
||||
.items_center()
|
||||
.child(
|
||||
div()
|
||||
.text_size(fs(12.))
|
||||
.text_color(tk.k5)
|
||||
.child(t(L10nKey::SettingsPrefix)),
|
||||
)
|
||||
.child(self.segmented(
|
||||
"kb-prefix",
|
||||
&["⌃B", "⌃A"],
|
||||
usize::from(prefix == "ctrl-a"),
|
||||
cx,
|
||||
|this, ix, _w, cx| {
|
||||
this.set_keybinding_prefix(if ix == 0 { "ctrl-b" } else { "ctrl-a" }, cx)
|
||||
},
|
||||
))
|
||||
});
|
||||
let intro = v_flex()
|
||||
.mt(px(-12.))
|
||||
.gap(px(10.))
|
||||
.child(toolbar)
|
||||
.child(hint)
|
||||
.children(prefix_row)
|
||||
.when_some(note, |v, note| {
|
||||
v.child(div().text_size(fs(12.)).text_color(tk.fg).child(note))
|
||||
})
|
||||
.into_any_element();
|
||||
|
||||
// The rows, in the palette's groups.
|
||||
let mut grouped: Vec<(
|
||||
crate::ui::palette::CommandGroup,
|
||||
Vec<(String, Vec<String>, String)>,
|
||||
)> = Vec::new();
|
||||
for (action, keys) in effective {
|
||||
let (group, label) = crate::ui::keymap::action_entry(&action);
|
||||
if !query.is_empty()
|
||||
&& !keybinding_matches_query(&action, &query)
|
||||
&& !label.to_lowercase().contains(&query)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
match grouped.iter_mut().find(|(g, _)| *g == group) {
|
||||
Some((_, rows)) => rows.push((action, keys, label)),
|
||||
None => grouped.push((group, vec![(action, keys, label)])),
|
||||
}
|
||||
}
|
||||
grouped.sort_by_key(|(g, _)| {
|
||||
crate::ui::palette::CommandGroup::ORDER
|
||||
.iter()
|
||||
.position(|o| o == g)
|
||||
.unwrap_or(usize::MAX)
|
||||
});
|
||||
|
||||
let mut groups = vec![intro];
|
||||
let none = grouped.is_empty();
|
||||
for (group, rows) in grouped {
|
||||
let mut section = v_flex().child(
|
||||
div()
|
||||
.pb(px(6.))
|
||||
.text_size(fs(11.5))
|
||||
.font_weight(FontWeight::SEMIBOLD)
|
||||
.text_color(tk.heading)
|
||||
.child(group.title()),
|
||||
);
|
||||
for (action, keys, label) in rows {
|
||||
let is_recording = recording.as_ref().is_some_and(|(a, _)| *a == action);
|
||||
let conflict_here = conflict.as_ref().filter(|(a, _, _)| *a == action);
|
||||
let shown: Vec<String> = match (&recording, conflict_here) {
|
||||
(Some((a, chords)), _) if *a == action => vec![chords.join(" ")]
|
||||
.into_iter()
|
||||
.filter(|c| !c.is_empty())
|
||||
.collect(),
|
||||
(_, Some((_, spec, _))) => vec![spec.clone()],
|
||||
_ => keys,
|
||||
};
|
||||
let modified = overridden.contains(&action) && !is_recording;
|
||||
let ring = if is_recording {
|
||||
vec![kit::ring(tk.fg, 1., true)]
|
||||
} else if conflict_here.is_some() {
|
||||
vec![kit::ring(tk.warn, 1., true)]
|
||||
} else {
|
||||
Vec::new()
|
||||
};
|
||||
let hover_ring = if is_recording || conflict_here.is_some() {
|
||||
vec![kit::ring(tk.fg, 1., true)]
|
||||
} else {
|
||||
vec![kit::ring(tk.k15, 0.5, true)]
|
||||
};
|
||||
let record_action = action.clone();
|
||||
let keys_button = h_flex()
|
||||
.id(SharedString::from(format!("kb-{action}")))
|
||||
.h(px(26.))
|
||||
.min_w(px(72.))
|
||||
.pl(px(8.))
|
||||
.pr(px(4.))
|
||||
.gap(px(5.))
|
||||
.items_center()
|
||||
.justify_end()
|
||||
.rounded(px(6.))
|
||||
.cursor_pointer()
|
||||
.when(is_recording, |b| b.bg(tk.page))
|
||||
.shadow(ring)
|
||||
.hover(move |b| b.shadow(hover_ring.clone()))
|
||||
.when(is_recording && shown.is_empty(), |b| {
|
||||
b.child(
|
||||
div()
|
||||
.pr(px(2.))
|
||||
.text_size(fs(12.))
|
||||
.text_color(tk.k45)
|
||||
.child(t(L10nKey::SettingsPressKeysShort)),
|
||||
)
|
||||
})
|
||||
.children(shown.iter().enumerate().map(|(n, spec)| {
|
||||
h_flex()
|
||||
.gap(px(5.))
|
||||
.items_center()
|
||||
.when(n > 0, |d| {
|
||||
d.child(div().text_size(fs(11.)).text_color(tk.k4).child("/"))
|
||||
})
|
||||
.child(Self::keycap_row(spec, &tk))
|
||||
}))
|
||||
.when(!is_recording && shown.is_empty(), |b| {
|
||||
b.child(
|
||||
div()
|
||||
.pr(px(4.))
|
||||
.text_size(fs(12.))
|
||||
.text_color(tk.k3)
|
||||
.child("—"),
|
||||
)
|
||||
})
|
||||
.on_click(cx.listener(move |this, _, window, cx| {
|
||||
let already = this
|
||||
.active_settings()
|
||||
.and_then(|s| s.recording.as_ref())
|
||||
.is_some_and(|r| r.action == record_action);
|
||||
if already {
|
||||
if let Some(s) = this.active_settings_mut() {
|
||||
s.recording = None;
|
||||
}
|
||||
cx.notify();
|
||||
} else {
|
||||
this.start_recording_key(record_action.clone(), window, cx)
|
||||
}
|
||||
}));
|
||||
let reset_action = action.clone();
|
||||
let row = h_flex()
|
||||
.h(px(34.))
|
||||
.px(px(8.))
|
||||
.gap(px(16.))
|
||||
.items_center()
|
||||
.justify_between()
|
||||
.rounded(px(7.))
|
||||
.when(conflict_here.is_none(), |r| r.hover(move |s| s.bg(tk.k04)))
|
||||
.child(
|
||||
h_flex()
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.gap(px(8.))
|
||||
.items_center()
|
||||
.child(div().min_w_0().truncate().child(label))
|
||||
.when(modified, |r| {
|
||||
r.child(
|
||||
div()
|
||||
.id(SharedString::from(format!("reset-{action}")))
|
||||
.flex_shrink_0()
|
||||
.text_size(fs(11.5))
|
||||
.text_color(tk.k4)
|
||||
.cursor_pointer()
|
||||
.hover(move |s| s.text_color(tk.fg))
|
||||
.child(t(L10nKey::Reset))
|
||||
.on_click(cx.listener(move |this, _, _w, cx| {
|
||||
this.reset_keybinding(reset_action.clone(), cx)
|
||||
})),
|
||||
)
|
||||
}),
|
||||
)
|
||||
.child(keys_button);
|
||||
let conflict_line = conflict_here.map(|(_, spec, other)| {
|
||||
let keys = crate::ui::keymap::key_chords(spec)
|
||||
.into_iter()
|
||||
.map(|chord| chord.concat())
|
||||
.collect::<Vec<_>>()
|
||||
.join(&format!(" {} ", t(L10nKey::SettingsKeyThen)));
|
||||
let other = crate::ui::keymap::action_entry(other)
|
||||
.1
|
||||
.trim_end_matches('…')
|
||||
.to_string();
|
||||
h_flex()
|
||||
.px(px(8.))
|
||||
.pt(px(2.))
|
||||
.pb(px(10.))
|
||||
.gap(px(8.))
|
||||
.items_center()
|
||||
.text_size(fs(12.))
|
||||
.text_color(tk.k6)
|
||||
.child(
|
||||
div()
|
||||
.size(px(6.))
|
||||
.flex_shrink_0()
|
||||
.rounded_full()
|
||||
.bg(tk.warn),
|
||||
)
|
||||
.child(div().flex_1().min_w_0().child(t_fmt(
|
||||
L10nKey::SettingsShortcutConflict,
|
||||
&[("keys", &keys), ("action", &other)],
|
||||
)))
|
||||
.child(
|
||||
kit::button(
|
||||
"kb-conflict-replace",
|
||||
t(L10nKey::SettingsReplace),
|
||||
BtnKind::Primary,
|
||||
)
|
||||
.text_size(fs(12.))
|
||||
.on_click(cx.listener(
|
||||
|this, _, _w, cx| this.resolve_keybinding_conflict(true, cx),
|
||||
)),
|
||||
)
|
||||
.child(
|
||||
kit::button(
|
||||
"kb-conflict-cancel",
|
||||
t(L10nKey::Cancel),
|
||||
BtnKind::Secondary,
|
||||
)
|
||||
.text_size(fs(12.))
|
||||
.on_click(cx.listener(
|
||||
|this, _, _w, cx| this.resolve_keybinding_conflict(false, cx),
|
||||
)),
|
||||
)
|
||||
});
|
||||
section = section.child(
|
||||
v_flex()
|
||||
.mx(px(-8.))
|
||||
.rounded(px(7.))
|
||||
.when(conflict_line.is_some(), |d| d.bg(tk.k04))
|
||||
.child(row)
|
||||
.children(conflict_line),
|
||||
);
|
||||
}
|
||||
groups.push(section.into_any_element());
|
||||
}
|
||||
if none {
|
||||
groups.push(
|
||||
div()
|
||||
.text_color(tk.k35)
|
||||
.child(t_fmt(L10nKey::SettingsNoActionsMatch, &[("query", &query)]))
|
||||
.into_any_element(),
|
||||
);
|
||||
}
|
||||
Self::settings_page(groups)
|
||||
}
|
||||
}
|
||||
|
||||
use super::kit;
|
||||
@@ -0,0 +1,695 @@
|
||||
//! Appearance's Theme group: the Light / Dark / System cards, one dropdown
|
||||
//! per theme slot with a live preview of the theme under the pointer, and the
|
||||
//! editor a duplicated theme opens.
|
||||
|
||||
use std::rc::Rc;
|
||||
|
||||
use super::kit::{self, BtnKind, Tk, fs};
|
||||
use super::*;
|
||||
|
||||
fn rgb_of((r, g, b): (u8, u8, u8)) -> gpui::Rgba {
|
||||
rgb((r as u32) << 16 | (g as u32) << 8 | b as u32)
|
||||
}
|
||||
|
||||
/// The colors a theme is recognised by at a glance.
|
||||
struct Swatch {
|
||||
bg: gpui::Rgba,
|
||||
fg: gpui::Rgba,
|
||||
dim: gpui::Rgba,
|
||||
ansi: [gpui::Rgba; 16],
|
||||
}
|
||||
|
||||
impl Swatch {
|
||||
fn of(p: &presets::Theme) -> Self {
|
||||
let ansi = std::array::from_fn(|i| rgb_of(p.ansi16[i]));
|
||||
Self {
|
||||
bg: rgb(p.background_color()),
|
||||
fg: rgb(p.foreground),
|
||||
dim: rgb_of(p.ansi16[8]),
|
||||
ansi,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Tty7App {
|
||||
fn theme_mode(cx: &App) -> ThemeMode {
|
||||
let cfg = cx.global::<Config>();
|
||||
if cfg.theme_follow_system {
|
||||
ThemeMode::System
|
||||
} else if presets::by_id(cx, &cfg.theme_preset).dark {
|
||||
ThemeMode::Dark
|
||||
} else {
|
||||
ThemeMode::Light
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn render_theme_group(&self, cx: &mut Context<Self>) -> AnyElement {
|
||||
let tk = Tk::of(cx);
|
||||
let mode = Self::theme_mode(cx);
|
||||
let cfg = cx.global::<Config>();
|
||||
let (light_id, dark_id) = (
|
||||
cfg.theme_preset_light.clone(),
|
||||
cfg.theme_preset_dark.clone(),
|
||||
);
|
||||
let legible = cfg.theme_legible_palette;
|
||||
let light = Swatch::of(&presets::by_id(cx, &light_id));
|
||||
let dark = Swatch::of(&presets::by_id(cx, &dark_id));
|
||||
|
||||
let modes = [
|
||||
(ThemeMode::Light, t(L10nKey::SettingsLight), vec![&light]),
|
||||
(ThemeMode::Dark, t(L10nKey::SettingsDark), vec![&dark]),
|
||||
(
|
||||
ThemeMode::System,
|
||||
t(L10nKey::SettingsThemeModeSystem),
|
||||
vec![&light, &dark],
|
||||
),
|
||||
];
|
||||
let mode_cards = h_flex()
|
||||
.gap(px(14.))
|
||||
.children(modes.into_iter().map(|(m, label, halves)| {
|
||||
let on = m == mode;
|
||||
let bar = |w: f32, c: gpui::Rgba| div().w(px(w)).h(px(3.)).rounded(px(1.)).bg(c);
|
||||
v_flex()
|
||||
.id(SharedString::from(format!("theme-mode-{m:?}")))
|
||||
.items_center()
|
||||
.gap(px(7.))
|
||||
.cursor_pointer()
|
||||
.child(
|
||||
h_flex()
|
||||
.w(px(76.))
|
||||
.h(px(50.))
|
||||
.rounded(px(6.))
|
||||
.overflow_hidden()
|
||||
.shadow(if on {
|
||||
vec![kit::ring(tk.page, 1., false), kit::ring(tk.fg, 2.5, false)]
|
||||
} else {
|
||||
vec![kit::ring(tk.k15, 0.5, false)]
|
||||
})
|
||||
.children(halves.into_iter().map(|s| {
|
||||
v_flex()
|
||||
.flex_1()
|
||||
.min_w_0()
|
||||
.h_full()
|
||||
.bg(s.bg)
|
||||
.justify_center()
|
||||
.gap(px(5.))
|
||||
.px(px(9.))
|
||||
.overflow_hidden()
|
||||
.child(
|
||||
h_flex()
|
||||
.gap(px(3.))
|
||||
.child(bar(4., s.ansi[2]))
|
||||
.child(bar(26., s.fg)),
|
||||
)
|
||||
.child(
|
||||
h_flex()
|
||||
.gap(px(3.))
|
||||
.child(bar(10., s.ansi[4]))
|
||||
.child(bar(16., s.dim)),
|
||||
)
|
||||
.child(
|
||||
h_flex()
|
||||
.gap(px(3.))
|
||||
.child(bar(6., s.ansi[3]))
|
||||
.child(bar(20., s.dim)),
|
||||
)
|
||||
})),
|
||||
)
|
||||
.child(
|
||||
div()
|
||||
.text_size(fs(12.))
|
||||
.text_color(if on { tk.fg } else { tk.k5 })
|
||||
.when(on, |d| d.font_weight(FontWeight::MEDIUM))
|
||||
.child(label),
|
||||
)
|
||||
.on_click(
|
||||
cx.listener(move |this, _, window, cx| this.set_theme_mode(m, window, cx)),
|
||||
)
|
||||
}))
|
||||
.into_any_element();
|
||||
let mode_desc = match mode {
|
||||
ThemeMode::System => t(L10nKey::SettingsThemeModeSystemDesc),
|
||||
ThemeMode::Light => t(L10nKey::SettingsThemeModeLightDesc),
|
||||
ThemeMode::Dark => t(L10nKey::SettingsThemeModeDarkDesc),
|
||||
};
|
||||
|
||||
let mut rows = vec![
|
||||
self.settings_row(
|
||||
t(L10nKey::SettingsSyncWithSystem),
|
||||
mode_desc,
|
||||
mode_cards,
|
||||
cx,
|
||||
)
|
||||
.into_any_element(),
|
||||
];
|
||||
let slots: Vec<bool> = match mode {
|
||||
ThemeMode::System => vec![false, true],
|
||||
ThemeMode::Light => vec![false],
|
||||
ThemeMode::Dark => vec![true],
|
||||
};
|
||||
for dark_slot in slots {
|
||||
let desc = match (mode, dark_slot) {
|
||||
(ThemeMode::System, false) => t(L10nKey::SettingsThemeSlotLightDesc),
|
||||
(ThemeMode::System, true) => t(L10nKey::SettingsThemeSlotDarkDesc),
|
||||
_ => t(L10nKey::SettingsThemeSlotDesc),
|
||||
};
|
||||
let label = if dark_slot {
|
||||
t(L10nKey::SettingsDarkThemeLabel)
|
||||
} else {
|
||||
t(L10nKey::SettingsLightThemeLabel)
|
||||
};
|
||||
let control = self.theme_slot_dropdown(dark_slot, cx);
|
||||
rows.push(
|
||||
h_flex()
|
||||
.min_h(px(52.))
|
||||
.py(px(12.))
|
||||
.gap(px(32.))
|
||||
.items_center()
|
||||
.justify_between()
|
||||
.child(
|
||||
v_flex()
|
||||
.min_w_0()
|
||||
.gap(px(2.))
|
||||
.child(div().text_size(fs(13.)).child(label))
|
||||
.child(
|
||||
div()
|
||||
.text_size(fs(12.))
|
||||
.line_height(px(17.))
|
||||
.text_color(tk.k5)
|
||||
.child(desc),
|
||||
),
|
||||
)
|
||||
.child(control)
|
||||
.into_any_element(),
|
||||
);
|
||||
}
|
||||
let legible = self.settings_switch(
|
||||
"theme-legible-palette",
|
||||
legible,
|
||||
cx,
|
||||
|this, on, window, cx| this.set_theme_legible_palette(on, window, cx),
|
||||
);
|
||||
rows.push(
|
||||
self.settings_row(
|
||||
t(L10nKey::SettingsLegiblePalette),
|
||||
t(L10nKey::SettingsLegiblePaletteDesc),
|
||||
legible,
|
||||
cx,
|
||||
)
|
||||
.into_any_element(),
|
||||
);
|
||||
self.settings_group(Some(t(L10nKey::SettingsThemeIntroTitle)), None, rows, cx)
|
||||
}
|
||||
|
||||
fn theme_slot_dropdown(&self, dark_slot: bool, cx: &mut Context<Self>) -> AnyElement {
|
||||
let tk = Tk::of(cx);
|
||||
let cfg = cx.global::<Config>();
|
||||
let current_id = match (cfg.theme_follow_system, dark_slot) {
|
||||
(false, _) => cfg.theme_preset.clone(),
|
||||
(true, true) => cfg.theme_preset_dark.clone(),
|
||||
(true, false) => cfg.theme_preset_light.clone(),
|
||||
};
|
||||
let current = presets::by_id(cx, ¤t_id);
|
||||
let id: SharedString = if dark_slot {
|
||||
"theme-slot-dark"
|
||||
} else {
|
||||
"theme-slot-light"
|
||||
}
|
||||
.into();
|
||||
let open = self.settings_menu_open(&id);
|
||||
|
||||
let mut themes: Vec<presets::Theme> = presets::all(cx)
|
||||
.into_iter()
|
||||
.filter(|p| p.dark == dark_slot || p.id == current_id)
|
||||
.collect();
|
||||
themes.sort_by_key(|p| p.path.is_some());
|
||||
let start = themes.iter().position(|p| p.id == current_id).unwrap_or(0);
|
||||
|
||||
let sw = Swatch::of(¤t);
|
||||
let leading = div()
|
||||
.w(px(16.))
|
||||
.h(px(12.))
|
||||
.flex_shrink_0()
|
||||
.rounded(px(3.))
|
||||
.bg(sw.bg)
|
||||
.shadow(vec![kit::ring(tk.k15, 0.5, true)])
|
||||
.flex()
|
||||
.items_center()
|
||||
.px(px(3.))
|
||||
.child(div().w(px(6.)).h(px(2.)).rounded(px(1.)).bg(sw.fg))
|
||||
.into_any_element();
|
||||
let toggle = id.clone();
|
||||
let trigger = kit::select_trigger(
|
||||
ElementId::Name(SharedString::from(format!("{id}-trigger"))),
|
||||
current.name.clone(),
|
||||
Some(leading),
|
||||
open,
|
||||
&tk,
|
||||
)
|
||||
.on_click(cx.listener(move |this, _, window, cx| {
|
||||
this.toggle_settings_menu(toggle.clone(), start, true, window, cx)
|
||||
}));
|
||||
|
||||
let popover = open.then(|| self.theme_popover(&id, dark_slot, ¤t_id, themes, cx));
|
||||
div()
|
||||
.relative()
|
||||
.flex_shrink_0()
|
||||
.child(trigger)
|
||||
.when_some(popover, |d, p| d.child(kit::popover_below(true, 6., p)))
|
||||
.into_any_element()
|
||||
}
|
||||
|
||||
fn theme_popover(
|
||||
&self,
|
||||
id: &SharedString,
|
||||
dark_slot: bool,
|
||||
current_id: &str,
|
||||
themes: Vec<presets::Theme>,
|
||||
cx: &mut Context<Self>,
|
||||
) -> Div {
|
||||
let tk = Tk::of(cx);
|
||||
let Some(s) = self.active_settings() else {
|
||||
return div();
|
||||
};
|
||||
let query = s.menu_query.read(cx).value().trim().to_lowercase();
|
||||
let visible: Vec<presets::Theme> = themes
|
||||
.into_iter()
|
||||
.filter(|p| query.is_empty() || p.name.to_lowercase().contains(&query))
|
||||
.collect();
|
||||
let hi = s.menu_hi.min(visible.len().saturating_sub(1));
|
||||
let preview_theme = visible
|
||||
.get(hi)
|
||||
.cloned()
|
||||
.unwrap_or_else(|| presets::by_id(cx, current_id));
|
||||
let pv = Swatch::of(&preview_theme);
|
||||
|
||||
// What the highlighted theme does to a shell session, before it is
|
||||
// picked.
|
||||
let (fg, dim) = (pv.fg, pv.dim);
|
||||
let [_, r, g, y, b, m, ..] = pv.ansi;
|
||||
let lines: [Vec<(&str, gpui::Rgba)>; 5] = [
|
||||
vec![
|
||||
("~/code/orbit ", b),
|
||||
("main ", m),
|
||||
("❯ ", g),
|
||||
("git status -s", fg),
|
||||
],
|
||||
vec![(" M ", y), ("src/server.ts", fg)],
|
||||
vec![("?? ", r), ("notes.md", fg)],
|
||||
vec![
|
||||
("~/code/orbit ", b),
|
||||
("main ", m),
|
||||
("❯ ", g),
|
||||
("npm test", fg),
|
||||
],
|
||||
vec![
|
||||
("✓ 42 passed", g),
|
||||
(" ", fg),
|
||||
("✗ 1 failed", r),
|
||||
(" 0.8s", dim),
|
||||
],
|
||||
];
|
||||
let preview = div().p(px(8.)).child(
|
||||
v_flex()
|
||||
.rounded(px(6.))
|
||||
.bg(pv.bg)
|
||||
.shadow(vec![kit::ring(tk.k08, 0.5, true)])
|
||||
.px(px(11.))
|
||||
.py(px(9.))
|
||||
.font_family(Tk::mono(cx))
|
||||
.text_size(fs(10.5))
|
||||
.line_height(px(16.))
|
||||
.children(lines.into_iter().map(|spans| {
|
||||
h_flex().whitespace_nowrap().overflow_hidden().children(
|
||||
spans
|
||||
.into_iter()
|
||||
.map(|(text, c)| div().text_color(c).child(text)),
|
||||
)
|
||||
})),
|
||||
);
|
||||
|
||||
let picks: Rc<Vec<String>> = Rc::new(visible.iter().map(|p| p.id.clone()).collect());
|
||||
let mut list = v_flex()
|
||||
.id(ElementId::Name(SharedString::from(format!("{id}-list"))))
|
||||
.max_h(px(196.))
|
||||
.overflow_y_scroll()
|
||||
.track_scroll(&s.menu_scroll)
|
||||
.px(px(6.))
|
||||
.py(px(4.))
|
||||
.gap(px(1.));
|
||||
for (row, p) in visible.iter().enumerate() {
|
||||
let sw = Swatch::of(p);
|
||||
let pick = p.id.clone();
|
||||
list = list.child(
|
||||
h_flex()
|
||||
.id(ElementId::Name(SharedString::from(format!(
|
||||
"theme-pick-{}",
|
||||
p.id
|
||||
))))
|
||||
.h(px(28.))
|
||||
.flex_shrink_0()
|
||||
.px(px(8.))
|
||||
.gap(px(9.))
|
||||
.items_center()
|
||||
.rounded(px(6.))
|
||||
.cursor_pointer()
|
||||
.when(row == hi, |r| r.bg(tk.k06))
|
||||
.child(kit::check_mark(p.id == current_id, &tk))
|
||||
.child(div().flex_1().min_w_0().truncate().child(p.name.clone()))
|
||||
.when(p.path.is_some(), |r| {
|
||||
r.child(
|
||||
div()
|
||||
.text_size(fs(11.))
|
||||
.text_color(tk.k4)
|
||||
.child(t(L10nKey::SettingsCustom)),
|
||||
)
|
||||
})
|
||||
.child(
|
||||
h_flex()
|
||||
.gap(px(2.))
|
||||
.px(px(4.))
|
||||
.py(px(3.))
|
||||
.rounded(px(3.))
|
||||
.bg(sw.bg)
|
||||
.shadow(vec![kit::ring(tk.k08, 0.5, true)])
|
||||
.children(
|
||||
(1..=6).map(|i| div().size(px(5.)).rounded_full().bg(sw.ansi[i])),
|
||||
),
|
||||
)
|
||||
.on_mouse_move(cx.listener(move |this, _, _, cx| {
|
||||
if let Some(s) = this.active_settings_mut()
|
||||
&& s.menu_hi != row
|
||||
{
|
||||
s.menu_hi = row;
|
||||
cx.notify();
|
||||
}
|
||||
}))
|
||||
.on_click(cx.listener(move |this, _, window, cx| {
|
||||
this.close_settings_menu(window, cx);
|
||||
this.pick_slot_theme(dark_slot, &pick, window, cx);
|
||||
})),
|
||||
);
|
||||
}
|
||||
if visible.is_empty() {
|
||||
list = list.child(
|
||||
div()
|
||||
.h(px(28.))
|
||||
.px(px(8.))
|
||||
.flex()
|
||||
.items_center()
|
||||
.text_color(tk.k35)
|
||||
.child(t(L10nKey::SettingsNoThemesMatch)),
|
||||
);
|
||||
}
|
||||
// A theme file that fails to parse used to just not be in the list.
|
||||
// This is a folder the user drops files into; "it isn't there" needs a
|
||||
// reason attached.
|
||||
let rejected = presets::rejected(cx);
|
||||
let rejected_note = (!rejected.is_empty() && query.is_empty()).then(|| {
|
||||
v_flex()
|
||||
.px(px(14.))
|
||||
.py(px(8.))
|
||||
.gap(px(4.))
|
||||
.border_t_1()
|
||||
.border_color(tk.k08)
|
||||
.text_size(fs(11.5))
|
||||
.child(
|
||||
div()
|
||||
.text_color(tk.fg)
|
||||
.child(t(L10nKey::SettingsThemesRejected)),
|
||||
)
|
||||
.children(rejected.into_iter().map(|(name, why)| {
|
||||
v_flex()
|
||||
.child(div().text_color(tk.danger).child(name))
|
||||
.child(div().text_color(tk.k45).child(why))
|
||||
}))
|
||||
});
|
||||
let fork_from = current_id.to_string();
|
||||
let key_picks = picks.clone();
|
||||
|
||||
kit::menu_panel(&tk)
|
||||
.w(px(300.))
|
||||
.p_0()
|
||||
.gap_0()
|
||||
.overflow_hidden()
|
||||
.capture_key_down(cx.listener(move |this, ev: &KeyDownEvent, window, cx| {
|
||||
let key = ev.keystroke.key.as_str();
|
||||
let len = key_picks.len();
|
||||
match key {
|
||||
"down" | "up" => {
|
||||
if let Some(s) = this.active_settings_mut() {
|
||||
let hi = s.menu_hi.min(len.saturating_sub(1));
|
||||
s.menu_hi = if key == "down" {
|
||||
(hi + 1).min(len.saturating_sub(1))
|
||||
} else {
|
||||
hi.saturating_sub(1)
|
||||
};
|
||||
s.menu_scroll.scroll_to_item(s.menu_hi);
|
||||
}
|
||||
cx.stop_propagation();
|
||||
cx.notify();
|
||||
}
|
||||
"enter" => {
|
||||
let hi = this.active_settings().map(|s| s.menu_hi).unwrap_or(0);
|
||||
if let Some(pick) = key_picks.get(hi.min(len.saturating_sub(1))).cloned() {
|
||||
this.close_settings_menu(window, cx);
|
||||
this.pick_slot_theme(dark_slot, &pick, window, cx);
|
||||
}
|
||||
cx.stop_propagation();
|
||||
}
|
||||
"escape" => {
|
||||
this.close_settings_menu(window, cx);
|
||||
cx.stop_propagation();
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}))
|
||||
.child(preview)
|
||||
.child(
|
||||
h_flex()
|
||||
.h(px(32.))
|
||||
.px(px(14.))
|
||||
.gap(px(7.))
|
||||
.items_center()
|
||||
.border_t_1()
|
||||
.border_b_1()
|
||||
.border_color(tk.k08)
|
||||
.child(kit::search_glass(11., &tk))
|
||||
.child(
|
||||
div().flex_1().min_w_0().child(
|
||||
Input::new(&s.menu_query)
|
||||
.appearance(false)
|
||||
.px_0()
|
||||
.py_0()
|
||||
.h(px(28.)),
|
||||
),
|
||||
)
|
||||
.child(div().text_size(fs(11.)).text_color(tk.k35).child("↑↓ ↵")),
|
||||
)
|
||||
.child(list)
|
||||
.children(rejected_note)
|
||||
.child(
|
||||
h_flex()
|
||||
.h(px(34.))
|
||||
.px(px(14.))
|
||||
.gap(px(14.))
|
||||
.items_center()
|
||||
.border_t_1()
|
||||
.border_color(tk.k08)
|
||||
.child(
|
||||
kit::button(
|
||||
"theme-duplicate",
|
||||
t(L10nKey::SettingsDuplicateToEdit),
|
||||
BtnKind::Link,
|
||||
)
|
||||
.on_click(cx.listener(
|
||||
move |this, _, window, cx| {
|
||||
this.close_settings_menu(window, cx);
|
||||
this.fork_slot_theme(dark_slot, &fork_from, window, cx);
|
||||
},
|
||||
)),
|
||||
)
|
||||
.child(
|
||||
kit::button(
|
||||
"theme-open-folder",
|
||||
t(L10nKey::SettingsOpenThemesFolder),
|
||||
BtnKind::Link,
|
||||
)
|
||||
.on_click(cx.listener(|this, _, window, cx| {
|
||||
this.close_settings_menu(window, cx);
|
||||
this.open_themes_folder(window, cx);
|
||||
})),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
/// Copies a slot's theme to a file of its own and puts the copy in the
|
||||
/// slot, where the editor below picks it up.
|
||||
fn fork_slot_theme(
|
||||
&mut self,
|
||||
dark_slot: bool,
|
||||
id: &str,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
let theme = presets::by_id(cx, id);
|
||||
match presets::fork_to_file(&theme) {
|
||||
Ok(new_id) => {
|
||||
presets::load_registry(cx);
|
||||
self.pick_slot_theme(dark_slot, &new_id, window, cx);
|
||||
}
|
||||
Err(e) => {
|
||||
log::warn!("failed to duplicate theme: {e}");
|
||||
crate::ui::host_ops::HostOps::notify_err(
|
||||
window,
|
||||
cx,
|
||||
t(L10nKey::ThemeDuplicateFailed),
|
||||
&e,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The editor a custom theme opens: its colors, its background image, and
|
||||
/// the sixteen ANSI colors.
|
||||
pub(crate) fn render_theme_editor_group(&self, cx: &mut Context<Self>) -> Option<AnyElement> {
|
||||
let tk = Tk::of(cx);
|
||||
let editor = self
|
||||
.active_settings()
|
||||
.and_then(|s| s.theme_editor.as_ref())?;
|
||||
let seed: Vec<(String, Entity<ColorPickerState>)> = editor
|
||||
.seed
|
||||
.iter()
|
||||
.map(|(edit, state)| {
|
||||
(
|
||||
crate::ui::app::theme_edit_label(*edit).to_string(),
|
||||
state.clone(),
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
let ansi: Vec<Entity<ColorPickerState>> =
|
||||
editor.ansi.iter().map(|(_, s)| s.clone()).collect();
|
||||
|
||||
let theme = presets::by_id(cx, &crate::ui::theme::effective_preset_id(cx));
|
||||
let image = theme.image.clone();
|
||||
let image_name = image.as_ref().map(|i| {
|
||||
i.path
|
||||
.file_name()
|
||||
.map(|n| n.to_string_lossy().to_string())
|
||||
.unwrap_or_else(|| i.path.display().to_string())
|
||||
});
|
||||
|
||||
let mut rows: Vec<AnyElement> = seed
|
||||
.into_iter()
|
||||
.map(|(label, state)| {
|
||||
self.settings_row(
|
||||
label,
|
||||
"",
|
||||
ColorPicker::new(&state).small().into_any_element(),
|
||||
cx,
|
||||
)
|
||||
.into_any_element()
|
||||
})
|
||||
.collect();
|
||||
|
||||
let image_control = h_flex()
|
||||
.gap(px(12.))
|
||||
.items_center()
|
||||
.when_some(image_name.clone(), |r, name| {
|
||||
r.child(
|
||||
div()
|
||||
.max_w(px(160.))
|
||||
.truncate()
|
||||
.text_size(fs(12.))
|
||||
.text_color(tk.k5)
|
||||
.child(name),
|
||||
)
|
||||
.child(
|
||||
kit::button(
|
||||
"remove-theme-image",
|
||||
t(L10nKey::SettingsRemoveThemeImage),
|
||||
BtnKind::Link,
|
||||
)
|
||||
.on_click(
|
||||
cx.listener(|this, _, window, cx| this.remove_theme_image(window, cx)),
|
||||
),
|
||||
)
|
||||
})
|
||||
.child(
|
||||
kit::button(
|
||||
"pick-theme-image",
|
||||
if image.is_some() {
|
||||
t(L10nKey::SettingsChangeThemeImage)
|
||||
} else {
|
||||
t(L10nKey::SettingsChooseThemeImage)
|
||||
},
|
||||
BtnKind::Secondary,
|
||||
)
|
||||
.on_click(cx.listener(|this, _, _w, cx| this.pick_theme_image(cx))),
|
||||
)
|
||||
.into_any_element();
|
||||
rows.push(
|
||||
self.settings_row(
|
||||
t(L10nKey::SettingsBackgroundImage),
|
||||
t(L10nKey::SettingsBackgroundImageDesc),
|
||||
image_control,
|
||||
cx,
|
||||
)
|
||||
.into_any_element(),
|
||||
);
|
||||
if let Some(img) = image {
|
||||
let app = cx.entity().downgrade();
|
||||
let control = kit::slider(
|
||||
"theme-image-opacity",
|
||||
img.opacity,
|
||||
format!("{:.0}%", img.opacity * 100.),
|
||||
&tk,
|
||||
Rc::new(move |f, window, cx| {
|
||||
let v = (f * 100.).round() / 100.;
|
||||
let _ = app.update(cx, |this, cx| this.set_theme_image_opacity(v, window, cx));
|
||||
}),
|
||||
Rc::new(|_, _| {}),
|
||||
);
|
||||
rows.push(
|
||||
self.settings_row(
|
||||
t(L10nKey::SettingsImageOpacity),
|
||||
t(L10nKey::SettingsImageOpacityDesc),
|
||||
control,
|
||||
cx,
|
||||
)
|
||||
.into_any_element(),
|
||||
);
|
||||
}
|
||||
let ansi_grid = v_flex()
|
||||
.gap(px(6.))
|
||||
.children(ansi.chunks(8).map(|chunk| {
|
||||
h_flex()
|
||||
.gap(px(6.))
|
||||
.children(chunk.iter().map(|state| ColorPicker::new(state).small()))
|
||||
}))
|
||||
.into_any_element();
|
||||
rows.push(
|
||||
self.settings_row(t(L10nKey::SettingsAnsiColors), "", ansi_grid, cx)
|
||||
.into_any_element(),
|
||||
);
|
||||
rows.push(
|
||||
h_flex()
|
||||
.pt(px(4.))
|
||||
.child(
|
||||
kit::button(
|
||||
"open-themes-folder",
|
||||
t(L10nKey::SettingsOpenThemesFolder),
|
||||
BtnKind::Link,
|
||||
)
|
||||
.on_click(cx.listener(|this, _, w, cx| this.open_themes_folder(w, cx))),
|
||||
)
|
||||
.into_any_element(),
|
||||
);
|
||||
Some(self.settings_group(
|
||||
Some(t(L10nKey::SettingsEditTheme)),
|
||||
Some(t(L10nKey::SettingsEditThemeIntro).to_string()),
|
||||
rows,
|
||||
cx,
|
||||
))
|
||||
}
|
||||
}
|
||||
@@ -977,12 +977,6 @@ pub(crate) fn inverted_button(
|
||||
.active(ink.blend(surface.opacity(0.24)))
|
||||
}
|
||||
|
||||
/// On-state shares the accent role with sliders and primary actions.
|
||||
pub(crate) fn switch(id: impl Into<gpui::ElementId>, cx: &App) -> gpui_component::switch::Switch {
|
||||
let accent = cx.global::<presets::ActiveAccent>().0;
|
||||
gpui_component::switch::Switch::new(id).color(Hsla::from(rgb(accent)))
|
||||
}
|
||||
|
||||
pub(crate) fn apply_cursor_hide_mode(cx: &mut App) {
|
||||
let mode = if cx.global::<Config>().mouse_hide_while_typing {
|
||||
gpui::CursorHideMode::OnTypingAndAction
|
||||
|
||||