fix: make variables local
This commit is contained in:
parent
97049a1f75
commit
60bc316c26
10 changed files with 52 additions and 54 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue