diff --git a/.claude/.fuse_hidden00000a0e00000051 b/.claude/.fuse_hidden00000a0e00000051 new file mode 100644 index 0000000..1ee8bdc --- /dev/null +++ b/.claude/.fuse_hidden00000a0e00000051 @@ -0,0 +1,14 @@ +{ + "permissions": { + "allow": [ + "Bash(find /mnt/storage/code/rust/mcl -maxdepth 2 -name README* -o -name CLAUDE.md -o -name *.md)", + "Bash(cargo test:*)", + "Bash(git add:*)", + "Bash(git commit:*)", + "Bash(cargo clippy:*)", + "Bash(/home/consti/.claude/plugins/cache/claude-plugins-official/superpowers/5.0.6/scripts/start-server.sh --project-dir /mnt/storage/code/rust/mcl 2>&1)", + "Bash(/home/consti/.claude/plugins/cache/claude-plugins-official/superpowers/5.0.6/skills/brainstorming/scripts/start-server.sh --project-dir /mnt/storage/code/rust/mcl 2>&1)", + "Bash(cargo build:*)" + ] + } +} diff --git a/assets/icon.png b/assets/icon.png new file mode 100644 index 0000000..8ab1445 Binary files /dev/null and b/assets/icon.png differ diff --git a/assets/theme.toml b/assets/theme.toml index 8b38b13..ac34435 100644 --- a/assets/theme.toml +++ b/assets/theme.toml @@ -73,6 +73,7 @@ selected_bold = true row_alt_bg = "surface" running_fg = "success" text_fg = "fg" +label_fg = "muted" [log_overlay] bg = "bg" diff --git a/src/instance/desktop.rs b/src/instance/desktop.rs index 3e3aafe..e8cddb5 100644 --- a/src/instance/desktop.rs +++ b/src/instance/desktop.rs @@ -2,6 +2,8 @@ use std::path::{Path, PathBuf}; use crate::instance::models::InstanceConfig; +const ICON_BYTES: &[u8] = include_bytes!("../../assets/icon.png"); + pub fn desktop_path(name: &str) -> Option { dirs_next::data_dir().map(|d| { d.join("applications") @@ -13,6 +15,23 @@ pub fn icon_path() -> Option { dirs_next::data_dir().map(|d| d.join("mcl").join("icon.png")) } +fn ensure_icon() -> Option { + let path = icon_path()?; + if path.exists() { + return Some(path); + } + let parent = path.parent()?; + if let Err(e) = std::fs::create_dir_all(parent) { + tracing::warn!("Failed to create icon directory: {}", e); + return None; + } + if let Err(e) = std::fs::write(&path, ICON_BYTES) { + tracing::warn!("Failed to write bundled icon: {}", e); + return None; + } + Some(path) +} + pub fn exists(name: &str) -> bool { desktop_path(name).map(|p| p.exists()).unwrap_or(false) } @@ -25,7 +44,7 @@ pub fn create(config: &InstanceConfig) -> std::io::Result { std::fs::create_dir_all(parent)?; } - let icon = icon_path().filter(|p| p.exists()); + let icon = ensure_icon(); let content = build_content(&config.name, icon.as_deref()); std::fs::write(&path, content)?; Ok(path) diff --git a/src/tui/layout.rs b/src/tui/layout.rs index 6c6308c..83b68d7 100644 --- a/src/tui/layout.rs +++ b/src/tui/layout.rs @@ -421,8 +421,27 @@ impl App { } widgets::details::SettingsAction::ToggleDesktop => { if let Some(inst) = self.profiles_state.selected_instance() { - if let Err(e) = crate::instance::desktop::toggle(inst) { - tracing::error!("Failed to toggle desktop shortcut: {}", e); + let name = inst.name.clone(); + match crate::instance::desktop::toggle(inst) { + Ok(true) => { + error_buffer::push_error(error_buffer::ErrorEvent { + id: 0, + level: tracing::Level::INFO, + message: format!("Desktop shortcut created for '{name}'"), + pushed_at: std::time::Instant::now(), + }); + } + Ok(false) => { + error_buffer::push_error(error_buffer::ErrorEvent { + id: 0, + level: tracing::Level::INFO, + message: format!("Desktop shortcut removed for '{name}'"), + pushed_at: std::time::Instant::now(), + }); + } + Err(e) => { + tracing::error!("Failed to toggle desktop shortcut: {}", e); + } } } return Ok(()); diff --git a/src/tui/widgets/details.rs b/src/tui/widgets/details.rs index f8c8b0e..69c5897 100644 --- a/src/tui/widgets/details.rs +++ b/src/tui/widgets/details.rs @@ -36,7 +36,7 @@ pub fn render( &[ ("e", " edit instance"), ("g", " edit global"), - ("d", " desktop shortcut"), + ("d", " desktop"), ], area.width.saturating_sub(2), );