Skip to content

Commit

Permalink
feat: show exec in launcher
Browse files Browse the repository at this point in the history
Signed-off-by: Enrico Stemmer <[email protected]>
  • Loading branch information
H3rmt committed Jan 18, 2025
1 parent 16f7be1 commit 09b4688
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/daemon/gui/launcher/launcher.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
padding-left: 12px;
}

.launcher-exec {
font-size: 12px;
}

.launcher-list {
margin-left: 2px;
margin-right: 2px;
Expand Down
18 changes: 17 additions & 1 deletion src/daemon/gui/launcher/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::{Exec, GUISend, ReverseKey, Share, UpdateCause, Warn};
use anyhow::Context;
use gtk4::gdk::Key;
use gtk4::glib::{clone, Propagation};
use gtk4::pango::EllipsizeMode;
use gtk4::prelude::{BoxExt, EditableExt, GtkWindowExt, WidgetExt};
use gtk4::{
gio, glib, Align, Application, ApplicationWindow, Entry, EventControllerKey, IconSize, Image,
Expand Down Expand Up @@ -140,6 +141,7 @@ pub(super) fn update_launcher(
let widget = create_launch_widget(
name,
icon,
exec,
&match reverse_key {
ReverseKey::Mod(m) => match i {
0 => "Return".to_string(),
Expand Down Expand Up @@ -175,6 +177,7 @@ pub(super) fn update_launcher(
fn create_launch_widget(
name: &str,
icon_path: &Option<Box<Path>>,
exec: &str,
index: &str,
selected: bool,
) -> ListBoxRow {
Expand All @@ -195,11 +198,24 @@ fn create_launch_widget(
let title = Label::builder()
.halign(Align::Start)
.valign(Align::Center)
.hexpand(true)
.label(name)
.build();
hbox.append(&title);

let exec = Label::builder()
.halign(Align::Start)
.valign(Align::Center)
.hexpand(true)
.css_classes(vec!["launcher-exec"])
.ellipsize(EllipsizeMode::End)
.label(if exec.contains("flatpak run") {
"(flatpak)".to_string()
} else {
format!("({})", exec)
})
.build();
hbox.append(&exec);

let index = Label::builder()
.halign(Align::End)
.valign(Align::Center)
Expand Down

0 comments on commit 09b4688

Please sign in to comment.