summaryrefslogtreecommitdiff
path: root/brightness-widget
diff options
context:
space:
mode:
authorNuno Silva <nuno.m.ribeiro.silva@tecnico.ulisboa.pt>2021-04-16 21:32:32 +0100
committerNuno Silva <nuno.m.ribeiro.silva@tecnico.ulisboa.pt>2021-04-16 21:32:32 +0100
commit50f686d2c28c5a56481944d16ee2bd70d939b40f (patch)
treea494a09428b81953b540dbd12d74e239bb744bd9 /brightness-widget
parente85d353933dcfd9dfc9101a3b53616d07f0cba20 (diff)
brightness-widget: fix CI warning about shadowed variable
Diffstat (limited to 'brightness-widget')
-rw-r--r--brightness-widget/brightness.lua18
1 files changed, 9 insertions, 9 deletions
diff --git a/brightness-widget/brightness.lua b/brightness-widget/brightness.lua
index 0994ba7..b66b1f0 100644
--- a/brightness-widget/brightness.lua
+++ b/brightness-widget/brightness.lua
@@ -41,7 +41,7 @@ local function worker(user_args)
local program = args.program or 'light'
local step = args.step or 5
local base = args.base or 20
- local level = 0 -- current brightness value
+ local current_level = 0 -- current brightness value
local tooltip = args.tooltip or false
if program == 'light' then
get_brightness_cmd = 'light -G'
@@ -110,12 +110,12 @@ local function worker(user_args)
local update_widget = function(widget, stdout, _, _, _)
local brightness_level = tonumber(string.format("%.0f", stdout))
- level = brightness_level
+ current_level = brightness_level
widget:set_value(brightness_level)
end
function brightness_widget:set(value)
- level = value
+ current_level = value
spawn.easy_async(set_brightness_cmd .. value, function()
spawn.easy_async(get_brightness_cmd, function(out)
update_widget(brightness_widget.widget, out)
@@ -128,15 +128,15 @@ local function worker(user_args)
-- avoid toggling between '0' and 'almost 0'
old_level = 1
end
- if level < 0.1 then
+ if current_level < 0.1 then
-- restore previous level
- level = old_level
+ current_level = old_level
else
-- save current brightness for later
- old_level = level
- level = 0
+ old_level = current_level
+ current_level = 0
end
- brightness_widget:set(level)
+ brightness_widget:set(current_level)
end
function brightness_widget:inc()
spawn.easy_async(inc_brightness_cmd, function()
@@ -168,7 +168,7 @@ local function worker(user_args)
awful.tooltip {
objects = { brightness_widget.widget },
timer_function = function()
- return level .. " %"
+ return current_level .. " %"
end,
}
end