Skip to content

Commit

Permalink
feat(ags): add OSD for muted/unmuted
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 30, 2024
1 parent dd8fcea commit 9fd3834
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions config/ags/widget/osd/OSD.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ function OnScreenProgress(vertical: boolean) {
})

let count = 0
let last = 0
function show(value: number, icon: string) {
revealer.reveal_child = true
indicator.icon = icon
if (value === last) return
last = value
progress.setValue(value)
count++
Utils.timeout(DELAY, () => {
count--

if (count === 0) revealer.reveal_child = false
})
}
Expand All @@ -45,8 +47,14 @@ function OnScreenProgress(vertical: boolean) {
.hook(
audio.speaker,
() =>
show(audio.speaker.volume, icon(audio.speaker.icon_name || "", icons.audio.type.speaker)),
"notify::volume"
show(
audio.speaker.is_muted ? 0 : audio.speaker.volume,
icon(
audio.speaker.is_muted ? icons.audio.volume.muted : audio.speaker.icon_name || "",
icons.audio.type.speaker
)
)
// "notify::volume"
)
}

Expand Down

0 comments on commit 9fd3834

Please sign in to comment.