From d185af3b87c17d9afd5602930e3128ba22ab6835 Mon Sep 17 00:00:00 2001 From: Pavel Makhov Date: Fri, 5 Oct 2018 11:02:05 -0400 Subject: refactor volume widget --- volume-widget/volume.lua | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'volume-widget') diff --git a/volume-widget/volume.lua b/volume-widget/volume.lua index 31a66e4..8124bcf 100644 --- a/volume-widget/volume.lua +++ b/volume-widget/volume.lua @@ -5,7 +5,7 @@ -- https://github.com/streetturtle/awesome-wm-widgets/tree/master/volume-widget -- @author Pavel Makhov --- @copyright 2017 Pavel Makhov +-- @copyright 2018 Pavel Makhov ------------------------------------------------- local awful = require("awful") @@ -14,7 +14,11 @@ local watch = require("awful.widget.watch") local spawn = require("awful.spawn") local path_to_icons = "/usr/share/icons/Arc/status/symbolic/" -local request_command = 'amixer -D pulse sget Master' + +local GET_VOLUME_CMD = 'amixer -D pulse sget Master' +local INC_VOLUME_CMD = 'amixer -D pulse sset Master 5%+' +local DEC_VOLUME_CMD = 'amixer -D pulse sset Master 5%-' +local TOG_VOLUME_CMD = 'amixer -D pulse sset Master toggle' local volume_widget = wibox.widget { { @@ -48,16 +52,16 @@ end - scrolling when cursor is over the widget ]] volume_widget:connect_signal("button::press", function(_,_,_,button) - if (button == 4) then awful.spawn("amixer -D pulse sset Master 5%+", false) - elseif (button == 5) then awful.spawn("amixer -D pulse sset Master 5%-", false) - elseif (button == 1) then awful.spawn("amixer -D pulse sset Master toggle", false) + if (button == 4) then awful.spawn(INC_VOLUME_CMD, false) + elseif (button == 5) then awful.spawn(DEC_VOLUME_CMD, false) + elseif (button == 1) then awful.spawn(TOG_VOLUME_CMD, false) end - spawn.easy_async(request_command, function(stdout, stderr, exitreason, exitcode) + spawn.easy_async(GET_VOLUME_CMD, function(stdout, stderr, exitreason, exitcode) update_graphic(volume_widget, stdout, stderr, exitreason, exitcode) end) end) -watch(request_command, 1, update_graphic, volume_widget) +watch(GET_VOLUME_CMD, 1, update_graphic, volume_widget) return volume_widget \ No newline at end of file -- cgit v1.2.3 From d66f91a19f825446b5f7618d5de941a6878e0624 Mon Sep 17 00:00:00 2001 From: tchoutchawn Date: Wed, 17 Oct 2018 22:40:08 -0400 Subject: Created a new muted speaker icon --- volume-widget/audio-volume-muted-symbolic_new.svg | 81 +++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 volume-widget/audio-volume-muted-symbolic_new.svg (limited to 'volume-widget') diff --git a/volume-widget/audio-volume-muted-symbolic_new.svg b/volume-widget/audio-volume-muted-symbolic_new.svg new file mode 100644 index 0000000..504c146 --- /dev/null +++ b/volume-widget/audio-volume-muted-symbolic_new.svg @@ -0,0 +1,81 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + -- cgit v1.2.3 From e3362639c2b6a91d95a488de3dab57649116aa21 Mon Sep 17 00:00:00 2001 From: Andrew Hill Date: Wed, 31 Oct 2018 19:53:49 -0500 Subject: Fix flipped volume commands The reduce and increase volume commands were flipped --- volume-widget/README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'volume-widget') diff --git a/volume-widget/README.md b/volume-widget/README.md index 19946a2..1fcc456 100644 --- a/volume-widget/README.md +++ b/volume-widget/README.md @@ -36,9 +36,8 @@ s.mytasklist, -- Middle widget To mute/unmute click on the widget. To increase/decrease volume scroll up or down when mouse cursor is over the widget. If you want to control volume level by keyboard shortcuts add following lines in shortcut section of the **rc.lua** (the commands could be slightly different depending on your PC configuration): - ```lua -awful.key({ modkey}, "[", function () awful.spawn("amixer -D pulse sset Master 5%-") end, {description = "increase volume", group = "custom"}), -awful.key({ modkey}, "]", function () awful.spawn("amixer -D pulse sset Master 5%+") end, {description = "decrease volume", group = "custom"}), +awful.key({ modkey}, "[", function () awful.spawn("amixer -D pulse sset Master 5%+") end, {description = "increase volume", group = "custom"}), +awful.key({ modkey}, "]", function () awful.spawn("amixer -D pulse sset Master 5%-") end, {description = "decrease volume", group = "custom"}), awful.key({ modkey}, "\", function () awful.spawn("amixer -D pulse set Master +1 toggle") end, {description = "mute volume", group = "custom"}), ``` -- cgit v1.2.3 From 22d3efe071b30bb098cb7257970e10b58b938db3 Mon Sep 17 00:00:00 2001 From: Andrew Hill Date: Wed, 31 Oct 2018 19:54:48 -0500 Subject: Add back accidentally removed newline --- volume-widget/README.md | 1 + 1 file changed, 1 insertion(+) (limited to 'volume-widget') diff --git a/volume-widget/README.md b/volume-widget/README.md index 1fcc456..118abc6 100644 --- a/volume-widget/README.md +++ b/volume-widget/README.md @@ -36,6 +36,7 @@ s.mytasklist, -- Middle widget To mute/unmute click on the widget. To increase/decrease volume scroll up or down when mouse cursor is over the widget. If you want to control volume level by keyboard shortcuts add following lines in shortcut section of the **rc.lua** (the commands could be slightly different depending on your PC configuration): + ```lua awful.key({ modkey}, "[", function () awful.spawn("amixer -D pulse sset Master 5%+") end, {description = "increase volume", group = "custom"}), awful.key({ modkey}, "]", function () awful.spawn("amixer -D pulse sset Master 5%-") end, {description = "decrease volume", group = "custom"}), -- cgit v1.2.3