summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstreetturtle <streetturtle@users.noreply.github.com>2021-06-02 10:51:01 -0400
committerGitHub <noreply@github.com>2021-06-02 10:51:01 -0400
commit8f7edd1c558028d1cce6ef365c49832016a34c68 (patch)
treeeaae7e5b8526b09414a135fa5c67a200d941d7bb
parent9628b67801f79d98b6a2c5a9b90e3b3e439b69f5 (diff)
parent40bd6a775614ee6f3f0017da57ae142d042dfe27 (diff)
Merge pull request #261 from nuno-silva/mixer
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)
)
)