summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--brightness-widget/README.md1
-rw-r--r--brightness-widget/brightness.lua10
2 files changed, 11 insertions, 0 deletions
diff --git a/brightness-widget/README.md b/brightness-widget/README.md
index 5b1a23a..47f7d9c 100644
--- a/brightness-widget/README.md
+++ b/brightness-widget/README.md
@@ -15,6 +15,7 @@ It is possible to customize widget by providing a table with all or some of the
| `path_to_icon` | `/usr/share/icons/Arc/status/symbolic/display-brightness-symbolic.svg` | Path to the icon |
| `font` | `Play 9` | Font |
| `timeout` | 1 | How often in seconds the widget refreshes. Check the note below |
+| `tooltip` | false | Display brightness level in a tooltip when the mouse cursor hovers the widget |
_Note:_ If brightness is controlled only by the widget (either by a mouse, or by a shortcut, then the `timeout` could be quite big, as there is no reason to synchronize the brightness level).
diff --git a/brightness-widget/brightness.lua b/brightness-widget/brightness.lua
index f222adc..0994ba7 100644
--- a/brightness-widget/brightness.lua
+++ b/brightness-widget/brightness.lua
@@ -42,6 +42,7 @@ local function worker(user_args)
local step = args.step or 5
local base = args.base or 20
local level = 0 -- current brightness value
+ local tooltip = args.tooltip or false
if program == 'light' then
get_brightness_cmd = 'light -G'
set_brightness_cmd = 'light -S ' -- <level>
@@ -163,6 +164,15 @@ local function worker(user_args)
watch(get_brightness_cmd, timeout, update_widget, brightness_widget.widget)
+ if tooltip then
+ awful.tooltip {
+ objects = { brightness_widget.widget },
+ timer_function = function()
+ return level .. " %"
+ end,
+ }
+ end
+
return brightness_widget.widget
end