1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-17 14:51:04 +02:00

feat(launcher): icon overrides

This commit is contained in:
BowDown097 2025-01-10 19:52:30 -08:00
parent b296726aa4
commit 87c680122b
3 changed files with 50 additions and 7 deletions

View file

@ -24,16 +24,23 @@ pub struct Item {
pub open_state: OpenState,
pub windows: IndexMap<usize, Window>,
pub name: String,
pub icon_override: String,
}
impl Item {
pub fn new(app_id: String, open_state: OpenState, favorite: bool) -> Self {
pub fn new(
app_id: String,
icon_override: String,
open_state: OpenState,
favorite: bool,
) -> Self {
Self {
app_id,
favorite,
open_state,
windows: IndexMap::new(),
name: String::new(),
icon_override,
}
}
@ -108,6 +115,7 @@ impl From<ToplevelInfo> for Item {
open_state,
windows,
name,
icon_override: String::new(),
}
}
}
@ -167,7 +175,9 @@ impl ItemButton {
}
if appearance.show_icons {
let input = if item.app_id.is_empty() {
let input = if !item.icon_override.is_empty() {
item.icon_override.clone()
} else if item.app_id.is_empty() {
item.name.clone()
} else {
item.app_id.clone()