fix: make variables local

This commit is contained in:
Alexander Gehrke 2024-02-06 17:25:23 +01:00
parent 97049a1f75
commit 60bc316c26
10 changed files with 52 additions and 54 deletions

View file

@ -1,11 +1,11 @@
local wibox = require("wibox")
local vicious = require("vicious")
local naughty = require("naughty")
local conf = require("localconf")
local modkey = conf.modkey or "Mod4"
local awful = require("awful")
local tag = require("awful.tag")
local beautiful = require("beautiful")
local widgets = { add = {} }
local gears = require("gears")
local wlist = {}
@ -27,15 +27,8 @@ local function percentage_overlay(p, color, prefix, suffix)
end
function widgets.setup(s)
return {
left = function(bottom, top) s.leftwibar = add_bar(s, "left", "east", bottom, top) end,
right = function(top, bottom) s.rightwibar = add_bar(s, "right", "west", top, bottom) end
}
end
function add_bar(s, position, direction, first, second)
newbar = awful.wibar({
local function add_bar(s, position, direction, first, second)
local newbar = awful.wibar({
position = position,
screen = s,
opacity = 0.6,
@ -55,6 +48,12 @@ function add_bar(s, position, direction, first, second)
return newbar
end
function widgets.setup(s)
return {
left = function(bottom, top) s.leftwibar = add_bar(s, "left", "east", bottom, top) end,
right = function(top, bottom) s.rightwibar = add_bar(s, "right", "west", top, bottom) end
}
end
function widgets.mail(mailboxes, notify_pos, title)
local widget = wibox.widget.textbox()
@ -179,7 +178,7 @@ local function bar_with_overlay(fg, bg, width, height)
progress.overlay = wibox.widget {
font = beautiful.fontface and (beautiful.fontface .. " " .. 7) or beautiful.font,
align = center,
align = 'center',
widget = wibox.widget.textbox
}
@ -192,14 +191,14 @@ end
-- battery
function widgets.battery(s)
bat1 = bar_with_overlay(beautiful.fg_focus, beautiful.bg_focus, 100, math.floor(s.dpi / 10))
local bat1 = bar_with_overlay(beautiful.fg_focus, beautiful.bg_focus, 100, math.floor(s.dpi / 10))
combined_bats = graph_label(
local combined_bats = graph_label(
bat1,
"BAT"
)
callback = function (widget, args)
local callback = function (widget, args)
if args[2] == 0 then
combined_bats:set_visible(false)
return ""
@ -279,7 +278,7 @@ function widgets.dynamic_taskbar(s, signal, when)
widget = s.mytasklist
})
condition = when or function(s) return awful.layout.get(s).name == "max" end
local condition = when or function(s) return awful.layout.get(s).name == "max" end
s:connect_signal(signal or "tag::history::update", function()
s.taskbar.visible = condition(s)
end)