awesomewm/core/keybinds.lua

207 lines
3.3 KiB
Lua
Executable File

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"
}
)
--]]
)