Cleaned up keybinds

Closes: #5
master
Mark 2022-07-17 21:18:00 -07:00
parent 79411cf97d
commit 12a666cbfd
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
8 changed files with 208 additions and 253 deletions

View File

@ -1,51 +0,0 @@
local hotkeys = require("awful.hotkeys_popup")
return gears.table.join(
awful.key( {"Mod4"}, "s",
hotkeys.show_help,
{
description = "Show help",
group = "Desktop"
}
),
awful.key( {"Mod4", "Control", "Shift"}, "r",
awesome.restart,
{
description = "Restart awesome",
group = "Desktop"
}
),
awful.key( {"Mod4"}, "r",
function ()
awful.screen.focused().mypromptbox:run()
end,
{
description = "Run prompt",
group = "Launcher"
}
),
awful.key( {"Mod4"}, "Return",
function ()
awful.spawn(config.core.terminal)
end,
{
description = "Open a terminal",
group = "Launcher"
}
),
awful.key( {"Mod4"}, "\\",
function ()
awful.spawn(config.core.browser)
end,
{
description = "Open a browser tab",
group = "Launcher"
}
)
)

View File

@ -1,78 +0,0 @@
return gears.table.join(
awful.key( {"Mod4"}, "Left",
function ()
awful.client.focus.byidx( 1)
end,
{
description = "Focus next",
group = "Client"
}
),
awful.key( {"Mod4"}, "Right",
function ()
awful.client.focus.byidx(-1)
end,
{
description = "Focus previous",
group = "Client"
}
),
awful.key( {"Mod4", "Shift"}, "j",
function ()
awful.client.swap.byidx(1)
end,
{
description = "Swap with next window",
group = "Client"
}
),
awful.key( {"Mod4", "Shift"}, "k",
function ()
awful.client.swap.byidx(-1)
end,
{
description = "Swap with previous window",
group = "Client"
}
),
awful.key( {"Mod4"}, "u",
awful.client.urgent.jumpto,
{
description = "Jump to urgent window",
group = "Client"
}
),
awful.key( {"Mod4"}, "b",
function ()
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
end
end,
{
description = "Go back",
group = "Client"
}
),
awful.key( {"Mod4", "Control"}, "n",
function ()
local c = awful.client.restore()
-- Focus restored client
if c then
c:emit_signal(
"request::activate", "key.unminimize", {raise = true}
)
end
end,
{
description = "Restore minimized",
group = "Client"
}
)
)

View File

@ -1,13 +0,0 @@
return {
keys = gears.table.join(
require("binds.system"),
require("binds.client"),
require("binds.layout"),
require("binds.tags"),
require("binds.awesome")
),
buttons = {}
}

View File

@ -1,43 +0,0 @@
local layoutmanager = require("core.layouts.layoutmanager")
return gears.table.join(
awful.key( {"Mod4"}, "+",
function ()
awful.tag.incmwfact( 0.05)
end,
{
description = "increase master width factor",
group = "Layout"
}
),
awful.key({"Mod4"}, "-",
function ()
awful.tag.incmwfact(-0.05)
end,
{
description = "decrease master width factor",
group = "Layout"
}
),
awful.key( {"Mod4"}, ",",
function ()
layoutmanager:next()
end,
{
description = "select layouts",
group = "Layout"
}
),
awful.key( {"Mod4"}, ".",
function ()
layoutmanager:next_alt()
end,
{
description = "cycle alt layouts",
group = "Layout"
}
)
)

View File

@ -1,24 +0,0 @@
local function shutdown(confirm_prompt)
if (string.lower(confirm_prompt) == "y") or (string.lower(confirm_prompt) == "yes") then
awful.spawn("shutdown now", false)
elseif (string.lower(confirm_prompt) == "r") or (string.lower(confirm_prompt) == "reset") then
awful.spawn("shutdown -r now", false)
end
end
return gears.table.join(
awful.key( {"Mod4"}, "p",
function ()
awful.prompt.run {
prompt = "<b>Really shutdown? (y/n/r) </b>",
textbox = awful.screen.focused().mypromptbox.widget,
exe_callback = shutdown
}
end,
{
description = "Shutdown",
group = "System"
}
)
)

View File

