summaryrefslogtreecommitdiff
path: root/experiments/volume/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'experiments/volume/widgets')
-rw-r--r--experiments/volume/widgets/arc-widget.lua39
-rw-r--r--experiments/volume/widgets/icon-and-text-widget.lua45
-rw-r--r--experiments/volume/widgets/icon-widget.lua35
3 files changed, 119 insertions, 0 deletions
diff --git a/experiments/volume/widgets/arc-widget.lua b/experiments/volume/widgets/arc-widget.lua
new file mode 100644
index 0000000..d7a3b1f
--- /dev/null
+++ b/experiments/volume/widgets/arc-widget.lua
@@ -0,0 +1,39 @@
+local wibox = require("wibox")
+local beautiful = require('beautiful')
+
+local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/awesome-wm-widgets/experiments/volume/icons/'
+
+local widget = {}
+
+function widget.get_widget()
+
+ return wibox.widget {
+ {
+ id = "icon",
+ image = ICON_DIR .. 'audio-volume-high-symbolic.svg',
+ resize = true,
+ widget = wibox.widget.imagebox,
+ },
+ max_value = 100,
+ thickness = 2,
+ start_angle = 4.71238898, -- 2pi*3/4
+ forced_height = 18,
+ forced_width = 18,
+ bg = '#ffffff11',
+ paddings = 2,
+ widget = wibox.container.arcchart,
+ set_volume_level = function(self, new_value)
+ self.value = new_value
+ end,
+ mute = function(self)
+ self.colors = {'#BF616A'}
+ end,
+ unmute = function(self)
+ self.colors = {beautiful.fg_color}
+ end
+ }
+
+end
+
+
+return widget \ No newline at end of file
diff --git a/experiments/volume/widgets/icon-and-text-widget.lua b/experiments/volume/widgets/icon-and-text-widget.lua
new file mode 100644
index 0000000..5ea626b
--- /dev/null
+++ b/experiments/volume/widgets/icon-and-text-widget.lua
@@ -0,0 +1,45 @@
+local wibox = require("wibox")
+
+local widget = {}
+
+local WIDGET_DIR = os.getenv("HOME") .. '/.config/awesome/awesome-wm-widgets/experiments/volume/icons/'
+
+function widget.get_widget()
+
+ return wibox.widget {
+ {
+ {
+ id = "icon",
+ resize = false,
+ widget = wibox.widget.imagebox,
+ },
+ valign = 'center',
+ layout = wibox.container.place
+ },
+ {
+ id = 'txt',
+ widget = wibox.widget.textbox
+ },
+ layout = wibox.layout.fixed.horizontal,
+ set_volume_level = function(self, new_value)
+ self:get_children_by_id('txt')[1]:set_text(new_value)
+ local new_value_num = tonumber(new_value)
+ local volume_icon_name = ''
+ if (new_value_num >= 0 and new_value_num < 33) then
+ volume_icon_name="audio-volume-low-symbolic"
+ elseif (new_value_num < 66) then
+ volume_icon_name="audio-volume-medium-symbolic"
+ else
+ volume_icon_name="audio-volume-high-symbolic"
+ end
+ self:get_children_by_id('icon')[1]:set_image(WIDGET_DIR .. volume_icon_name .. '.svg')
+ end,
+ mute = function(self) self:get_children_by_id('icon')[1]:set_image(WIDGET_DIR .. 'audio-volume-muted-symbolic.svg') end,
+ unmute = function() end,
+
+ }
+
+end
+
+
+return widget \ No newline at end of file
diff --git a/experiments/volume/widgets/icon-widget.lua b/experiments/volume/widgets/icon-widget.lua
new file mode 100644
index 0000000..6725e6d
--- /dev/null
+++ b/experiments/volume/widgets/icon-widget.lua
@@ -0,0 +1,35 @@
+local wibox = require("wibox")
+
+local widget = {}
+
+local WIDGET_DIR = os.getenv("HOME") .. '/.config/awesome/awesome-wm-widgets/experiments/volume/icons/'
+
+function widget.get_widget()
+
+ return wibox.widget {
+ {
+ id = "icon",
+ resize = false,
+ widget = wibox.widget.imagebox,
+ },
+ valign = 'center',
+ layout = wibox.container.place,
+ set_volume_level = function(self, new_value)
+ local new_value_num = tonumber(new_value)
+ local volume_icon_name = ''
+ if (new_value_num >= 0 and new_value_num < 33) then
+ volume_icon_name="audio-volume-low-symbolic"
+ elseif (new_value_num < 66) then
+ volume_icon_name="audio-volume-medium-symbolic"
+ else
+ volume_icon_name="audio-volume-high-symbolic"
+ end
+ self:get_children_by_id('icon')[1]:set_image(WIDGET_DIR .. volume_icon_name .. '.svg')
+ end,
+ mute = function(self) self:get_children_by_id('icon')[1]:set_image(WIDGET_DIR .. 'audio-volume-muted-symbolic.svg') end,
+ unmute = function() end,
+ }
+
+end
+
+return widget \ No newline at end of file