summaryrefslogtreecommitdiff
path: root/brightness-widget
diff options
context:
space:
mode:
authorstreetturtle <streetturtle@users.noreply.github.com>2020-12-07 15:33:55 -0500
committerGitHub <noreply@github.com>2020-12-07 15:33:55 -0500
commitd4971690cec1e074999e730d87045e578d71e43c (patch)
treeb0f05079840eba5467e14bdcd093ad3ed5362cf4 /brightness-widget
parentf078748e76eacae599cf0ad06120d9fff54f8fa5 (diff)
parented2b256407291d8edadfcea9380029633cc7d9d8 (diff)
Merge pull request #224 from streetturtle/comply-with-luacheck
Comply with luacheck
Diffstat (limited to 'brightness-widget')
-rw-r--r--brightness-widget/brightness.lua16
1 files changed, 8 insertions, 8 deletions
diff --git a/brightness-widget/brightness.lua b/brightness-widget/brightness.lua
index 0cfbea4..4686041 100644
--- a/brightness-widget/brightness.lua
+++ b/brightness-widget/brightness.lua
@@ -17,11 +17,11 @@ local GET_BRIGHTNESS_CMD = "light -G" -- "xbacklight -get"
local INC_BRIGHTNESS_CMD = "light -A 5" -- "xbacklight -inc 5"
local DEC_BRIGHTNESS_CMD = "light -U 5" -- "xbacklight -dec 5"
-local widget = {}
+local brightness_widget = {}
-local function worker(args)
+local function worker(user_args)
- local args = args or {}
+ local args = user_args or {}
local get_brightness_cmd = args.get_brightness_cmd or GET_BRIGHTNESS_CMD
local inc_brightness_cmd = args.inc_brightness_cmd or INC_BRIGHTNESS_CMD
@@ -43,7 +43,7 @@ local function worker(args)
widget = wibox.container.margin
}
- widget = wibox.widget {
+ brightness_widget = wibox.widget {
brightness_icon,
brightness_text,
layout = wibox.layout.fixed.horizontal,
@@ -52,9 +52,9 @@ local function worker(args)
local update_widget = function(widget, stdout, _, _, _)
local brightness_level = tonumber(string.format("%.0f", stdout))
widget:set_text(" " .. brightness_level .. "%")
- end,
+ end
- widget:connect_signal("button::press", function(_, _, _, button)
+ brightness_widget:connect_signal("button::press", function(_, _, _, button)
if (button == 4) then
spawn(inc_brightness_cmd, false)
elseif (button == 5) then
@@ -64,9 +64,9 @@ local function worker(args)
watch(get_brightness_cmd, timeout, update_widget, brightness_text)
- return widget
+ return brightness_widget
end
-return setmetatable(widget, { __call = function(_, ...)
+return setmetatable(brightness_widget, { __call = function(_, ...)
return worker(...)
end })