mirror of
https://github.com/db9979/sshtermy.git
synced 2026-12-05 12:24:08 +01:00
* Eigenes Fenster: sshTermy läuft ohne Terminal (Prototyp) Neues Paket internal/gui: Die bubbletea-Oberfläche schreibt in den eingebauten Emulator (termemu), ein Ebiten-Fenster zeichnet das Zellraster mit eingebetteter Cascadia Mono NF (Ersatz DejaVu Sans Mono), Rahmen- und Blockzeichen selbst gezeichnet. Tasten werden als xterm/CSI-u kodiert, so kommen Alt+Enter, ⇧F-Tasten und Strg+Leertaste immer an. Maus, Einfügen, OSC-52-Zwischenablage, Schriftgröße (Strg +/-/0), HiDPI. Start: automatisch ohne Terminal (Doppelklick unter Windows, .app auf dem Mac), -window erzwingt, -tui verhindert. Fenster schließen beendet sauber wie Strg+Q (ui.WindowClosedMsg). Ebiten baut dank purego ohne cgo, die Release-Builds bleiben unverändert. install.sh: .app startet das Fenster. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018i4GUhY2jMdZmccTS8ce6p * Golden-Bilder der Palette: 33 Einstellungen (war schon auf main veraltet) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018i4GUhY2jMdZmccTS8ce6p * Eigenes Fenster: zweites Fenster für ⇧F10, Bilder pixelgenau, Ablegen, Emoji - ⇧F10 im eigenen Fenster öffnet ein zweites eigenes Fenster (sshtermy attach <ordner> -window, detach.Dial/Client, ohne Konsole). - kitty-Bilder mit Platzhaltern zeichnet das Fenster selbst (images.go), ui.EnablePixelImages im Fensterbetrieb. - Dateien ins Fenster ziehen: echte Pfade aus Ebitens DroppedFiles, als eingefügter Text wie in Windows Terminal → Hochladen-Menü (ui/drop.go). - Noto Emoji als zweite Ersatzschrift. - Windows: leere Konsole beim Doppelklick schon in init() verstecken. - Kurzreferenz: Grundschrift 8,6 pt, die deutsche Seite 2 lief über. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018i4GUhY2jMdZmccTS8ce6p --------- Co-authored-by: Claude <noreply@anthropic.com>
75 lines
1.3 KiB
Go
75 lines
1.3 KiB
Go
//go:build windows || darwin || linux
|
|
|
|
package gui
|
|
|
|
import (
|
|
"image/png"
|
|
"os"
|
|
"strconv"
|
|
"strings"
|
|
|
|
"github.com/hajimehoshi/ebiten/v2"
|
|
)
|
|
|
|
// script steuert das Fenster für Bildschirmfotos (Webseite, Doku, Tests):
|
|
// SSHTERMY_GUI_SCRIPT="wait:120;key:ctrl+space;wait:30;shot:/tmp/a.png;quit"
|
|
// wait zählt Ticks (60 je Sekunde).
|
|
type script struct {
|
|
steps []string
|
|
wait int
|
|
shot string
|
|
}
|
|
|
|
func newScript(s string) *script {
|
|
if s == "" {
|
|
return nil
|
|
}
|
|
return &script{steps: strings.Split(s, ";")}
|
|
}
|
|
|
|
func (s *script) step(w *window) {
|
|
if s.wait > 0 {
|
|
s.wait--
|
|
return
|
|
}
|
|
for len(s.steps) > 0 && s.shot == "" {
|
|
st := strings.TrimSpace(s.steps[0])
|
|
s.steps = s.steps[1:]
|
|
cmd, arg, _ := strings.Cut(st, ":")
|
|
switch cmd {
|
|
case "wait":
|
|
s.wait, _ = strconv.Atoi(arg)
|
|
return
|
|
case "key":
|
|
if k, ok := parseKey(arg); ok {
|
|
w.sendOrdered(encodeKey(k))
|
|
}
|
|
case "text":
|
|
w.sendOrdered([]byte(arg))
|
|
case "shot":
|
|
s.shot = arg
|
|
w.forceDraw = true
|
|
return
|
|
case "quit":
|
|
if w.onQuit != nil {
|
|
w.onQuit()
|
|
}
|
|
return
|
|
}
|
|
}
|
|
}
|
|
|
|
func (s *script) afterDraw(screen *ebiten.Image) {
|
|
if s.shot == "" {
|
|
return
|
|
}
|
|
path := s.shot
|
|
s.shot = ""
|
|
f, err := os.Create(path)
|
|
if err != nil {
|
|
return
|
|
}
|
|
defer f.Close()
|
|
_ = png.Encode(f, screen)
|
|
}
|