Merge pull request #261 from nuno-silva/mixer
volume-widget: open mixer on middle click
This commit is contained in:
commit
8f7edd1c55
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
)
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue