Skip to content

Commit 1116190

Browse files
committed
Use lucide icons for shortcuts widget
1 parent 3516d35 commit 1116190

5 files changed

Lines changed: 24 additions & 24 deletions

File tree

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ edition = "2024"
2626
# iced
2727
#iced = { version = "0.13.99", features = ["wgpu", "tiny-skia", "web-colors", "tokio", "lazy", "advanced", "image", "svg"] }
2828
iced = { git = "https://github.com/project-gauntlet/iced.git", branch = "gauntlet-0.13.1", features = ["wgpu", "tiny-skia", "web-colors", "tokio", "lazy", "advanced", "image", "svg"] }
29-
#iced_fonts = { version = "0.2.99", features = ["bootstrap"] }
30-
iced_fonts = { git = "https://github.com/project-gauntlet/iced_fonts.git", branch = "gauntlet-0.13.1", features = ["bootstrap"] }
29+
#iced_fonts = { version = "0.2.99", features = ["bootstrap", "lucide"] }
30+
iced_fonts = { git = "https://github.com/project-gauntlet/iced_fonts.git", branch = "gauntlet-0.13.1", features = ["bootstrap", "lucide"] }
3131

3232
# workspaces
3333
gauntlet-common = { path = "./rust/common" }

rust/client/src/ui/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ use iced::widget::text_input::focus;
5656
use iced::widget::themer;
5757
use iced::window;
5858
use iced_fonts::BOOTSTRAP_FONT_BYTES;
59+
use iced_fonts::LUCIDE_FONT_BYTES;
5960

6061
use crate::model::UiViewEvent;
6162
use crate::ui::search_list::search_list;
@@ -300,6 +301,7 @@ pub fn run(minimized: bool, scenario_runner_data: Option<ScenarioRunnerData>) {
300301
..Default::default()
301302
})
302303
.font(BOOTSTRAP_FONT_BYTES)
304+
.font(LUCIDE_FONT_BYTES)
303305
.subscription(subscription)
304306
.theme(|state, _| state.theme.clone())
305307
.run()

rust/client/src/ui/widget/action_panel.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ pub fn render_shortcut<'a, T: 'a>(shortcut: &PhysicalShortcut) -> Element<'a, T>
285285
modifier: Option<Element<'element, T>>,
286286
) {
287287
if let Some(modifier) = modifier {
288-
let modifier: Element<_> = container(modifier).themed(ContainerStyle::ActionShortcutModifier);
288+
let modifier: Element<_> = container(modifier).center_y(Length::Fill).height(22).themed(ContainerStyle::ActionShortcutModifier);
289289

290290
let modifier: Element<_> = container(modifier).themed(ContainerStyle::ActionShortcutModifiersInit);
291291

@@ -298,7 +298,7 @@ pub fn render_shortcut<'a, T: 'a>(shortcut: &PhysicalShortcut) -> Element<'a, T>
298298
apply_modifier(&mut result, shift_modifier_text);
299299
apply_modifier(&mut result, alt_modifier_text);
300300

301-
let key_name: Element<_> = container(key_name).themed(ContainerStyle::ActionShortcutModifier);
301+
let key_name: Element<_> = container(key_name).center_y(Length::Fill).height(22).themed(ContainerStyle::ActionShortcutModifier);
302302

303303
result.push(key_name);
304304

rust/common_ui/src/lib.rs

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ use iced::Pixels;
66
use iced::border::Radius;
77
use iced::keyboard::Modifiers;
88
use iced::widget::text;
9-
use iced_fonts::bootstrap::arrow_return_left;
10-
use iced_fonts::bootstrap::command;
11-
use iced_fonts::bootstrap::option;
12-
use iced_fonts::bootstrap::shift;
9+
use iced_fonts::lucide::arrow_big_up;
10+
use iced_fonts::lucide::chevron_up;
11+
use iced_fonts::lucide::command;
12+
use iced_fonts::lucide::corner_down_left;
13+
use iced_fonts::lucide::option;
1314

1415
pub fn padding(
1516
top: impl Into<Pixels>,
@@ -50,65 +51,63 @@ pub fn shortcut_to_text<'a, Message, Theme: text::Catalog + 'a>(
5051
let (key_name, show_shift) = match shortcut.physical_key {
5152
PhysicalKey::Enter => {
5253
let key_name = if cfg!(target_os = "macos") {
53-
arrow_return_left().into()
54+
corner_down_left().size(14).into()
5455
} else {
55-
text("Enter").into()
56+
text("Enter").size(15).into()
5657
};
5758

5859
(key_name, shortcut.modifier_shift)
5960
}
6061
_ => {
6162
let (key_name, show_shift) = physical_key_name(&shortcut.physical_key, shortcut.modifier_shift);
6263

63-
let key_name: Element<_, _> = text(key_name).into();
64+
let key_name: Element<_, _> = text(key_name).size(15).into();
6465

6566
(key_name, show_shift)
6667
}
6768
};
6869

6970
let alt_modifier_text = if shortcut.modifier_alt {
7071
if cfg!(target_os = "macos") {
71-
Some(option().into())
72+
Some(option().size(15).into())
7273
} else {
73-
Some(text("Alt").into())
74+
Some(text("Alt").size(15).into())
7475
}
7576
} else {
7677
None
7778
};
7879

7980
let meta_modifier_text = if shortcut.modifier_meta {
8081
if cfg!(target_os = "macos") {
81-
Some(command().into())
82+
Some(command().size(13).into())
8283
} else if cfg!(target_os = "windows") {
8384
Some(
8485
text("Win") // is it possible to have shortcuts that use win?
86+
.size(15)
8587
.into(),
8688
)
8789
} else {
88-
Some(text("Super").into())
90+
Some(text("Super").size(15).into())
8991
}
9092
} else {
9193
None
9294
};
9395

9496
let control_modifier_text = if shortcut.modifier_control {
9597
if cfg!(target_os = "macos") {
96-
Some(
97-
text("^") // TODO bootstrap doesn't have proper macos ctrl icon
98-
.into(),
99-
)
98+
Some(chevron_up().size(15).into())
10099
} else {
101-
Some(text("Ctrl").into())
100+
Some(text("Ctrl").size(15).into())
102101
}
103102
} else {
104103
None
105104
};
106105

107106
let shift_modifier_text = if show_shift && shortcut.modifier_shift {
108107
if cfg!(target_os = "macos") {
109-
Some(shift().into())
108+
Some(arrow_big_up().size(17).into())
110109
} else {
111-
Some(text("Shift").into())
110+
Some(text("Shift").size(15).into())
112111
}
113112
} else {
114113
None

rust/server/src/plugins/js.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
use std::collections::HashMap;
22
use std::fs::File;
33
use std::sync::Arc;
4-
use std::time::Duration;
54
use std::vec;
65

76
use anyhow::Context;
@@ -1236,7 +1235,7 @@ async fn show_linux_native_hud(display: String) -> anyhow::Result<()> {
12361235
proxy.add_notification(notification_id, notification).await?;
12371236

12381237
tokio::spawn(async move {
1239-
tokio::time::sleep(Duration::from_secs(2)).await;
1238+
tokio::time::sleep(std::time::Duration::from_secs(2)).await;
12401239
let _ = proxy.remove_notification(notification_id).await;
12411240
});
12421241

0 commit comments

Comments
 (0)