Terminal-Header: Projekt-Icon vor dem Titel, Pool-Chip zeigt Anzeigenamen statt Pool-ID (neues Command pool_label); project_icon/pool_label im Command-Satz des Terminal-Prozesses registriert

This commit is contained in:
marcus.hinz
2026-07-05 17:02:19 +02:00
parent 63c8062743
commit c5fca165bd
3 changed files with 37 additions and 3 deletions
+11 -2
View File
@@ -1626,6 +1626,12 @@ fn remove_work_dir(project: String, dir: String) -> Result<(), String> {
remove_work_dir_in(&Paths::real(), &project, &dir) remove_work_dir_in(&Paths::real(), &project, &dir)
} }
/// Anzeigename eines Pools (pool.json) — die ID ist der Ordnername.
#[tauri::command]
fn pool_label(pool: String) -> Result<String, String> {
Ok(read_pool(&Paths::real(), &pool)?.name)
}
#[tauri::command] #[tauri::command]
fn todo_state(project: String) -> Result<bool, String> { fn todo_state(project: String) -> Result<bool, String> {
todo_state_in(&Paths::real(), &project) todo_state_in(&Paths::real(), &project)
@@ -1990,6 +1996,7 @@ fn main_builder() -> tauri::Builder<tauri::Wry> {
unassign_pool, unassign_pool,
set_terminal_config, set_terminal_config,
project_icon, project_icon,
pool_label,
todo_state, todo_state,
set_todo, set_todo,
usage_stats, usage_stats,
@@ -2026,8 +2033,10 @@ fn terminal_builder(project: String) -> tauri::Builder<tauri::Wry> {
terminal::term_log, terminal::term_log,
terminal::term_write, terminal::term_write,
terminal::term_resize, terminal::term_resize,
// Pool-Chip im Terminal-Header braucht die Projektliste auch hier. // Header im Terminal-Prozess: Projektliste, Icon und Pool-Name.
list_projects list_projects,
project_icon,
pool_label
]) ])
} }
+17 -1
View File
@@ -396,10 +396,26 @@ interface Project {
} }
const projects = await invoke<Project[]>("list_projects"); const projects = await invoke<Project[]>("list_projects");
const cfg = projects.find((p) => p.name === project); const cfg = projects.find((p) => p.name === project);
if (cfg?.pool) document.getElementById("pool")!.textContent = cfg.pool; if (cfg?.pool) {
// Anzeigename statt Pool-ID (Ordnername).
document.getElementById("pool")!.textContent = await invoke<string>(
"pool_label",
{ pool: cfg.pool },
);
}
document.getElementById("project-name")!.textContent = document.getElementById("project-name")!.textContent =
cfg?.terminal.title ?? project; cfg?.terminal.title ?? project;
// Projekt-Icon vor den Titel — dieselbe data-URL wie in der Projektliste.
if (cfg?.terminal.icon) {
const data = await invoke<string | null>("project_icon", { project });
if (data) {
const img = document.getElementById("project-icon") as HTMLImageElement;
img.src = data;
img.hidden = false;
}
}
const picked = THEMES[cfg?.terminal.theme ?? "mocha"]; const picked = THEMES[cfg?.terminal.theme ?? "mocha"];
const theme = picked.xterm; const theme = picked.xterm;
+9
View File
@@ -34,6 +34,14 @@
-webkit-user-select: none; -webkit-user-select: none;
cursor: default; cursor: default;
} }
#project-icon {
width: 18px;
height: 18px;
border-radius: 4px;
}
#project-icon[hidden] {
display: none;
}
#pool { #pool {
margin-left: auto; margin-left: auto;
background: #313244; background: #313244;
@@ -64,6 +72,7 @@
</head> </head>
<body> <body>
<header data-tauri-drag-region> <header data-tauri-drag-region>
<img id="project-icon" hidden data-tauri-drag-region />
<span id="project-name" data-tauri-drag-region></span> <span id="project-name" data-tauri-drag-region></span>
<span id="pool"></span> <span id="pool"></span>
</header> </header>