Skip to content

Commit 18f672f

Browse files
committed
fix: Added option to use "GenericName" or "Comment" to descript app
1 parent 366f3c1 commit 18f672f

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

src/app/mod.rs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -327,21 +327,21 @@ impl App {
327327

328328
text.add(&name);
329329

330-
if app.generic != "" {
331-
let generic = Label::new(Some(&format!("{}", &app.generic)));
330+
if app.description != "" {
331+
let description = Label::new(Some(&format!("{}", &app.description)));
332332

333-
generic
333+
description
334334
.set_halign(Align::Start);
335335

336-
generic
336+
description
337337
.style_context()
338338
.add_provider(provider, gtk::STYLE_PROVIDER_PRIORITY_USER);
339339

340-
generic
340+
description
341341
.style_context()
342-
.add_class("generic");
342+
.add_class("description");
343343

344-
text.add(&generic);
344+
text.add(&description);
345345

346346
} else {
347347
let exec = Label::new(Some(&format!("{}", &app.exec)));
@@ -355,7 +355,7 @@ impl App {
355355

356356
exec
357357
.style_context()
358-
.add_class("generic");
358+
.add_class("description");
359359

360360
text.add(&exec);
361361
}
@@ -406,7 +406,7 @@ impl App {
406406
for file in read_dir(path).expect("Failed to read directory") {
407407
let mut app = crate::utils::types::App {
408408
name: String::from(""),
409-
generic: String::from(""),
409+
description: String::from(""),
410410
exec: String::from(""),
411411
icon: String::from(""),
412412
};
@@ -439,7 +439,13 @@ impl App {
439439
}
440440

441441
if i.starts_with("GenericName=") {
442-
app.generic = i
442+
app.description = i
443+
.split("=")
444+
.collect::<Vec<&str>>()[1]
445+
.to_string();
446+
447+
} else if i.starts_with("Comment=") && app.description == "" {
448+
app.description = i
443449
.split("=")
444450
.collect::<Vec<&str>>()[1]
445451
.to_string();

src/styling/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl Provider {
5252
color: white;
5353
}}
5454
55-
.generic {{
55+
.description {{
5656
font-size: 10pt;
5757
font-weight: 600;
5858
color: #CCC;
@@ -128,7 +128,7 @@ impl Provider {
128128
color: white;
129129
}}
130130
131-
.generic {{
131+
.description {{
132132
font-size: 9pt;
133133
font-weight: 500;
134134
color: #EEE;

src/utils/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use serde::{Serialize, Deserialize};
33
#[derive(Debug, Clone)]
44
pub struct App {
55
pub name: String,
6-
pub generic: String,
6+
pub description: String,
77
pub exec: String,
88
pub icon: String,
99
}

0 commit comments

Comments
 (0)