Nerd-Font-Symbole erst nach Probe einschalten

Ein Programm im Terminal kann die Schrift nicht abfragen. Wer den Schalter
ohne Nerd Font einschaltete, sah vor jedem Menüpunkt ein Kästchen mit ?.
Jetzt zeigt das Einschalten eine Probezeile mit sieben Symbolen; nur mit j
wird umgeschaltet, n behält die Text-Tags. Dazu je nach System, wo es die
Schrift gibt und wo man sie einstellt (Mac per brew, Windows Terminal,
Linux).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018i4GUga3zgZAxFm2DLd5o2
This commit is contained in:
Claude committed 2026-11-07 06:50:29 +00:00
1 parent 2f13427e39
commit 2202f645eb
5 files changed
+66 -20

No files matched your search

+3 -1
View File
@@ -188,7 +188,9 @@ warnt vor schlecht lesbaren Farben, Strg+S speichert (geht mit dem Sync mit).
**Symbole:** Menüs zeigen Text-Tags wie `[+]` `[k]` `[/]`, im Manager stehen Prompt-Zeichen für das System (`$` Linux,
`%` macOS, `>` Windows, `#` Switch). Sie bestehen nur aus Zeichen, die jede Terminalschrift hat, darum sieht nichts
verrutscht aus. Wer eine Nerd Font nutzt (z. B. „Cascadia Mono NF“), schaltet unter Einstellungen ›
„Nerd-Font-Symbole“ echte Bildsymbole ein; der Schalter gilt pro Rechner.
„Nerd-Font-Symbole“ echte Bildsymbole ein; der Schalter gilt pro Rechner. Vorher zeigt sshTermy eine
Probezeile: Erscheinen dort Kästchen oder „?“, fehlt dem Terminal die Schrift (Mac:
`brew install --cask font-caskaydia-mono-nerd-font`, dann im Terminalprofil als Schrift wählen).
Die Schriftgröße gehört dem Terminalfenster: Strg + Plus/Minus in Windows Terminal, ⌘ + / − unter macOS.
+2 -1
View File
@@ -189,7 +189,8 @@ read colours, Ctrl+S saves (synced to your other computers).
**Icons:** menus use text tags like `[+]` `[k]` `[/]`, the manager shows the system's prompt character (`$` Linux,
`%` macOS, `>` Windows, `#` switch). They only use characters every terminal font has, so nothing looks misaligned.
With a Nerd Font (e.g. "Cascadia Mono NF") switch on Settings › "Nerd Font icons" for real pictograms; the toggle is
per computer.
per computer. sshTermy first shows a test line: boxes or "?" there mean the terminal lacks the font (Mac:
`brew install --cask font-caskaydia-mono-nerd-font`, then pick it in the terminal profile).
The font size belongs to the terminal window: Ctrl + plus/minus in Windows Terminal, ⌘ + / − on macOS.
+9 -3
View File
@@ -17,9 +17,15 @@ var enLook = map[string]string{
"Farben anpassen (eigene Farben)": "Customise colours",
"Editor": "editor",
"Nerd-Font-Symbole (braucht z. B. Cascadia Mono NF)": "Nerd Font icons (needs e.g. Cascadia Mono NF)",
"Nerd-Font-Symbole an · fehlen Kästchen, im Terminal eine Nerd Font wählen (z. B. Cascadia Mono NF)": "Nerd Font icons on · if you see boxes, pick a Nerd Font in your terminal (e.g. Cascadia Mono NF)",
"Text-Symbole an: [+] [k] [/] … laufen mit jeder Schrift": "Text icons on: [+] [k] [/] … work with any font",
"Nerd-Font-Symbole (braucht z. B. Cascadia Mono NF)": "Nerd Font icons (needs e.g. Cascadia Mono NF)",
"Nerd-Font-Symbole an": "Nerd Font icons on",
"Nerd-Font-Symbole einschalten?": "Turn on Nerd Font icons?",
"Probe:": "Test:",
"Siehst du Zahnrad, Schlüssel, Lupe, Pinguin, Apfel, Windows, Server?\nDann j. Kästchen oder „?“: deinem Terminal fehlt eine Nerd Font,\ndann n (die Text-Tags [+] [k] [/] laufen mit jeder Schrift).": "Do you see a gear, key, magnifier, penguin, apple, Windows, server?\nThen y. Boxes or \"?\": your terminal has no Nerd Font,\nthen n (the text tags [+] [k] [/] work with any font).",
"Mac: brew install --cask font-caskaydia-mono-nerd-font\ndann Terminal › Einstellungen › Profile › Text › Schrift:\n„CaskaydiaMono Nerd Font“ (iTerm2: Settings › Profiles › Text › Font).": "Mac: brew install --cask font-caskaydia-mono-nerd-font\nthen Terminal › Settings › Profiles › Text › Font:\n\"CaskaydiaMono Nerd Font\" (iTerm2: Settings › Profiles › Text › Font).",
"Windows: „Cascadia Mono NF“ installieren, zu finden unter\ngithub.com/microsoft/cascadia-code/releases, dann Windows Terminal ›\nEinstellungen › Profil › Darstellung › Schriftart.": "Windows: install \"Cascadia Mono NF\" from\ngithub.com/microsoft/cascadia-code/releases, then Windows Terminal ›\nSettings › Profile › Appearance › Font face.",
"Linux: eine Nerd Font von nerdfonts.com installieren (z. B.\nCaskaydiaMono) und im Terminalprofil als Schrift wählen.": "Linux: install a Nerd Font from nerdfonts.com (e.g. CaskaydiaMono)\nand pick it as the font in your terminal profile.",
"Text-Symbole an: [+] [k] [/] … laufen mit jeder Schrift": "Text icons on: [+] [k] [/] … work with any font",
"Farben anpassen": "Customise colours",
" Vorschau sofort, Strg+S speichert · geht mit dem Sync mit": " live preview, Ctrl+S saves · synced to your other computers",
+41 -15
View File
@@ -4,6 +4,7 @@ import (
"fmt"
"image/color"
"math"
"runtime"
"strings"
tea "charm.land/bubbletea/v2"
@@ -278,27 +279,52 @@ func ansiTrunc(s string, w int) string {
return ansi.Truncate(s, w, "…")
}
// toggleNerdIcons schaltet zwischen Text-Tags und Nerd-Font-Symbolen.
// toggleNerdIcons schaltet zwischen Text-Tags und Nerd-Font-Symbolen. Welche
// Schrift das Terminal nutzt, kann ein Programm darin nicht erfahren; darum
// zeigt das Einschalten erst eine Probezeile, und nur wer dort Symbole statt
// Kästchen sieht, schaltet um.
func (a *App) toggleNerdIcons() tea.Cmd {
on := iconSet != iconNerd
if err := a.st.UpdateSettings(func(s *domain.Settings) {
s.Icons = ""
if on {
s.Icons = iconNerd
}
}); err != nil {
a.flashErr(err.Error())
if iconSet == iconNerd {
a.setIcons("")
a.flash(i18n.T("Text-Symbole an: [+] [k] [/] … laufen mit jeder Schrift"))
return nil
}
a.applyLook()
if on {
a.flash(i18n.T("Nerd-Font-Symbole an · fehlen Kästchen, im Terminal eine Nerd Font wählen (z. B. Cascadia Mono NF)"))
} else {
a.flash(i18n.T("Text-Symbole an: [+] [k] [/] … laufen mit jeder Schrift"))
}
a.modal = confirmModal(i18n.T("Nerd-Font-Symbole einschalten?"), nerdProbe(), func() tea.Cmd {
a.setIcons(iconNerd)
a.flash(i18n.T("Nerd-Font-Symbole an"))
return nil
})
return nil
}
func (a *App) setIcons(set string) {
if err := a.st.UpdateSettings(func(s *domain.Settings) { s.Icons = set }); err != nil {
a.flashErr(err.Error())
return
}
a.applyLook()
}
// nerdProbe: Probezeile mit Nerd-Font-Symbolen und wie man die Schrift bekommt.
func nerdProbe() string {
probe := strings.Join([]string{iconDefs["settings"].nerd, iconDefs["sshkey"].nerd, iconDefs["search"].nerd,
devNerd[devLinux], devNerd[devMac], devNerd[devWindows], iconDefs["manager"].nerd}, " ")
return i18n.T("Probe:") + " " + probe + "\n\n" +
i18n.T("Siehst du Zahnrad, Schlüssel, Lupe, Pinguin, Apfel, Windows, Server?\nDann j. Kästchen oder „?“: deinem Terminal fehlt eine Nerd Font,\ndann n (die Text-Tags [+] [k] [/] laufen mit jeder Schrift).") +
"\n\n" + nerdFontHint()
}
// nerdFontHint: wo es eine Nerd Font gibt und wo man sie einstellt.
func nerdFontHint() string {
switch runtime.GOOS {
case "darwin":
return i18n.T("Mac: brew install --cask font-caskaydia-mono-nerd-font\ndann Terminal › Einstellungen › Profile › Text › Schrift:\n„CaskaydiaMono Nerd Font“ (iTerm2: Settings › Profiles › Text › Font).")
case "windows":
return i18n.T("Windows: „Cascadia Mono NF“ installieren, zu finden unter\ngithub.com/microsoft/cascadia-code/releases, dann Windows Terminal ›\nEinstellungen › Profil › Darstellung › Schriftart.")
}
return i18n.T("Linux: eine Nerd Font von nerdfonts.com installieren (z. B.\nCaskaydiaMono) und im Terminalprofil als Schrift wählen.")
}
// ---------------------------------------------------------------- HSL
func toHSL(c color.Color) (h, s, l float64) {
+11
View File
@@ -76,7 +76,18 @@ func TestNerdToggle(t *testing.T) {
if ic("settings") != "[:]" {
t.Fatalf("Standard sind Text-Tags, nicht %q", ic("settings"))
}
// Einschalten fragt erst mit einer Probezeile; Nein lässt die Tags.
a.toggleNerdIcons()
if a.modal == nil || a.modal.kind != mConfirm || !strings.Contains(a.modal.body, devNerd[devLinux]) || !strings.Contains(a.modal.body, "Nerd Font") {
t.Fatalf("keine Probe: %+v", a.modal)
}
a.modal = nil
if a.st.Settings().Icons != "" || ic("settings") != "[:]" {
t.Fatal("ohne Ja darf nichts umschalten")
}
a.toggleNerdIcons()
a.modal.onYes()
a.modal = nil
if a.st.Settings().Icons != iconNerd || ic("settings") != "" {
t.Fatalf("Nerd an: %q %q", a.st.Settings().Icons, ic("settings"))
}