mirror of
https://github.com/streetturtle/awesome-wm-widgets.git
synced 2024-11-15 19:48:04 +01:00
Merge pull request #392 from nekotxs/master
Added displaying volume in tooltip
This commit is contained in:
commit
ecb22a54bc
2 changed files with 11 additions and 0 deletions
|
@ -49,6 +49,7 @@ the following config parameters:
|
|||
| `step` | `5` | How much the volume is raised or lowered at once (in %) |
|
||||
| `widget_type`| `icon_and_text`| Widget type, one of `horizontal_bar`, `vertical_bar`, `icon`, `icon_and_text`, `arc` |
|
||||
| `device` | `@DEFAULT_SINK@` | Select the device name to control |
|
||||
| `tooltip` | `false` | Display volume level in a tooltip when the mouse cursor hovers the widget |
|
||||
|
||||
For more details on parameters depending on the chosen widget type, please
|
||||
refer to the original Volume widget.
|
||||
|
|
|
@ -157,6 +157,7 @@ local function worker(user_args)
|
|||
local refresh_rate = args.refresh_rate or 1
|
||||
local step = args.step or 5
|
||||
local device = args.device or '@DEFAULT_SINK@'
|
||||
local tooltip = args.tooltip or false
|
||||
|
||||
if widget_types[widget_type] == nil then
|
||||
volume.widget = widget_types['icon_and_text'].get_widget(args.icon_and_text_args)
|
||||
|
@ -226,6 +227,15 @@ local function worker(user_args)
|
|||
end
|
||||
}
|
||||
|
||||
if tooltip then
|
||||
awful.tooltip {
|
||||
objects = { volume.widget },
|
||||
timer_function = function()
|
||||
return pactl.get_volume(device) .. " %"
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
return volume.widget
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue