Skip to content

Commit c1d7bd0

Browse files
postsolarclaude
andcommitted
fix(volume): only recreate marquee widget when name actually changes
Track the input name separately to properly detect changes. Previously, comparing against ui.label.label() didn't work because marquee duplicates the text with separator, causing recreation on every update. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent aa25380 commit c1d7bd0

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/modules/volume.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -512,14 +512,15 @@ impl Module<Button> for VolumeModule {
512512
label,
513513
slider,
514514
btn_mute,
515+
label_raw: info.name.clone(),
515516
},
516517
);
517518
}
518519
Event::UpdateInput(info) => {
519520
if let Some(ui) = inputs.get_mut(&info.index) {
520521
// Recreate title widget if name changed and marquee is enabled
521522
// (needed to reset marquee scrolling state)
522-
if self.marquee.enable && ui.label.label().as_str() != info.name {
523+
if self.marquee.enable && ui.label_raw != info.name {
523524
if let Some(old_widget) = ui.container.first_child() {
524525
ui.container.remove(&old_widget);
525526
}
@@ -534,8 +535,10 @@ impl Module<Button> for VolumeModule {
534535
);
535536
ui.container.prepend(&scrolled);
536537
ui.label = label;
537-
} else {
538+
ui.label_raw = info.name.clone();
539+
} else if ui.label_raw != info.name {
538540
ui.label.set_label(&info.name);
541+
ui.label_raw = info.name.clone();
539542
}
540543

541544
if !ui.slider.has_css_class("dragging") {
@@ -567,4 +570,6 @@ struct InputUi {
567570
label: Label,
568571
slider: Scale,
569572
btn_mute: ToggleButton,
573+
// Store original (unformatted) title to detect change when marquee is enabled
574+
label_raw: String,
570575
}

0 commit comments

Comments
 (0)