Skip to content

Commit

Permalink
Fix no_names and default icon
Browse files Browse the repository at this point in the history
Remove display name when default icon is configured and no_names is set
to true. Fixes #17
  • Loading branch information
roosta committed Feb 2, 2021
1 parent 4868c64 commit 23ace5c
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,18 +129,28 @@ fn get_class(conn: &xcb::Connection, id: u32, config: &Config) -> Result<String,
class
};

let no_names = get_option(&config, "no_names");

// Format final result
Ok(match config.icons.get(name) {
Some(icon) => {
if get_option(&config, "no_names") {
if no_names {
format!("{}", icon)
} else {
format!("{} {}", icon, display_name)
}
}
None => match config.general.get("default_icon") {
Some(default_icon) => format!("{} {}", default_icon, display_name),
None => format!("{}", display_name),
Some(default_icon) => {
if no_names {
format!("{}", default_icon)
} else {
format!("{} {}", default_icon, display_name)
}
}
None => {
format!("{}", display_name)
}
},
})
}
Expand Down

0 comments on commit 23ace5c

Please sign in to comment.