Skip to content

Commit 2f18c3a

Browse files
authored
Merge pull request #28 from cyrinux/dev
2 parents f2485f9 + df07d8d commit 2f18c3a

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

Cargo.lock

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/renamer/mod.rs

+21-10
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,25 @@ impl Renamer {
3939
.collect::<FxHashMap<_, _>>();
4040

4141
for client in clients {
42-
let class = client.class;
42+
let class = client.class.to_uppercase();
4343
if class.is_empty() {
4444
continue;
4545
}
4646

47-
let title = client.title;
48-
if self.cfg.lock()?.config.exclude.iter().any(|(c, t)| {
49-
c == &class.to_uppercase() && [title.to_uppercase(), "*".to_string()].contains(t)
50-
}) {
47+
let title = client.title.to_uppercase();
48+
if self
49+
.cfg
50+
.lock()?
51+
.config
52+
.exclude
53+
.iter()
54+
.any(|(c, t)| c == &class && (t == &title || t == "*"))
55+
{
5156
if self.args.verbose {
52-
println!("- window: class '{class}' with title '{title}' is exclude")
57+
println!(
58+
"- window: class '{}' with title '{}' is exclude",
59+
client.class, client.title
60+
)
5361
}
5462
continue;
5563
}
@@ -63,9 +71,12 @@ impl Renamer {
6371
let should_dedup = self.args.dedup && is_dup;
6472

6573
if self.args.verbose && should_dedup {
66-
println!("- window: class '{class}' is duplicate")
74+
println!("- window: class '{}' is duplicate", client.class)
6775
} else if self.args.verbose {
68-
println!("- window: class '{class}', title '{title}', got this icon '{icon}'")
76+
println!(
77+
"- window: class '{}', title '{}', got this icon '{icon}'",
78+
client.class, client.title
79+
)
6980
};
7081

7182
self.workspaces.lock()?.insert(workspace_id);
@@ -156,7 +167,7 @@ impl Renamer {
156167
cfg.config
157168
.icons
158169
.get(class)
159-
.or_else(|| cfg.config.icons.get(class.to_uppercase().as_str()))
170+
.or_else(|| cfg.config.icons.get(class))
160171
.unwrap_or_else(|| {
161172
if self.args.verbose {
162173
println!("- window: class '{class}' need a shiny icon");
@@ -171,7 +182,7 @@ impl Renamer {
171182
let cfg = &self.cfg.lock().expect("Unable to obtain lock for config");
172183
cfg.config.title.get(class).and_then(|x| {
173184
x.iter()
174-
.find(|(k, _)| title.to_uppercase().contains(k.as_str()))
185+
.find(|(k, _)| title.contains(k.as_str()))
175186
.map(|(_, v)| v.to_owned())
176187
})
177188
}

0 commit comments

Comments
 (0)