summaryrefslogtreecommitdiff
path: root/volume-widget/volume.lua
diff options
context:
space:
mode:
Diffstat (limited to 'volume-widget/volume.lua')
-rw-r--r--volume-widget/volume.lua15
1 files changed, 14 insertions, 1 deletions
diff --git a/volume-widget/volume.lua b/volume-widget/volume.lua
index bdbf134..67ebb78 100644
--- a/volume-widget/volume.lua
+++ b/volume-widget/volume.lua
@@ -1,7 +1,6 @@
local awful = require("awful")
local wibox = require("wibox")
local watch = require("awful.widget.watch")
-local gears = require("gears")
local path_to_icons = "/usr/share/icons/Arc/status/symbolic/"
@@ -18,6 +17,20 @@ volume_widget = wibox.widget {
end
}
+--[[ allows control volume level by
+- clicking on the widget to mute/unmute
+- scrolling when curson is over the widget
+]]
+volume_widget:connect_signal("button::press", function(_,_,_,button)
+ if (button == 4) then
+ awful.spawn("amixer -D pulse sset Master 5%+")
+ elseif (button == 5) then
+ awful.spawn("amixer -D pulse sset Master 5%-")
+ elseif (button == 1) then
+ awful.spawn("amixer -D pulse sset Master toggle")
+ end
+end)
+
watch(
'amixer -D pulse sget Master', 1,
function(widget, stdout, stderr, reason, exit_code)