diff options
author | streetturtle <streetturtle@users.noreply.github.com> | 2019-09-01 21:40:18 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-01 21:40:18 -0400 |
commit | 1a268b9a90bd2ceb2138d1361efaca2e04e92933 (patch) | |
tree | 0953daa28b45062f16fd3095e5fc38eced6650b2 /volume-widget/volume.lua | |
parent | 372ae3c9e7cab4b64b8dcaf31d9d2d921a723585 (diff) | |
parent | 05e9a909bd29bc7e9a50ba6e5ff6fdecd4503f2a (diff) |
Merge pull request #92 from blix4/alsa_only_support
volume widget support for amixer with no device specified
Diffstat (limited to 'volume-widget/volume.lua')
-rw-r--r-- | volume-widget/volume.lua | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/volume-widget/volume.lua b/volume-widget/volume.lua index 8124bcf..fe7ff2c 100644 --- a/volume-widget/volume.lua +++ b/volume-widget/volume.lua @@ -13,12 +13,22 @@ local wibox = require("wibox") local watch = require("awful.widget.watch") local spawn = require("awful.spawn") +local secrets = require("awesome-wm-widgets.secrets") + local path_to_icons = "/usr/share/icons/Arc/status/symbolic/" -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 device_arg +if secrets.volume_audio_controller == 'pulse' then + device_arg = '-D pulse' +else + device_arg = '' +end + +local GET_VOLUME_CMD = 'amixer ' .. device_arg .. ' sget Master' +local INC_VOLUME_CMD = 'amixer ' .. device_arg .. ' sset Master 5%+' +local DEC_VOLUME_CMD = 'amixer ' .. device_arg .. ' sset Master 5%-' +local TOG_VOLUME_CMD = 'amixer ' .. device_arg .. ' sset Master toggle' + local volume_widget = wibox.widget { { @@ -64,4 +74,4 @@ end) watch(GET_VOLUME_CMD, 1, update_graphic, volume_widget) -return volume_widget
\ No newline at end of file +return volume_widget |