Merge pull request #92 from blix4/alsa_only_support
volume widget support for amixer with no device specified
This commit is contained in:
commit
1a268b9a90
|
@ -6,6 +6,9 @@
|
||||||
--------------------------------------------
|
--------------------------------------------
|
||||||
|
|
||||||
local secrets = {
|
local secrets = {
|
||||||
|
-- See volume-widget/README.md
|
||||||
|
volume_audio_controller = os.getenv('AWW_VOLUME_CONTROLLER') or 'pulse', -- 'pulse' or 'alsa_only'
|
||||||
|
|
||||||
-- Yandex.Translate API key - https://tech.yandex.com/translate/
|
-- Yandex.Translate API key - https://tech.yandex.com/translate/
|
||||||
translate_widget_api_key = os.getenv('AWW_TRANSLATE_API_KEY') or 'API_KEY',
|
translate_widget_api_key = os.getenv('AWW_TRANSLATE_API_KEY') or 'API_KEY',
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,31 @@ s.mytasklist, -- Middle widget
|
||||||
sudo sed -i 's/bebebe/ed4737/g' ./audio-volume-muted-symbolic_red.svg
|
sudo sed -i 's/bebebe/ed4737/g' ./audio-volume-muted-symbolic_red.svg
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Pulse or ALSA only
|
||||||
|
|
||||||
|
Try running this command:
|
||||||
|
|
||||||
|
```amixer -D pulse sget Master```
|
||||||
|
|
||||||
|
If that prints something like this, then the default setting of 'pulse' is probably fine:
|
||||||
|
```
|
||||||
|
Simple mixer control 'Master',0
|
||||||
|
Capabilities: pvolume pvolume-joined pswitch pswitch-joined
|
||||||
|
Playback channels: Mono
|
||||||
|
Limits: Playback 0 - 64
|
||||||
|
Mono: Playback 64 [100%] [0.00dB] [on]
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
If it prints something like this:
|
||||||
|
```
|
||||||
|
$ amixer -D pulse sget Master
|
||||||
|
ALSA lib pulse.c:243:(pulse_connect) PulseAudio: Unable to connect: Connection refused
|
||||||
|
|
||||||
|
amixer: Mixer attach pulse error: Connection refused
|
||||||
|
```
|
||||||
|
then try setting the environment variable `AWW_VOLUME_CONTROLLER` to `alsa_only`.
|
||||||
|
|
||||||
## Control volume
|
## Control volume
|
||||||
|
|
||||||
To mute/unmute click on the widget. To increase/decrease volume scroll up or down when mouse cursor is over the widget.
|
To mute/unmute click on the widget. To increase/decrease volume scroll up or down when mouse cursor is over the widget.
|
||||||
|
|
|
@ -13,12 +13,22 @@ local wibox = require("wibox")
|
||||||
local watch = require("awful.widget.watch")
|
local watch = require("awful.widget.watch")
|
||||||
local spawn = require("awful.spawn")
|
local spawn = require("awful.spawn")
|
||||||
|
|
||||||
|
local secrets = require("awesome-wm-widgets.secrets")
|
||||||
|
|
||||||
local path_to_icons = "/usr/share/icons/Arc/status/symbolic/"
|
local path_to_icons = "/usr/share/icons/Arc/status/symbolic/"
|
||||||
|
|
||||||
local GET_VOLUME_CMD = 'amixer -D pulse sget Master'
|
local device_arg
|
||||||
local INC_VOLUME_CMD = 'amixer -D pulse sset Master 5%+'
|
if secrets.volume_audio_controller == 'pulse' then
|
||||||
local DEC_VOLUME_CMD = 'amixer -D pulse sset Master 5%-'
|
device_arg = '-D pulse'
|
||||||
local TOG_VOLUME_CMD = 'amixer -D pulse sset Master toggle'
|
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 {
|
local volume_widget = wibox.widget {
|
||||||
{
|
{
|
||||||
|
@ -64,4 +74,4 @@ end)
|
||||||
|
|
||||||
watch(GET_VOLUME_CMD, 1, update_graphic, volume_widget)
|
watch(GET_VOLUME_CMD, 1, update_graphic, volume_widget)
|
||||||
|
|
||||||
return volume_widget
|
return volume_widget
|
||||||
|
|
Loading…
Reference in New Issue