Refresh channel tree after volume changes
Tree items render a display string snapshotted at build time, so changing a user's volume updated the gain but left the stale percentage on screen. Rebuild the tree and refresh after volume change and reset, matching what the mute hotkeys already do. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
4393739ffa
commit
f58d9f5dce
+15
-2
@@ -38,7 +38,7 @@ func (ti TreeItem) TreeItemStyle(fg, bg uiterm.Attribute, active bool) (uiterm.A
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *Barnard) changeVolume(users []*gumble.User, change float32) {
|
func (b *Barnard) changeVolume(users []*gumble.User, change float32) {
|
||||||
b.withStream(func(stream *gumbleopenal.Stream) {
|
changed := b.withStream(func(stream *gumbleopenal.Stream) {
|
||||||
for _, u := range users {
|
for _, u := range users {
|
||||||
var boost uint16
|
var boost uint16
|
||||||
var ng float32
|
var ng float32
|
||||||
@@ -63,10 +63,13 @@ func (b *Barnard) changeVolume(users []*gumble.User, change float32) {
|
|||||||
b.AddOutputLine("Volume: could not save setting: " + err.Error())
|
b.AddOutputLine("Volume: could not save setting: " + err.Error())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
if changed {
|
||||||
|
b.refreshVolumeDisplay()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Barnard) resetVolume(users []*gumble.User) {
|
func (b *Barnard) resetVolume(users []*gumble.User) {
|
||||||
b.withStream(func(stream *gumbleopenal.Stream) {
|
changed := b.withStream(func(stream *gumbleopenal.Stream) {
|
||||||
for _, u := range users {
|
for _, u := range users {
|
||||||
// Reset to original volume (1.0) and boost (1)
|
// Reset to original volume (1.0) and boost (1)
|
||||||
u.SetBoost(uint16(1))
|
u.SetBoost(uint16(1))
|
||||||
@@ -78,6 +81,16 @@ func (b *Barnard) resetVolume(users []*gumble.User) {
|
|||||||
b.AddOutputLine("Volume: could not save setting: " + err.Error())
|
b.AddOutputLine("Volume: could not save setting: " + err.Error())
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
if changed {
|
||||||
|
b.refreshVolumeDisplay()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tree items render a display string snapshotted at build time, so a volume
|
||||||
|
// change is only visible after the tree is rebuilt.
|
||||||
|
func (b *Barnard) refreshVolumeDisplay() {
|
||||||
|
b.RebuildUserChannelTreePreservingSelection()
|
||||||
|
b.Ui.Refresh()
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeUsersArray(users gumble.Users) []*gumble.User {
|
func makeUsersArray(users gumble.Users) []*gumble.User {
|
||||||
|
|||||||
Reference in New Issue
Block a user