awesomerc/configuration/global_keybindings.lua

65 lines
2.0 KiB
Lua

local akey = require 'awful.key'
local aprompt = require 'awful.prompt'
local autil = require 'awful.util'
local ascreen = require 'awful.screen'
local aspawn = require 'awful.spawn'
local menubar = require 'menubar'
local applications = require 'rc.configuration.applications'
local desktop_bar = require 'rc.ui.desktop_decoration.bar'
local hotkeys_popup = require 'rc.ui.hotkeys_popup'
local mymainmenu = require 'rc.ui.menu.mymainmenu'
local capi = {
awesome = awesome
}
local control = 'Control'
local modkey = 'Mod4'
local shift = 'Shift'
local global_keybindings = {
akey({ modkey }, 's',
hotkeys_popup.show_help,
{ description = 'show help', group = 'awesome' }),
akey({ modkey }, 'w',
function ()
mymainmenu():show()
end,
{ description = 'show main menu', group = 'awesome' }),
akey({ modkey, control }, 'r',
capi.awesome.restart,
{ description = 'reload awesome', group = 'awesome' }),
akey({ modkey, shift }, 'q',
capi.awesome.quit,
{ description = 'quit awesome', group = 'awesome' }),
akey({ modkey }, 'x',
function ()
aprompt.run {
prompt = 'Run Lua code: ',
textbox = desktop_bar(ascreen.focused()).promptbox.widget,
exe_callback = autil.eval,
history_path = autil.get_cache_dir() .. '/history_eval'
}
end,
{ description = 'lua execute prompt', group = 'awesome' }),
akey({ modkey }, 'Return',
function ()
aspawn(applications.terminal)
end,
{ description = 'open a terminal', group = 'launcher' }),
akey({ modkey }, 'r',
function ()
desktop_bar(ascreen.focused()).promptbox:run()
end,
{ description = 'run prompt', group = 'launcher' }),
akey({ modkey }, 'p',
function ()
menubar.show()
end,
{ description = 'show the menubar', group = 'launcher' })
}
return global_keybindings