summaryrefslogtreecommitdiff
path: root/brightness-widget/brightness.lua
diff options
context:
space:
mode:
Diffstat (limited to 'brightness-widget/brightness.lua')
-rw-r--r--brightness-widget/brightness.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/brightness-widget/brightness.lua b/brightness-widget/brightness.lua
index 306cc2b..b0d98cf 100644
--- a/brightness-widget/brightness.lua
+++ b/brightness-widget/brightness.lua
@@ -43,6 +43,7 @@ local function worker(user_args)
local base = args.base or 20
local current_level = 0 -- current brightness value
local tooltip = args.tooltip or false
+ local percentage = args.percentage or false
if program == 'light' then
get_brightness_cmd = 'light -G'
set_brightness_cmd = 'light -S %d' -- <level>
@@ -82,7 +83,11 @@ local function worker(user_args)
spacing = 4,
layout = wibox.layout.fixed.horizontal,
set_value = function(self, level)
- self:get_children_by_id('txt')[1]:set_text(level .. '%')
+ local display_level = level
+ if percentage then
+ display_level = display_level .. '%'
+ end
+ self:get_children_by_id('txt')[1]:set_text(display_level)
end
}
elseif type == 'arc' then