diff options
Diffstat (limited to '.config/awesome/ui/statusbar/widgets/volume.lua')
-rw-r--r-- | .config/awesome/ui/statusbar/widgets/volume.lua | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/.config/awesome/ui/statusbar/widgets/volume.lua b/.config/awesome/ui/statusbar/widgets/volume.lua index e69de29..72723a0 100644 --- a/.config/awesome/ui/statusbar/widgets/volume.lua +++ b/.config/awesome/ui/statusbar/widgets/volume.lua @@ -0,0 +1,36 @@ +local gcolor = require "gears.color" +local phosphor = require "assets.phosphor" +local qmath = require "quarrel.math" +local qvars = require "quarrel.vars" +local wibox = require "wibox" + +local volume_widget = wibox.widget { + widget = wibox.container.place, + valign = "center", + halign = "center", + { + widget = wibox.widget.imagebox, + image = gcolor.recolor_image(phosphor.speaker_simple_slash_fill, qvars.colors.red), + forced_width = qvars.char_height, + forced_height = qvars.char_height + } +} + +awesome.connect_signal("services::audio", function(volume, muted) + if muted then + volume_widget.widget.image = gcolor.recolor_image(phosphor["speaker_simple_x_fill"], qvars.colors.red) + return + end + + local icon_data = qmath.step_value(volume, { + { 0, "slash" }, + { 25, "none" }, + { 50, "low" }, + { 75, "high" }, + { 100 } + }) + + volume_widget.widget.image = gcolor.recolor_image(phosphor["speaker_simple_" .. icon_data .. "_fill"], qvars.colors.fg) +end) + +return volume_widget |