Extract and apply StartupWMClass for proper taskbar icons
Parse StartupWMClass from embedded .desktop entries during analysis, store in DB, include in generated .desktop files. Detail view shows an editable WM class field with apply button for manual override.
This commit is contained in:
@@ -133,6 +133,11 @@ pub fn run_background_analysis(id: i64, path: PathBuf, appimage_type: AppImageTy
|
||||
Some(meta.screenshot_urls.join("\n"))
|
||||
};
|
||||
|
||||
// Store StartupWMClass
|
||||
if let Some(ref wm_class) = meta.startup_wm_class {
|
||||
db.set_startup_wm_class(id, Some(wm_class)).ok();
|
||||
}
|
||||
|
||||
if let Err(e) = db.update_appstream_metadata(
|
||||
id,
|
||||
meta.appstream_id.as_deref(),
|
||||
|
||||
@@ -1754,6 +1754,14 @@ impl Database {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn set_startup_wm_class(&self, id: i64, wm_class: Option<&str>) -> SqlResult<()> {
|
||||
self.conn.execute(
|
||||
"UPDATE appimages SET startup_wm_class = ?2 WHERE id = ?1",
|
||||
params![id, wm_class],
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// --- Launch statistics ---
|
||||
|
||||
pub fn get_top_launched(&self, limit: i32) -> SqlResult<Vec<(String, u64)>> {
|
||||
|
||||
@@ -61,6 +61,7 @@ pub struct AppImageMetadata {
|
||||
pub desktop_actions: Vec<String>,
|
||||
pub has_signature: bool,
|
||||
pub screenshot_urls: Vec<String>,
|
||||
pub startup_wm_class: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
@@ -76,6 +77,7 @@ struct DesktopEntryFields {
|
||||
mime_types: Vec<String>,
|
||||
terminal: bool,
|
||||
x_appimage_name: Option<String>,
|
||||
startup_wm_class: Option<String>,
|
||||
actions: Vec<String>,
|
||||
}
|
||||
|
||||
@@ -367,6 +369,7 @@ fn parse_desktop_entry(content: &str) -> DesktopEntryFields {
|
||||
}
|
||||
"Terminal" => fields.terminal = value == "true",
|
||||
"X-AppImage-Name" => fields.x_appimage_name = Some(value.to_string()),
|
||||
"StartupWMClass" => fields.startup_wm_class = Some(value.to_string()),
|
||||
"Actions" => {
|
||||
fields.actions = value
|
||||
.split(';')
|
||||
@@ -814,6 +817,7 @@ pub fn inspect_appimage(
|
||||
.as_ref()
|
||||
.map(|a| a.screenshot_urls.clone())
|
||||
.unwrap_or_default(),
|
||||
startup_wm_class: fields.startup_wm_class,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user