Added capslock functionality
Added keyboard layout func
This commit is contained in:
+20
-1
@@ -21,7 +21,7 @@ pub struct Renderer {
|
||||
password_display: String,
|
||||
uptime_cache: String,
|
||||
last_uptime_update: Option<Instant>,
|
||||
caps_lock: bool,
|
||||
pub caps_lock: bool,
|
||||
pub system_status: SystemStatus,
|
||||
media_art_surface: Option<ImageSurface>,
|
||||
last_art_url: Option<String>,
|
||||
@@ -230,6 +230,10 @@ impl Renderer {
|
||||
self.draw_bluetooth();
|
||||
}
|
||||
|
||||
if self.config.show_keyboard_layout {
|
||||
self.draw_keyboard_layout();
|
||||
}
|
||||
|
||||
if !self.password_display.is_empty() {
|
||||
self.draw_password_display();
|
||||
}
|
||||
@@ -703,6 +707,21 @@ impl Renderer {
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_keyboard_layout(&self) {
|
||||
if let Some(layout) = self.system_status.keyboard_layout {
|
||||
let margin = 20.0;
|
||||
let x = margin;
|
||||
let y = margin + 80.0;
|
||||
|
||||
self.context.new_path();
|
||||
self.context.set_source_rgba(1.0, 1.0, 1.0, self.fade_alpha);
|
||||
self.context.set_font_size(16.0);
|
||||
let text = format!("Layout: {}", layout);
|
||||
self.context.move_to(x, y);
|
||||
self.context.show_text(&text).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_icon_at(&self, x: f64, y: f64, surface: &ImageSurface) {
|
||||
self.context.save().unwrap();
|
||||
let target_size = 24.0;
|
||||
|
||||
Reference in New Issue
Block a user