Skip to content

Commit

Permalink
Merge pull request #861 from JakeStanger/fix/volume-markup
Browse files Browse the repository at this point in the history
feat(volume): add pango support to button
  • Loading branch information
JakeStanger authored Feb 4, 2025
2 parents 814fbc2 + 5e7e741 commit 68ccc7a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/modules/volume.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::clients::volume::{self, Event};
use crate::config::CommonConfig;
use crate::gtk_helpers::IronbarGtkExt;
use crate::gtk_helpers::{IronbarGtkExt, IronbarLabelExt};
use crate::modules::{
Module, ModuleInfo, ModuleParts, ModulePopup, ModuleUpdateEvent, PopupButton, WidgetContext,
};
Expand Down Expand Up @@ -202,7 +202,13 @@ impl Module<Button> for VolumeModule {
where
<Self as Module<Button>>::SendMessage: Clone,
{
let button_label = Label::builder()
.use_markup(true)
.angle(info.bar_position.get_angle())
.build();

let button = Button::new();
button.add(&button_label);

{
let tx = context.tx.clone();
Expand All @@ -215,7 +221,6 @@ impl Module<Button> for VolumeModule {
{
let rx = context.subscribe();
let icons = self.icons.clone();
let button = button.clone();

let format = self.format.clone();

Expand All @@ -227,7 +232,7 @@ impl Module<Button> for VolumeModule {
.replace("{percentage}", &sink.volume.to_string())
.replace("{name}", &sink.description);

button.set_label(&label);
button_label.set_label_escaped(&label);
},
_ => {}
}
Expand Down

0 comments on commit 68ccc7a

Please sign in to comment.