Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(volume): add pango support to button #861

Merged
merged 1 commit into from
Feb 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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