diff --git a/Makefile b/Makefile index b8ea694..892cf74 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ PKG := github.com/db9979/sshtermy/internal/version LDFLAGS := -s -w -X $(PKG).Version=$(VERSION) -X $(PKG).Commit=$(COMMIT) -X $(PKG).Date=$(DATE) -X $(PKG).UpdatePubKey=$(UPDATE_PUBKEY) TARGETS := windows/arm64 windows/386 windows/amd64 darwin/arm64 darwin/amd64 linux/amd64 linux/arm64 linux/arm linux/riscv64 -.PHONY: build test bench loadtest dist clean run golden handout fuzz vuln +.PHONY: build test bench loadtest dist clean run golden handout fuzz vuln icon build: CGO_ENABLED=0 go build -trimpath -ldflags "$(LDFLAGS)" -o bin/sshtermy ./cmd/sshtermy @@ -40,6 +40,13 @@ handout: node tools/handout/render.mjs HANDOUT_STAMP=1 go test ./internal/ui -run TestHandoutKeysCurrent -count=1 +# App-Icon neu erzeugen (assets/icon, site/*.png, Windows-.syso), braucht Python+Pillow und Node+Playwright +icon: + python3 tools/icon/gen.py + node tools/icon/render.mjs + python3 tools/icon/pack.py + go run ./tools/icon/winres + dist: test @mkdir -p dist @for t in $(TARGETS); do \ diff --git a/README.de.md b/README.de.md index a650ef5..d3bf3bb 100644 --- a/README.de.md +++ b/README.de.md @@ -1,4 +1,4 @@ -# sshTermy +# sshTermy-Icon sshTermy 🇬🇧 [English version](README.md) · 🇩🇪 Deutsch diff --git a/README.md b/README.md index dd4e30a..fc29a80 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# sshTermy +# sshTermy icon sshTermy 🇬🇧 English · 🇩🇪 [Deutsche Version](README.de.md) diff --git a/assets/icon/icns_darwin.go b/assets/icon/icns_darwin.go new file mode 100644 index 0000000..5b63c5a --- /dev/null +++ b/assets/icon/icns_darwin.go @@ -0,0 +1,10 @@ +// Package icon enthält das App-Icon für die macOS-App (sshTermy.app). +// Quelle und Neuerzeugung: tools/icon (make icon). +package icon + +import _ "embed" + +// ICNS ist das Mac-Icon, das sshTermy beim Start in seine .app legt. +// +//go:embed sshtermy.icns +var ICNS []byte diff --git a/assets/icon/mac-1024.png b/assets/icon/mac-1024.png new file mode 100644 index 0000000..8b7d58f Binary files /dev/null and b/assets/icon/mac-1024.png differ diff --git a/assets/icon/sshtermy-1024.png b/assets/icon/sshtermy-1024.png new file mode 100644 index 0000000..1dc0d62 Binary files /dev/null and b/assets/icon/sshtermy-1024.png differ diff --git a/assets/icon/sshtermy-128.png b/assets/icon/sshtermy-128.png new file mode 100644 index 0000000..c8de902 Binary files /dev/null and b/assets/icon/sshtermy-128.png differ diff --git a/assets/icon/sshtermy-16.png b/assets/icon/sshtermy-16.png new file mode 100644 index 0000000..5e4e8b2 Binary files /dev/null and b/assets/icon/sshtermy-16.png differ diff --git a/assets/icon/sshtermy-24.png b/assets/icon/sshtermy-24.png new file mode 100644 index 0000000..46d97d0 Binary files /dev/null and b/assets/icon/sshtermy-24.png differ diff --git a/assets/icon/sshtermy-256.png b/assets/icon/sshtermy-256.png new file mode 100644 index 0000000..4b4c320 Binary files /dev/null and b/assets/icon/sshtermy-256.png differ diff --git a/assets/icon/sshtermy-32.png b/assets/icon/sshtermy-32.png new file mode 100644 index 0000000..2652cf5 Binary files /dev/null and b/assets/icon/sshtermy-32.png differ diff --git a/assets/icon/sshtermy-48.png b/assets/icon/sshtermy-48.png new file mode 100644 index 0000000..5cb68fc Binary files /dev/null and b/assets/icon/sshtermy-48.png differ diff --git a/assets/icon/sshtermy-512.png b/assets/icon/sshtermy-512.png new file mode 100644 index 0000000..497eb7c Binary files /dev/null and b/assets/icon/sshtermy-512.png differ diff --git a/assets/icon/sshtermy-64.png b/assets/icon/sshtermy-64.png new file mode 100644 index 0000000..dc6d1d4 Binary files /dev/null and b/assets/icon/sshtermy-64.png differ diff --git a/assets/icon/sshtermy-full.svg b/assets/icon/sshtermy-full.svg new file mode 100644 index 0000000..bf94c04 --- /dev/null +++ b/assets/icon/sshtermy-full.svg @@ -0,0 +1,6 @@ + + + + + +#701ツ10ツ>01##1>#0テ1>77テ0#0>0ツア_#アテ_ツ7アテ7>$1ツ1テ0シ7ツ#$シ$_>ア>1テ_$シ_テ11ツ#$アシ#071ツテ$$テシテシ11_710_7テ7シ_#$0シ$アテ diff --git a/assets/icon/sshtermy-small.svg b/assets/icon/sshtermy-small.svg new file mode 100644 index 0000000..07c0c93 --- /dev/null +++ b/assets/icon/sshtermy-small.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/assets/icon/sshtermy.icns b/assets/icon/sshtermy.icns new file mode 100644 index 0000000..c7402ee Binary files /dev/null and b/assets/icon/sshtermy.icns differ diff --git a/assets/icon/sshtermy.ico b/assets/icon/sshtermy.ico new file mode 100644 index 0000000..00f5712 Binary files /dev/null and b/assets/icon/sshtermy.ico differ diff --git a/assets/icon/sshtermy.svg b/assets/icon/sshtermy.svg new file mode 100644 index 0000000..c6be511 --- /dev/null +++ b/assets/icon/sshtermy.svg @@ -0,0 +1,6 @@ + + + + + +#701ツ10ツ>01##1>#0テ1>77テ0#0>0ツア_#アテ_ツ7アテ7>$1ツ1テ0シ7ツ#$シ$_>ア>1テ_$シ_テ11ツ#$アシ#071ツテ$$テシテシ11_710_7テ7シ_#$0シ$アテ diff --git a/cmd/sshtermy/macicon.go b/cmd/sshtermy/macicon.go new file mode 100644 index 0000000..85a29ea --- /dev/null +++ b/cmd/sshtermy/macicon.go @@ -0,0 +1,43 @@ +package main + +import ( + "bytes" + "os" + "path/filepath" + "strings" + "time" +) + +// installMacIcon legt icns nach .app/Contents/Resources/sshtermy.icns und +// trägt CFBundleIconFile in Info.plist ein, wenn exe in einer .app liegt +// (install.sh: Contents/Resources/sshtermy). Meldet, ob sich etwas geändert hat. +func installMacIcon(exe string, icns []byte) bool { + if r, err := filepath.EvalSymlinks(exe); err == nil { + exe = r + } + res := filepath.Dir(exe) + contents := filepath.Dir(res) + app := filepath.Dir(contents) + if filepath.Base(res) != "Resources" || filepath.Base(contents) != "Contents" || !strings.HasSuffix(app, ".app") { + return false + } + changed := false + dst := filepath.Join(res, "sshtermy.icns") + if old, err := os.ReadFile(dst); err != nil || !bytes.Equal(old, icns) { + if os.WriteFile(dst, icns, 0o644) == nil { + changed = true + } + } + plist := filepath.Join(contents, "Info.plist") + if b, err := os.ReadFile(plist); err == nil && !bytes.Contains(b, []byte("CFBundleIconFile")) { + s := strings.Replace(string(b), "", "\tCFBundleIconFilesshtermy\n", 1) + if os.WriteFile(plist, []byte(s), 0o644) == nil { + changed = true + } + } + if changed { // Finder liest das Icon neu, wenn sich die App ändert + now := time.Now() + os.Chtimes(app, now, now) + } + return changed +} diff --git a/cmd/sshtermy/macicon_darwin.go b/cmd/sshtermy/macicon_darwin.go new file mode 100644 index 0000000..b8b081b --- /dev/null +++ b/cmd/sshtermy/macicon_darwin.go @@ -0,0 +1,16 @@ +package main + +import ( + "os" + + "github.com/db9979/sshtermy/assets/icon" +) + +// fixMacAppIcon gibt einer per install.sh angelegten sshTermy.app ihr Icon, +// auch wenn sie vor dem Icon installiert wurde (Auto-Update tauscht nur die +// Programmdatei). Fehler sind egal: dann bleibt das Standard-Icon. +func fixMacAppIcon() { + if exe, err := os.Executable(); err == nil { + installMacIcon(exe, icon.ICNS) + } +} diff --git a/cmd/sshtermy/macicon_other.go b/cmd/sshtermy/macicon_other.go new file mode 100644 index 0000000..52c5ba3 --- /dev/null +++ b/cmd/sshtermy/macicon_other.go @@ -0,0 +1,5 @@ +//go:build !darwin + +package main + +func fixMacAppIcon() {} diff --git a/cmd/sshtermy/macicon_test.go b/cmd/sshtermy/macicon_test.go new file mode 100644 index 0000000..b9696a3 --- /dev/null +++ b/cmd/sshtermy/macicon_test.go @@ -0,0 +1,44 @@ +package main + +import ( + "os" + "path/filepath" + "strings" + "testing" +) + +func TestInstallMacIcon(t *testing.T) { + d := t.TempDir() + c := filepath.Join(d, "sshTermy.app", "Contents") + res := filepath.Join(c, "Resources") + if err := os.MkdirAll(res, 0o755); err != nil { + t.Fatal(err) + } + exe := filepath.Join(res, "sshtermy") + os.WriteFile(exe, nil, 0o755) + plist := "\n\n\tCFBundleNamesshTermy\n\n\n" + os.WriteFile(filepath.Join(c, "Info.plist"), []byte(plist), 0o644) + + if !installMacIcon(exe, []byte("ICNS")) { + t.Fatal("erster Aufruf soll das Icon eintragen") + } + if b, _ := os.ReadFile(filepath.Join(res, "sshtermy.icns")); string(b) != "ICNS" { + t.Fatalf("icns = %q", b) + } + b, _ := os.ReadFile(filepath.Join(c, "Info.plist")) + if strings.Count(string(b), "CFBundleIconFile") != 1 || !strings.Contains(string(b), "sshtermy\n") { + t.Fatalf("Info.plist:\n%s", b) + } + if installMacIcon(exe, []byte("ICNS")) { + t.Fatal("zweiter Aufruf soll nichts ändern") + } + if !installMacIcon(exe, []byte("NEU")) { + t.Fatal("neues Icon nach Update soll geschrieben werden") + } + + // außerhalb einer .app: nichts anfassen + other := filepath.Join(d, "bin", "sshtermy") + if installMacIcon(other, []byte("ICNS")) { + t.Fatal("ohne .app darf nichts passieren") + } +} diff --git a/cmd/sshtermy/main.go b/cmd/sshtermy/main.go index 29f795f..7b806fc 100644 --- a/cmd/sshtermy/main.go +++ b/cmd/sshtermy/main.go @@ -82,6 +82,7 @@ func main() { forceTUI := flag.Bool("tui", false, i18n.T("im Terminal starten, auch ohne Terminal kein eigenes Fenster öffnen")) crashTest := flag.String("crash-test", "", i18n.T("nur zum Ausprobieren des Absturzberichts: ui, cmd oder fatal")) flag.Parse() + fixMacAppIcon() // auch bei -version: so legt install.sh das Icon in die .app if *showVersion { fmt.Println(version.Long()) diff --git a/cmd/sshtermy/rsrc_windows_386.syso b/cmd/sshtermy/rsrc_windows_386.syso new file mode 100644 index 0000000..8e062c1 Binary files /dev/null and b/cmd/sshtermy/rsrc_windows_386.syso differ diff --git a/cmd/sshtermy/rsrc_windows_amd64.syso b/cmd/sshtermy/rsrc_windows_amd64.syso new file mode 100644 index 0000000..e6b12d8 Binary files /dev/null and b/cmd/sshtermy/rsrc_windows_amd64.syso differ diff --git a/cmd/sshtermy/rsrc_windows_arm64.syso b/cmd/sshtermy/rsrc_windows_arm64.syso new file mode 100644 index 0000000..3d15a77 Binary files /dev/null and b/cmd/sshtermy/rsrc_windows_arm64.syso differ diff --git a/install.sh b/install.sh index 3b43dad..a21e4ce 100755 --- a/install.sh +++ b/install.sh @@ -79,6 +79,7 @@ EOF CFBundleDisplayNamesshTermy CFBundleIdentifiercom.github.db9979.sshtermy CFBundleExecutablesshTermy + CFBundleIconFilesshtermy CFBundlePackageTypeAPPL CFBundleShortVersionString1.0 LSMinimumSystemVersion11.0 @@ -86,6 +87,8 @@ EOF EOF + # Das Programm legt sein Icon selbst nach Resources/sshtermy.icns. + "$bin" -version >/dev/null 2>&1 || true xattr -dr com.apple.quarantine "$app" 2>/dev/null || true # Finder/Launchpad sollen die neue App gleich sehen. /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -f "$app" >/dev/null 2>&1 || true diff --git a/packaging/deb.sh b/packaging/deb.sh index 34937be..b265573 100755 --- a/packaging/deb.sh +++ b/packaging/deb.sh @@ -10,6 +10,25 @@ trap 'rm -rf "$root"' EXIT INT TERM chmod 755 "$root" install -Dm755 "$bin" "$root/usr/bin/sshtermy" install -d "$root/usr/share/doc/sshtermy" "$root/DEBIAN" +# Icon + Startmenü-Eintrag (öffnet sshTermy im Standard-Terminal) +icons="$(dirname "$0")/../assets/icon" +for s in 16 24 32 48 64 128 256 512; do + install -Dm644 "$icons/sshtermy-$s.png" "$root/usr/share/icons/hicolor/${s}x$s/apps/sshtermy.png" +done +install -d "$root/usr/share/applications" +cat >"$root/usr/share/applications/sshtermy.desktop" <<'TXT' +[Desktop Entry] +Type=Application +Name=sshTermy +GenericName=SSH Terminal +Comment=SSH terminal with an AI copilot +Comment[de]=SSH-Terminal mit KI-Kopilot +Exec=sshtermy +Icon=sshtermy +Terminal=true +Categories=Network;RemoteAccess; +Keywords=ssh;sftp;telnet;serial;terminal; +TXT cat >"$root/usr/share/doc/sshtermy/copyright" <<'TXT' sshTermy – SSH terminal with an AI copilot Idea: Dominik Bornhäußer diff --git a/site/apple-touch-icon.png b/site/apple-touch-icon.png new file mode 100644 index 0000000..b09df81 Binary files /dev/null and b/site/apple-touch-icon.png differ diff --git a/site/de/handbuch.html b/site/de/handbuch.html index 619a889..2a29108 100644 --- a/site/de/handbuch.html +++ b/site/de/handbuch.html @@ -7,12 +7,13 @@ - + +
- +