Skip to content

Commit

Permalink
Add percentage labels to volume and brightness indicators
Browse files Browse the repository at this point in the history
  • Loading branch information
Ferdi265 committed Apr 21, 2024
1 parent 78d9910 commit f44fada
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/server/osd_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,13 @@ impl SwayosdWindow {

let icon = self.build_icon_widget(icon_name);
let progress = self.build_progress_widget(volume / max_volume);
let label = self.build_text_widget(Some(&format!("{}%", volume)));

progress.set_sensitive(!device.mute);

self.container.add(&icon);
self.container.add(&progress);
self.container.add(&label);

self.run_timeout();
}
Expand All @@ -117,9 +119,11 @@ impl SwayosdWindow {
let brightness = brightness_backend.get_current() as f64;
let max = brightness_backend.get_max() as f64;
let progress = self.build_progress_widget(brightness / max);
let label = self.build_text_widget(Some(&format!("{}%", (brightness / max * 100.) as i32)));

self.container.add(&icon);
self.container.add(&progress);
self.container.add(&label);

self.run_timeout();
}
Expand Down

0 comments on commit f44fada

Please sign in to comment.