style: re-format
This commit is contained in:
+15
-15
@@ -3,21 +3,21 @@ local settings = require("lua.lib.settings")
|
||||
local bind = require("lua.lib.bind")
|
||||
|
||||
M.binds = {
|
||||
{
|
||||
keys = bind.with_leader("Return"),
|
||||
desc = "Open terminal",
|
||||
dispatcher = hl.dsp.exec_cmd(settings.apps.terminal),
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("B"),
|
||||
desc = "Open web browser",
|
||||
dispatcher = hl.dsp.exec_cmd(settings.apps.browser),
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("E"),
|
||||
desc = "Open file manager",
|
||||
dispatcher = hl.dsp.exec_cmd(settings.apps.file_manager),
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("Return"),
|
||||
desc = "Open terminal",
|
||||
dispatcher = hl.dsp.exec_cmd(settings.apps.terminal),
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("B"),
|
||||
desc = "Open web browser",
|
||||
dispatcher = hl.dsp.exec_cmd(settings.apps.browser),
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("E"),
|
||||
desc = "Open file manager",
|
||||
dispatcher = hl.dsp.exec_cmd(settings.apps.file_manager),
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
|
||||
+19
-19
@@ -3,34 +3,34 @@ local bind = require("lua.lib.bind")
|
||||
local utils = require("lua.lib.utils")
|
||||
|
||||
local pieces = {
|
||||
"apps",
|
||||
"window",
|
||||
"workspace",
|
||||
"passthrough",
|
||||
"apps",
|
||||
"window",
|
||||
"workspace",
|
||||
"passthrough",
|
||||
}
|
||||
|
||||
M.binds = {}
|
||||
M.submaps = {}
|
||||
|
||||
for _, piece in pairs(pieces) do
|
||||
local p = require("lua.binds." .. piece)
|
||||
local bind_piece = p.binds
|
||||
for _, bind_item in pairs(bind_piece) do
|
||||
table.insert(M.binds, bind_item)
|
||||
end
|
||||
local submap = p.submaps
|
||||
if submap then
|
||||
M.submaps = utils.tbl_recursive_merge(M.submaps, submap)
|
||||
end
|
||||
local p = require("lua.binds." .. piece)
|
||||
local bind_piece = p.binds
|
||||
for _, bind_item in pairs(bind_piece) do
|
||||
table.insert(M.binds, bind_item)
|
||||
end
|
||||
local submap = p.submaps
|
||||
if submap then
|
||||
M.submaps = utils.tbl_recursive_merge(M.submaps, submap)
|
||||
end
|
||||
end
|
||||
|
||||
function M.load()
|
||||
bind.map(M.binds)
|
||||
for name, binds in pairs(M.submaps) do
|
||||
hl.define_submap(name, function()
|
||||
bind.map(binds)
|
||||
end)
|
||||
end
|
||||
bind.map(M.binds)
|
||||
for name, binds in pairs(M.submaps) do
|
||||
hl.define_submap(name, function()
|
||||
bind.map(binds)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
+11
-11
@@ -2,20 +2,20 @@ local bind = require("lua.lib.bind")
|
||||
local M = {}
|
||||
|
||||
M.binds = {
|
||||
{
|
||||
keys = bind.with_leader("P"),
|
||||
dispatcher = hl.dsp.submap("pass_through"),
|
||||
desc = "Pass through submap",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("P"),
|
||||
dispatcher = hl.dsp.submap("pass_through"),
|
||||
desc = "Pass through submap",
|
||||
},
|
||||
}
|
||||
|
||||
M.submaps = {
|
||||
pass_through = {
|
||||
{
|
||||
keys = bind.with_leader("escape"),
|
||||
dispatcher = hl.dsp.submap("reset"),
|
||||
},
|
||||
},
|
||||
pass_through = {
|
||||
{
|
||||
keys = bind.with_leader("escape"),
|
||||
dispatcher = hl.dsp.submap("reset"),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
|
||||
+113
-113
@@ -4,135 +4,135 @@ local utils = require("lua.lib.utils")
|
||||
local M = {}
|
||||
|
||||
local function maximize_active_window()
|
||||
local actions = {
|
||||
scrolling = hl.dsp.layout("colresize 1.0"),
|
||||
}
|
||||
local fallback = hl.dsp.window.fullscreen({ mode = "maximized" })
|
||||
return bind.layout_dispatcher(actions, fallback)
|
||||
local actions = {
|
||||
scrolling = hl.dsp.layout("colresize 1.0"),
|
||||
}
|
||||
local fallback = hl.dsp.window.fullscreen({ mode = "maximized" })
|
||||
return bind.layout_dispatcher(actions, fallback)
|
||||
end
|
||||
|
||||
M.binds = {
|
||||
{
|
||||
keys = bind.with_leader("Q"),
|
||||
dispatcher = hl.dsp.window.close(),
|
||||
desc = "Close the window",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("SHIFT + Q"),
|
||||
dispatcher = hl.dsp.window.kill(),
|
||||
desc = "Kill the window",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("F"),
|
||||
dispatcher = hl.dsp.window.fullscreen({}),
|
||||
desc = "Toggle fullscreen the window",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("SHIFT + F"),
|
||||
dispatcher = maximize_active_window(),
|
||||
desc = "Toggle maximize the window",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("CTRL + SHIFT + F"),
|
||||
dispatcher = hl.dsp.window.fullscreen_state({ internal = 0, client = 2, action = "toggle" }),
|
||||
desc = "Toggle fake the window it's fullscreened",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("T"),
|
||||
dispatcher = hl.dsp.window.float(),
|
||||
desc = "Toggle float the window",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("R"),
|
||||
dispatcher = bind.layout_dispatcher({
|
||||
dwindle = hl.dsp.layout("rotatesplit"),
|
||||
}, hl.dsp.no_op()),
|
||||
desc = "Toggle split",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("CTRL + R"),
|
||||
dispatcher = bind.layout_dispatcher({
|
||||
dwindle = hl.dsp.layout("swapsplit"),
|
||||
master = hl.dsp.layout("swapnext"),
|
||||
}, hl.dsp.no_op()),
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("Q"),
|
||||
dispatcher = hl.dsp.window.close(),
|
||||
desc = "Close the window",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("SHIFT + Q"),
|
||||
dispatcher = hl.dsp.window.kill(),
|
||||
desc = "Kill the window",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("F"),
|
||||
dispatcher = hl.dsp.window.fullscreen({}),
|
||||
desc = "Toggle fullscreen the window",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("SHIFT + F"),
|
||||
dispatcher = maximize_active_window(),
|
||||
desc = "Toggle maximize the window",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("CTRL + SHIFT + F"),
|
||||
dispatcher = hl.dsp.window.fullscreen_state({ internal = 0, client = 2, action = "toggle" }),
|
||||
desc = "Toggle fake the window it's fullscreened",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("T"),
|
||||
dispatcher = hl.dsp.window.float(),
|
||||
desc = "Toggle float the window",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("R"),
|
||||
dispatcher = bind.layout_dispatcher({
|
||||
dwindle = hl.dsp.layout("rotatesplit"),
|
||||
}, hl.dsp.no_op()),
|
||||
desc = "Toggle split",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("CTRL + R"),
|
||||
dispatcher = bind.layout_dispatcher({
|
||||
dwindle = hl.dsp.layout("swapsplit"),
|
||||
master = hl.dsp.layout("swapnext"),
|
||||
}, hl.dsp.no_op()),
|
||||
},
|
||||
}
|
||||
|
||||
for key, dir in pairs({
|
||||
H = "left",
|
||||
L = "right",
|
||||
K = "up",
|
||||
J = "down",
|
||||
H = "left",
|
||||
L = "right",
|
||||
K = "up",
|
||||
J = "down",
|
||||
}) do
|
||||
table.insert(M.binds, {
|
||||
keys = bind.with_leader("SHIFT+" .. key),
|
||||
dispatcher = hl.dsp.window.move({ direction = string.sub(dir, 1, 1) }),
|
||||
desc = "Move window " .. dir,
|
||||
})
|
||||
table.insert(M.binds, {
|
||||
keys = bind.with_leader(key),
|
||||
dispatcher = hl.dsp.focus({ direction = string.sub(dir, 1, 1) }),
|
||||
desc = "Move window " .. dir,
|
||||
})
|
||||
table.insert(M.binds, {
|
||||
keys = bind.with_leader("CTRL + " .. key),
|
||||
dispatcher = hl.dsp.window.move({ direction = string.sub(dir, 1, 1), group_aware = true }),
|
||||
desc = "Move window " .. dir .. " with group_aware",
|
||||
})
|
||||
table.insert(M.binds, {
|
||||
keys = bind.with_leader("SHIFT+" .. key),
|
||||
dispatcher = hl.dsp.window.move({ direction = string.sub(dir, 1, 1) }),
|
||||
desc = "Move window " .. dir,
|
||||
})
|
||||
table.insert(M.binds, {
|
||||
keys = bind.with_leader(key),
|
||||
dispatcher = hl.dsp.focus({ direction = string.sub(dir, 1, 1) }),
|
||||
desc = "Move window " .. dir,
|
||||
})
|
||||
table.insert(M.binds, {
|
||||
keys = bind.with_leader("CTRL + " .. key),
|
||||
dispatcher = hl.dsp.window.move({ direction = string.sub(dir, 1, 1), group_aware = true }),
|
||||
desc = "Move window " .. dir .. " with group_aware",
|
||||
})
|
||||
end
|
||||
|
||||
M.binds = utils.list_extend(M.binds, {
|
||||
{
|
||||
keys = bind.with_leader("SHIFT + left"),
|
||||
dispatcher = hl.dsp.window.resize({ x = -100, y = 0, relative = true }),
|
||||
desc = "Resize window x-100",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("SHIFT + right"),
|
||||
dispatcher = hl.dsp.window.resize({ x = 100, y = 0, relative = true }),
|
||||
desc = "Resize window x+100",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("SHIFT + up"),
|
||||
dispatcher = hl.dsp.window.resize({ x = 0, y = -100, relative = true }),
|
||||
desc = "Resize window y-100",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("SHIFT + down"),
|
||||
dispatcher = hl.dsp.window.resize({ x = 0, y = 100, relative = true }),
|
||||
desc = "Resize window y+100",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("SHIFT + left"),
|
||||
dispatcher = hl.dsp.window.resize({ x = -100, y = 0, relative = true }),
|
||||
desc = "Resize window x-100",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("SHIFT + right"),
|
||||
dispatcher = hl.dsp.window.resize({ x = 100, y = 0, relative = true }),
|
||||
desc = "Resize window x+100",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("SHIFT + up"),
|
||||
dispatcher = hl.dsp.window.resize({ x = 0, y = -100, relative = true }),
|
||||
desc = "Resize window y-100",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("SHIFT + down"),
|
||||
dispatcher = hl.dsp.window.resize({ x = 0, y = 100, relative = true }),
|
||||
desc = "Resize window y+100",
|
||||
},
|
||||
})
|
||||
|
||||
M.binds = utils.list_extend(M.binds, {
|
||||
{
|
||||
keys = bind.with_leader("mouse:272"),
|
||||
dispatcher = hl.dsp.window.drag(),
|
||||
desc = "Drag window",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("mouse:273"),
|
||||
dispatcher = hl.dsp.window.resize(),
|
||||
desc = "Resize window",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("mouse:272"),
|
||||
dispatcher = hl.dsp.window.drag(),
|
||||
desc = "Drag window",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("mouse:273"),
|
||||
dispatcher = hl.dsp.window.resize(),
|
||||
desc = "Resize window",
|
||||
},
|
||||
})
|
||||
|
||||
M.binds = utils.list_extend(M.binds, {
|
||||
{
|
||||
keys = bind.with_leader("G"),
|
||||
dispatcher = hl.dsp.group.toggle(),
|
||||
desc = "Toggle a group",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("CTRL + Tab"),
|
||||
dispatcher = hl.dsp.group.next(),
|
||||
desc = "Switch to next window in group",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("CTRL + SHIFT + Tab"),
|
||||
dispatcher = hl.dsp.group.prev(),
|
||||
desc = "Switch to previous window in group",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("G"),
|
||||
dispatcher = hl.dsp.group.toggle(),
|
||||
desc = "Toggle a group",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("CTRL + Tab"),
|
||||
dispatcher = hl.dsp.group.next(),
|
||||
desc = "Switch to next window in group",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("CTRL + SHIFT + Tab"),
|
||||
dispatcher = hl.dsp.group.prev(),
|
||||
desc = "Switch to previous window in group",
|
||||
},
|
||||
})
|
||||
|
||||
return M
|
||||
|
||||
+44
-44
@@ -6,53 +6,53 @@ local M = {}
|
||||
M.binds = {}
|
||||
|
||||
for i = 1, 10 do
|
||||
local n = tostring(i)
|
||||
if n == "10" then
|
||||
n = "0"
|
||||
end
|
||||
table.insert(M.binds, {
|
||||
keys = bind.with_leader(n),
|
||||
dispatcher = hl.dsp.focus({ workspace = i }),
|
||||
desc = "Focus workspace " .. tostring(i),
|
||||
})
|
||||
table.insert(M.binds, {
|
||||
keys = bind.with_leader("SHIFT + " .. n),
|
||||
dispatcher = hl.dsp.window.move({ workspace = i, follow = true }),
|
||||
desc = "Move window to workspace " .. tostring(i),
|
||||
})
|
||||
table.insert(M.binds, {
|
||||
keys = bind.with_leader("CTRL + SHIFT + " .. n),
|
||||
dispatcher = hl.dsp.window.move({ workspace = i, follow = false }),
|
||||
desc = "Move window to workspace " .. tostring(i) .. " silently",
|
||||
})
|
||||
local n = tostring(i)
|
||||
if n == "10" then
|
||||
n = "0"
|
||||
end
|
||||
table.insert(M.binds, {
|
||||
keys = bind.with_leader(n),
|
||||
dispatcher = hl.dsp.focus({ workspace = i }),
|
||||
desc = "Focus workspace " .. tostring(i),
|
||||
})
|
||||
table.insert(M.binds, {
|
||||
keys = bind.with_leader("SHIFT + " .. n),
|
||||
dispatcher = hl.dsp.window.move({ workspace = i, follow = true }),
|
||||
desc = "Move window to workspace " .. tostring(i),
|
||||
})
|
||||
table.insert(M.binds, {
|
||||
keys = bind.with_leader("CTRL + SHIFT + " .. n),
|
||||
dispatcher = hl.dsp.window.move({ workspace = i, follow = false }),
|
||||
desc = "Move window to workspace " .. tostring(i) .. " silently",
|
||||
})
|
||||
end
|
||||
|
||||
M.binds = utils.list_extend(M.binds, {
|
||||
{
|
||||
keys = bind.with_leader("mouse_up"),
|
||||
dispatcher = hl.dsp.focus({ workspace = "m-1" }),
|
||||
desc = "Focus to prev workspace on current monitor",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("mouse_down"),
|
||||
dispatcher = hl.dsp.focus({ workspace = "m+1" }),
|
||||
desc = "Focus to next workspace on current monitor",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("CTRL + down"),
|
||||
dispatcher = hl.dsp.focus({ workspace = "emptynm" }),
|
||||
desc = "Focus to next empty workspace",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("CTRL + left"),
|
||||
dispatcher = hl.dsp.focus({ workspace = "m-1" }),
|
||||
desc = "Focus to prev workspace on current monitor",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("CTRL + right"),
|
||||
dispatcher = hl.dsp.focus({ workspace = "m+1" }),
|
||||
desc = "Focus to next workspace on current monitor",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("mouse_up"),
|
||||
dispatcher = hl.dsp.focus({ workspace = "m-1" }),
|
||||
desc = "Focus to prev workspace on current monitor",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("mouse_down"),
|
||||
dispatcher = hl.dsp.focus({ workspace = "m+1" }),
|
||||
desc = "Focus to next workspace on current monitor",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("CTRL + down"),
|
||||
dispatcher = hl.dsp.focus({ workspace = "emptynm" }),
|
||||
desc = "Focus to next empty workspace",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("CTRL + left"),
|
||||
dispatcher = hl.dsp.focus({ workspace = "m-1" }),
|
||||
desc = "Focus to prev workspace on current monitor",
|
||||
},
|
||||
{
|
||||
keys = bind.with_leader("CTRL + right"),
|
||||
dispatcher = hl.dsp.focus({ workspace = "m+1" }),
|
||||
desc = "Focus to next workspace on current monitor",
|
||||
},
|
||||
})
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user