summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNuno Silva <nuno.m.ribeiro.silva@tecnico.ulisboa.pt>2021-05-15 23:19:21 +0100
committerNuno Silva <nuno.m.ribeiro.silva@tecnico.ulisboa.pt>2021-05-15 23:19:21 +0100
commit40bd6a775614ee6f3f0017da57ae142d042dfe27 (patch)
tree9426ea2d692dd6db2f6904ec0ed729f518b408bb
parent11acce45064fc3917d65bc9ed0aedd1a6c1cda46 (diff)
volume-widget: open mixer on middle click
-rw-r--r--volume-widget/README.md3
-rw-r--r--volume-widget/volume.lua8
2 files changed, 11 insertions, 0 deletions
diff --git a/volume-widget/README.md b/volume-widget/README.md
index 52e1704..accb731 100644
--- a/volume-widget/README.md
+++ b/volume-widget/README.md
@@ -9,6 +9,8 @@ From left to right: `horizontal_bar`, `vertical_bar`, `icon`, `icon_and_text`, `
A right-click on the widget opens a popup where you can choose a sink/source:
![sink-sources](screenshots/volume-sink-sources.png)
+Left click toggles mute and middle click opens a mixer ([pavucontrol](https://freedesktop.org/software/pulseaudio/pavucontrol/) by default).
+
### Features
- switch between sinks/sources by right clicking on the widget;
@@ -52,6 +54,7 @@ It is possible to customize the widget by providing a table with all or some of
| Name | Default | Description |
|---|---|---|
+| `mixer_cmd` | `pavucontrol` | command to run on middle click (e.g. a mixer program) |
| `widget_type`| `icon_and_text`| Widget type, one of `horizontal_bar`, `vertical_bar`, `icon`, `icon_and_text`, `arc` |
Depending on the chosen widget type add parameters from the corresponding section below:
diff --git a/volume-widget/volume.lua b/volume-widget/volume.lua
index 6e99f27..c711950 100644
--- a/volume-widget/volume.lua
+++ b/volume-widget/volume.lua
@@ -163,6 +163,7 @@ local function worker(user_args)
local args = user_args or {}
+ local mixer_cmd = args.mixer_cmd or 'pavucontrol'
local widget_type = args.widget_type
local refresh_rate = args.refresh_rate or 1
@@ -194,6 +195,12 @@ local function worker(user_args)
spawn.easy_async(TOG_VOLUME_CMD, function(stdout) update_graphic(volume.widget, stdout) end)
end
+ function volume:mixer()
+ if mixer_cmd then
+ spawn.easy_async(mixer_cmd)
+ end
+ end
+
volume.widget:buttons(
awful.util.table.join(
awful.button({}, 3, function()
@@ -206,6 +213,7 @@ local function worker(user_args)
end),
awful.button({}, 4, function() volume:inc() end),
awful.button({}, 5, function() volume:dec() end),
+ awful.button({}, 2, function() volume:mixer() end),
awful.button({}, 1, function() volume:toggle() end)
)
)