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:
+11
-2
@@ -1626,6 +1626,12 @@ fn remove_work_dir(project: String, dir: String) -> Result<(), String> {
|
||||
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]
|
||||
fn todo_state(project: String) -> Result<bool, String> {
|
||||
todo_state_in(&Paths::real(), &project)
|
||||
@@ -1990,6 +1996,7 @@ fn main_builder() -> tauri::Builder<tauri::Wry> {
|
||||
unassign_pool,
|
||||
set_terminal_config,
|
||||
project_icon,
|
||||
pool_label,
|
||||
todo_state,
|
||||
set_todo,
|
||||
usage_stats,
|
||||
@@ -2026,8 +2033,10 @@ fn terminal_builder(project: String) -> tauri::Builder<tauri::Wry> {
|
||||
terminal::term_log,
|
||||
terminal::term_write,
|
||||
terminal::term_resize,
|
||||
// Pool-Chip im Terminal-Header braucht die Projektliste auch hier.
|
||||
list_projects
|
||||
// Header im Terminal-Prozess: Projektliste, Icon und Pool-Name.
|
||||
list_projects,
|
||||
project_icon,
|
||||
pool_label
|
||||
])
|
||||
}
|
||||
|
||||
|
||||
+17
-1
@@ -396,10 +396,26 @@ interface Project {
|
||||
}
|
||||
const projects = await invoke<Project[]>("list_projects");
|
||||
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 =
|
||||
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 theme = picked.xterm;
|
||||
|
||||
|
||||
@@ -34,6 +34,14 @@
|
||||
-webkit-user-select: none;
|
||||
cursor: default;
|
||||
}
|
||||
#project-icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 4px;
|
||||
}
|
||||
#project-icon[hidden] {
|
||||
display: none;
|
||||
}
|
||||
#pool {
|
||||
margin-left: auto;
|
||||
background: #313244;
|
||||
@@ -64,6 +72,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<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="pool"></span>
|
||||
</header>
|
||||
|
||||
Reference in New Issue
Block a user