Terminal-Config (Theme/Icon/Titel), UI-Überarbeitung, i18n de/en
- Terminal-Einstellungen pro Projekt in ai-control.json: 5 Themes (Paletten in terminal.ts, Fenster-BG gespiegelt in terminal.rs), Dock-Icon (PNG/ICNS via NSApplication in RunEvent::Ready), Fenstertitel mit Fallback Projektname; Zahnrad-Dialog mit Datei-Picker (tauri-plugin-dialog) - UI: Catppuccin-Mocha-Token, JetBrains Mono für Namen/Pfade/Chips, feste Tabellenspalten, Status-Punkt mit Glow, Pool-Projekte als Hover-Popover, Buttons ausgerichtet (Zahnrad links von Starten/Beenden) - i18n: vue-i18n, Deutsch/Englisch, Umschalter im Header (localStorage) - generate_context nur noch einmal expandiert (Release-Build-Fehler)
This commit is contained in:
@@ -34,19 +34,52 @@ pub fn open_terminal(project: String) -> Result<(), String> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Fenster-Hintergrund je Theme — muss zu den Theme-Definitionen in
|
||||
/// terminal.ts passen, sonst blitzt beim Öffnen die falsche Farbe auf.
|
||||
fn theme_background(theme: &str) -> (u8, u8, u8) {
|
||||
match theme {
|
||||
"dracula" => (0x28, 0x2a, 0x36),
|
||||
"solarized-dark" => (0x00, 0x2b, 0x36),
|
||||
"gruvbox" => (0x28, 0x28, 0x28),
|
||||
"one-dark" => (0x28, 0x2c, 0x34),
|
||||
_ => (0x1e, 0x1e, 0x2e), // Catppuccin Mocha
|
||||
}
|
||||
}
|
||||
|
||||
/// Setzt das Dock-Icon dieses Terminal-Prozesses aus einer PNG/ICNS-Datei.
|
||||
#[cfg(target_os = "macos")]
|
||||
pub fn set_dock_icon(path: &str) {
|
||||
use objc2::{AnyThread, MainThreadMarker};
|
||||
use objc2_app_kit::{NSApplication, NSImage};
|
||||
use objc2_foundation::NSString;
|
||||
|
||||
let mtm = MainThreadMarker::new().expect("set_dock_icon läuft nicht auf dem Main-Thread");
|
||||
let img = NSImage::initWithContentsOfFile(NSImage::alloc(), &NSString::from_str(path))
|
||||
.unwrap_or_else(|| panic!("Dock-Icon nicht ladbar: {path}"));
|
||||
// unsafe laut objc2-Signatur; das NSImage stammt aus einer Datei und ist gültig.
|
||||
unsafe {
|
||||
NSApplication::sharedApplication(mtm).setApplicationIconImage(Some(&img));
|
||||
}
|
||||
}
|
||||
|
||||
/// Baut das Terminal-Fenster des Terminal-Prozesses. Die PTY entsteht erst,
|
||||
/// wenn das Fenster geladen ist und `term_start` ruft — so gehen keine
|
||||
/// Ausgaben verloren, bevor der Event-Listener steht.
|
||||
pub fn build_window(app: &AppHandle, project: &str) -> tauri::Result<()> {
|
||||
pub fn build_window(
|
||||
app: &AppHandle,
|
||||
project: &str,
|
||||
cfg: &crate::TerminalConfig,
|
||||
) -> tauri::Result<()> {
|
||||
let (r, g, b) = theme_background(cfg.theme.as_deref().unwrap_or_default());
|
||||
let title = cfg.title.as_deref().unwrap_or(project);
|
||||
let builder = WebviewWindowBuilder::new(
|
||||
app,
|
||||
format!("term-{project}"),
|
||||
WebviewUrl::App(format!("terminal.html?project={project}").into()),
|
||||
)
|
||||
.title(format!("{project} — Session"))
|
||||
.title(format!("{title} — Session"))
|
||||
.inner_size(980.0, 640.0)
|
||||
// Theme-Hintergrund (Catppuccin Mocha), sonst blitzt beim Öffnen Weiß auf.
|
||||
.background_color(tauri::window::Color(0x1e, 0x1e, 0x2e, 0xff));
|
||||
.background_color(tauri::window::Color(r, g, b, 0xff));
|
||||
|
||||
// Titelbar liegt über dem Inhalt; der Header in terminal.html ist Drag-Region.
|
||||
#[cfg(target_os = "macos")]
|
||||
|
||||
Reference in New Issue
Block a user