@ -1,41 +0,0 @@
return gears.table.join(
awful.key( {"Mod1", "Control"}, "Left",
function ()
awful.screen.focused().tagger:left()
end,
{
description = "Left",
group = "Tags"
}
),
awful.key( {"Mod1", "Control"}, "Right",
function ()
awful.screen.focused().tagger:right()
end,
{
description = "Right",
group = "Tags"
}
),
awful.key( {"Mod1", "Control"}, "Up",
function ()
awful.screen.focused().tagger:up()
end,
{
description = "Up",
group = "Tags"
}
),
awful.key( {"Mod1", "Control"}, "Down",
function ()
awful.screen.focused().tagger:down()
end,
{
description = "Down",
group = "Tags"
}
)
)

206
core/keybinds.lua Executable file
View File

@ -0,0 +1,206 @@
local hotkeys = require("awful.hotkeys_popup")
local layoutmanager = require("core.layouts.layoutmanager")
local function shutdown(confirm_prompt)
if (string.lower(confirm_prompt) == "y") or (string.lower(confirm_prompt) == "yes") then
awful.spawn("shutdown now", false)
elseif (string.lower(confirm_prompt) == "r") or (string.lower(confirm_prompt) == "reset") then
awful.spawn("shutdown -r now", false)
end
end
return gears.table.join(
awful.key( {"Mod4"}, "s",
hotkeys.show_help,
{
description = "Show help",
group = "Desktop"
}
),
awful.key( {"Mod4", "Control", "Shift"}, "r",
awesome.restart,
{
description = "Restart awesome",
group = "Desktop"
}
),
awful.key( {"Mod4"}, "r",
function ()
awful.screen.focused().mypromptbox:run()
end,
{
description = "Run prompt",
group = "Launcher"
}
),
awful.key( {"Mod4"}, "Return",
function ()
awful.spawn(config.core.terminal)
end,
{
description = "Open a terminal",
group = "Launcher"
}
),
awful.key( {"Mod4"}, "\\",
function ()
awful.spawn(config.core.browser)
end,
{
description = "Open a browser tab",
group = "Launcher"
}
),
-- Layouts
awful.key( {"Mod4"}, "+",
function ()
awful.tag.incmwfact( 0.05)
end,
{
description = "increase master width factor",
group = "Layout"
}
),
awful.key({"Mod4"}, "-",
function ()
awful.tag.incmwfact(-0.05)
end,
{
description = "decrease master width factor",
group = "Layout"
}
),
awful.key( {"Mod4"}, ",",
function ()
layoutmanager:next()
end,
{
description = "select layouts",
group = "Layout"
}
),
awful.key( {"Mod4"}, ".",
function ()
layoutmanager:next_alt()
end,
{
description = "cycle alt layouts",
group = "Layout"
}
),
-- System
awful.key( {"Mod4"}, "p",
function ()
awful.prompt.run {
prompt = "<b>Really shutdown? (y/n/r) </b>",
textbox = awful.screen.focused().mypromptbox.widget,
exe_callback = shutdown
}
end,
{
description = "Shutdown",
group = "System"
}
),
-- Tags
awful.key( {"Mod1", "Control"}, "Left",
function ()
awful.screen.focused().tagger:left()
end,
{
description = "Left",
group = "Tags"
}
),
awful.key( {"Mod1", "Control"}, "Right",
function ()
awful.screen.focused().tagger:right()
end,
{
description = "Right",
group = "Tags"
}
),
awful.key( {"Mod1", "Control"}, "Up",
function ()
awful.screen.focused().tagger:up()
end,
{
description = "Up",
group = "Tags"
}
),
awful.key( {"Mod1", "Control"}, "Down",
function ()
awful.screen.focused().tagger:down()
end,
{
description = "Down",
group = "Tags"
}
),
-- Clients
awful.key( {"Mod4"}, "Left",
function ()
awful.client.focus.byidx( 1)
end,
{
description = "Focus next",
group = "Client"
}
),
awful.key( {"Mod4"}, "Right",
function ()
awful.client.focus.byidx(-1)
end,
{
description = "Focus previous",
group = "Client"
}
)
--[[
awful.key( {"Mod4", "Shift"}, "j",
function ()
awful.client.swap.byidx(1)
end,
{
description = "Swap with next window",
group = "Client"
}
),
awful.key( {"Mod4", "Shift"}, "k",
function ()
awful.client.swap.byidx(-1)
end,
{
description = "Swap with previous window",
group = "Client"
}
)
--]]
)

5
rc.lua
View File

@ -28,9 +28,8 @@ beautiful.init(require("theme"))
-- Load key bindings
local binds = require("binds")
local keys = binds.keys
local buttons = binds.buttons
local keys = require("core.keybinds")
local buttons = {}
-- Load modules