Commit cced2a4 1 parent d93b6fa commit cced2a4 Copy full SHA for cced2a4
File tree 3 files changed +20
-5
lines changed
3 files changed +20
-5
lines changed Original file line number Diff line number Diff line change @@ -245,8 +245,11 @@ impl Komobar {
245
245
Self :: set_font_size ( ctx, * font_size) ;
246
246
}
247
247
248
- self . render_config
249
- . replace ( config. new_renderconfig ( ctx, * self . bg_color . borrow ( ) ) ) ;
248
+ self . render_config . replace ( config. new_renderconfig (
249
+ ctx,
250
+ * self . bg_color . borrow ( ) ,
251
+ config. icon_scale ,
252
+ ) ) ;
250
253
251
254
let mut komorebi_notification_state = previous_notification_state;
252
255
let mut komorebi_widgets = Vec :: new ( ) ;
Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ pub struct KomobarConfig {
25
25
pub font_family : Option < String > ,
26
26
/// Font size (default: 12.5)
27
27
pub font_size : Option < f32 > ,
28
+ /// Scale of the icons relative to the font_size [[1.0-2.0]]. (default: 1.4)
29
+ pub icon_scale : Option < f32 > ,
28
30
/// Max label width before text truncation (default: 400.0)
29
31
pub max_label_width : Option < f32 > ,
30
32
/// Theme
Original file line number Diff line number Diff line change @@ -56,11 +56,21 @@ pub struct RenderConfig {
56
56
}
57
57
58
58
pub trait RenderExt {
59
- fn new_renderconfig ( & self , ctx : & Context , background_color : Color32 ) -> RenderConfig ;
59
+ fn new_renderconfig (
60
+ & self ,
61
+ ctx : & Context ,
62
+ background_color : Color32 ,
63
+ icon_scale : Option < f32 > ,
64
+ ) -> RenderConfig ;
60
65
}
61
66
62
67
impl RenderExt for & KomobarConfig {
63
- fn new_renderconfig ( & self , ctx : & Context , background_color : Color32 ) -> RenderConfig {
68
+ fn new_renderconfig (
69
+ & self ,
70
+ ctx : & Context ,
71
+ background_color : Color32 ,
72
+ icon_scale : Option < f32 > ,
73
+ ) -> RenderConfig {
64
74
let text_font_id = ctx
65
75
. style ( )
66
76
. text_styles
@@ -69,7 +79,7 @@ impl RenderExt for &KomobarConfig {
69
79
. unwrap_or_else ( FontId :: default) ;
70
80
71
81
let mut icon_font_id = text_font_id. clone ( ) ;
72
- icon_font_id. size *= 1.4 ;
82
+ icon_font_id. size *= icon_scale . unwrap_or ( 1.4 ) . clamp ( 1.0 , 2.0 ) ;
73
83
74
84
RenderConfig {
75
85
monitor_idx : self . monitor . index ,
You can’t perform that action at this time.
0 commit comments