awesome/modules/custom_binds.lua

32 lines
865 B
Lua
Raw Permalink Normal View History

2021-11-14 10:28:13 +00:00
--This module allows loading in custom keybindings that launch programs.
local gears = require("gears")
local awful = require("awful")
local keys = root.keys()
local bindsfile = io.open(global.config_dir.."binds.lua")
if bindsfile then
local binds = {}
local rc,err = load(bindsfile:read("*a"))
bindsfile:close()
if not err then
binds = rc()
else
require("naughty").notify({
title = "Error reading binds.lua",
text = err
})
return
end
local keys = root.keys()
for _,bind in pairs(binds) do
keys = gears.table.join(keys,awful.key(bind[1],bind[2],
function()
awful.spawn.with_shell(bind[3])
end,{
description = bind.description,
group = bind.group
}))
end
root.keys(keys)
end