From f819e30b03dffcf9e74af4b8552e4a8ab8f54c58 Mon Sep 17 00:00:00 2001 From: Jon Santmyer Date: Fri, 29 Sep 2023 14:22:24 -0400 Subject: major reorganizing to seperate modules --- programs/dotfiles/awesome/widgets/volume.lua | 60 ---------------------------- 1 file changed, 60 deletions(-) delete mode 100644 programs/dotfiles/awesome/widgets/volume.lua (limited to 'programs/dotfiles/awesome/widgets/volume.lua') diff --git a/programs/dotfiles/awesome/widgets/volume.lua b/programs/dotfiles/awesome/widgets/volume.lua deleted file mode 100644 index 21c200b..0000000 --- a/programs/dotfiles/awesome/widgets/volume.lua +++ /dev/null @@ -1,60 +0,0 @@ -local awful = require("awful") -local spawn = require("awful.spawn") -local watch = require("awful.widget.watch") -local beautiful = require("beautiful") -local wibox = require("wibox") -local gears = require("gears") -local naughty = require("naughty") - -local volume_widget = {} - -local get_volume_cmd = "bash -c 'wpctl get-volume @DEFAULT_AUDIO_SINK@'" - -local function worker(user_args) - local volume_bar = wibox.widget { - bar_shape = gears.shape.rounded_rect, - bar_height = 4, - bar_color = beautiful.fg_focus, - handle_color = beautiful.fg_focus, - handle_shape = gears.shape.circle, - handle_border_width = 0, - value = 0, - forced_width = 50, - widget = wibox.widget.slider, - } - - volume_widget = wibox.widget { - { - layout = wibox.layout.fixed.horizontal, - { - text = "󰕾 ", - widget = wibox.widget.textbox - }, - volume_bar, - spacing = 4 - }, - widget = wibox.container.margin, - left = 8, - } - - local function percentage(value) - return math.floor(value) - end - - watch(get_volume_cmd, 1, - function(widget, stdout) - volume = stdout:match('0.%d+') - widget.value = tonumber(volume) * 100 - end, volume_bar) - - volume_bar:connect_signal("property::value", - function(self) - spawn.easy_async("bash -c 'wpctl set-volume @DEFAULT_AUDIO_SINK@ " .. self.value .. "%'", function() end) - end) - - return volume_widget -end - -return setmetatable(volume_widget, { __call = function(_, ...) - return worker(...) -end}) -- cgit v1.2.1