fix: make variables local
This commit is contained in:
parent
97049a1f75
commit
60bc316c26
|
@ -1,6 +1,6 @@
|
|||
local naughty = require("naughty")
|
||||
|
||||
actions = {}
|
||||
local actions = {}
|
||||
|
||||
function actions.toggle_naughty()
|
||||
if naughty.is_suspended() then
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
-- change color of wibars on numlock/capslock/scrolllock
|
||||
--
|
||||
require("beautiful")
|
||||
local beautiful = require("beautiful")
|
||||
|
||||
local lockhl = { bg_lock = beautiful.bg_urgent, bg_normal = beautiful.bg_normal }
|
||||
local target_wibars = {}
|
||||
|
|
9
mpd.lua
9
mpd.lua
|
@ -1,12 +1,9 @@
|
|||
-- MPD control and playlist editing
|
||||
-- prompts require dmpc script
|
||||
local M = {}
|
||||
local conf = conf
|
||||
local awful = awful
|
||||
local log = log
|
||||
|
||||
-- local functions
|
||||
local dmenu, notify, mpc
|
||||
local conf = require("localconf")
|
||||
local log = require("talkative")
|
||||
local naughty = require("naughty")
|
||||
|
||||
local defaults = {}
|
||||
local settings = {}
|
||||
|
|
|
@ -6,12 +6,11 @@ local actions = require("actions")
|
|||
|
||||
local modkey = conf.modkey or "Mod4"
|
||||
local hyper = {"Ctrl", "Shift", "Mod1", "Mod4"}
|
||||
local binder = binder or require("separable.binder")
|
||||
local binder = require("separable.binder")
|
||||
local mb = binder.modal
|
||||
|
||||
local mpd = require("mpd")
|
||||
local handy = require("handy")
|
||||
local myglobalkeys = {}
|
||||
|
||||
local wibars = {}
|
||||
for s in screen do
|
||||
|
@ -133,7 +132,7 @@ local myglobalkeys = awful.util.table.join(
|
|||
awful.key({ modkey }, "m", function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"which playerctl && " .. playerctl .. " status",
|
||||
function(stdout, stderr, reason, exitcode)
|
||||
function(_, _, _, exitcode)
|
||||
if exitcode > 0 then
|
||||
mb.grab{keymap=mpdmap, name="MPD", stay_in_mode=true}
|
||||
else
|
||||
|
|
|
@ -3,7 +3,8 @@ awful.rules = require("awful.rules")
|
|||
local localconf = require("localconf")
|
||||
|
||||
local beautiful = require("beautiful")
|
||||
local binder = binder or require("separable.binder")
|
||||
local naughty = require("naughty")
|
||||
local binder = require("separable.binder")
|
||||
local log = require("talkative")
|
||||
|
||||
-- create a notification when given client becomes urgent
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
-- key bindings
|
||||
local awful = require("awful")
|
||||
local beautiful = require("beautiful")
|
||||
|
||||
local naughty = require("naughty")
|
||||
local conf = require("localconf")
|
||||
local modkey = conf.modkey or "Mod4"
|
||||
local mb = require("modalbind")
|
||||
mb.init()
|
||||
|
@ -9,7 +9,7 @@ mb.init()
|
|||
local globalkeys = {}
|
||||
local globalkeyfuncs = {}
|
||||
|
||||
app_folders = {
|
||||
local app_folders = {
|
||||
"/usr/share/applications",
|
||||
"/usr/local/share/applications",
|
||||
(os.getenv("XDG_DATA_HOME") or os.getenv("HOME") .. "/.local/share") .. "/applications",
|
||||
|
@ -27,7 +27,7 @@ binder.spawn = spawnf
|
|||
conf.cmd.run = conf.cmd.run or spawnf("dmenu_run")
|
||||
|
||||
local function use_layout(layout) return function() awful.layout.set(layout) end end
|
||||
layoutmap = {
|
||||
local layoutmap = {
|
||||
{"f", use_layout(awful.layout.suit.fair), "Fair" },
|
||||
{"h", use_layout(awful.layout.suit.fair.horizontal), "Fair Horizontal" },
|
||||
{"t", use_layout(awful.layout.suit.tile), "Tile" },
|
||||
|
@ -37,7 +37,7 @@ layoutmap = {
|
|||
{"space", use_layout(awful.layout.suit.floating), "Float" }
|
||||
}
|
||||
|
||||
layoutsettings = {
|
||||
local layoutsettings = {
|
||||
{"h", function () awful.tag.incmwfact(-0.05) end, "Master smaller" },
|
||||
{"l", function () awful.tag.incmwfact( 0.05) end, "Master bigger" },
|
||||
{"H", function () awful.tag.incnmaster( 1) end, "More masters" },
|
||||
|
@ -46,20 +46,6 @@ layoutsettings = {
|
|||
{"C", function () awful.tag.incncol(-1) end, "Less columns" },
|
||||
}
|
||||
|
||||
local function screen_focus_wrapdir(dir)
|
||||
return function()
|
||||
local target = screen_in_wrapdir(dir)
|
||||
awful.screen.focus(target)
|
||||
end
|
||||
end
|
||||
|
||||
local function screen_move_client_wrapdir(dir)
|
||||
return function(c)
|
||||
local target = screen_in_wrapdir(dir)
|
||||
awful.client.movetoscreen(c, target)
|
||||
end
|
||||
end
|
||||
|
||||
local opposite_dirs = {
|
||||
left = "right",
|
||||
right = "left",
|
||||
|
@ -67,7 +53,7 @@ local opposite_dirs = {
|
|||
down = "up"
|
||||
}
|
||||
|
||||
function screen_in_wrapdir(dir, _screen)
|
||||
local function screen_in_wrapdir(dir, _screen)
|
||||
local sel = _screen or mouse.screen
|
||||
if sel then
|
||||
local geomtbl = {}
|
||||
|
@ -87,6 +73,21 @@ function screen_in_wrapdir(dir, _screen)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
local function screen_focus_wrapdir(dir)
|
||||
return function()
|
||||
local target = screen_in_wrapdir(dir)
|
||||
awful.screen.focus(target)
|
||||
end
|
||||
end
|
||||
|
||||
local function screen_move_client_wrapdir(dir)
|
||||
return function(c)
|
||||
local target = screen_in_wrapdir(dir)
|
||||
awful.client.movetoscreen(c, target)
|
||||
end
|
||||
end
|
||||
|
||||
function binder.add_bindings(keys)
|
||||
globalkeys = awful.util.table.join(globalkeys, keys);
|
||||
return binder
|
||||
|
@ -105,7 +106,7 @@ end
|
|||
function binder.apply()
|
||||
naughty.notify { text="Reloading key bindings" }
|
||||
local allkeys = awful.util.table.clone(globalkeys)
|
||||
for k,v in pairs(globalkeyfuncs) do
|
||||
for _,v in pairs(globalkeyfuncs) do
|
||||
local loadedkeys = v()
|
||||
allkeys = awful.util.table.join(allkeys, loadedkeys)
|
||||
end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
local awful = require("awful")
|
||||
local beautiful = beautiful
|
||||
local beautiful = require("beautiful")
|
||||
|
||||
|
||||
client.connect_signal("manage", function (c)
|
||||
|
|
7
tags.lua
7
tags.lua
|
@ -1,6 +1,6 @@
|
|||
-- tags
|
||||
local awful = require("awful")
|
||||
local conf = conf
|
||||
local conf = require("localconf")
|
||||
local modkey = conf.modkey or "Mod4"
|
||||
|
||||
local tags={}
|
||||
|
@ -80,7 +80,7 @@ local tagdef = {
|
|||
{"F4", { layout = awful.layout.suit.max }},
|
||||
}
|
||||
|
||||
function defaultlayout(s)
|
||||
local function defaultlayout(s)
|
||||
if s.geometry.width > s.geometry.height then
|
||||
return awful.layout.suit.fair
|
||||
else
|
||||
|
@ -102,6 +102,7 @@ end
|
|||
|
||||
function tags.create_bindings()
|
||||
local tagkeys = {}
|
||||
local k
|
||||
|
||||
-- Bind all number keys and F-keys to tags
|
||||
for i = 1, 21 do
|
||||
|
@ -109,7 +110,7 @@ function tags.create_bindings()
|
|||
k = "#" .. i + 9 -- number keys 1-9
|
||||
elseif i == 10 then
|
||||
k = "#19" -- zero
|
||||
elseif i > 10 then
|
||||
else --if i > 10 then
|
||||
k = "F" .. i - 10 -- F keys
|
||||
end
|
||||
tagkeys = awful.util.table.join(tagkeys,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
-- {{{ Main
|
||||
|
||||
local awful = require("awful")
|
||||
theme = {}
|
||||
local theme = {}
|
||||
theme.wallpaper = "~/.wallpaper"
|
||||
theme.icon_theme = "Adwaita"
|
||||
|
||||
|
|
31
widgets.lua
31
widgets.lua
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue