summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornekotxs <nekochan.txs@gmail.com>2023-02-08 03:49:50 +0700
committerzachir <zachir@librem.one>2023-10-19 08:22:37 -0500
commit23180ef9dc14817b8d1d33706369c20fead4fd99 (patch)
tree7bed9dc18af51c5e536191f38cb38a3d75f4036f
parent69f87571a371794de1ede7d3d00f0282134ad04e (diff)
Added displaying volume in tooltip
-rw-r--r--pactl-widget/README.md1
-rw-r--r--pactl-widget/volume.lua10
2 files changed, 11 insertions, 0 deletions
diff --git a/pactl-widget/README.md b/pactl-widget/README.md
index 24e4471..ad6639b 100644
--- a/pactl-widget/README.md
+++ b/pactl-widget/README.md
@@ -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.
diff --git a/pactl-widget/volume.lua b/pactl-widget/volume.lua
index 53441fd..1c3108c 100644
--- a/pactl-widget/volume.lua
+++ b/pactl-widget/volume.lua
@@ -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