Reno is the second iteration of the AWMTK-powered AwesomeWM config.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.7 KiB

2 years ago
2 years ago
2 years ago
  1. -- This file is part of Reno desktop.
  2. --
  3. -- Reno desktop is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  4. --
  5. -- Reno desktop is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  6. --
  7. -- You should have received a copy of the GNU General Public License along with Reno desktop. If not, see <https://www.gnu.org/licenses/>.
  8. -- library for constructing bindable keys
  9. local asckey = {
  10. keymap = {}
  11. }
  12. local awful = require("awful")
  13. asckey.set_keymap = function(keymap)
  14. for k,v in pairs(keymap) do
  15. asckey.keymap[v] = k
  16. end
  17. end
  18. asckey.get_keycomb = function(name)
  19. local modifiers = {}
  20. name = name:gsub("[^%s%+]+%+",function(v)
  21. if v == "modkey+" then v = global.modkey.."+" end
  22. table.insert(modifiers,v:sub(1,-2))
  23. return ""
  24. end)
  25. return modifiers,name
  26. end
  27. asckey.k = function(name,callback,description)
  28. if not asckey.keymap[name] then
  29. return {}
  30. end
  31. local modifiers,key = asckey.get_keycomb(asckey.keymap[name])
  32. return awful.key(modifiers,key,
  33. callback,
  34. description)
  35. end
  36. asckey.custom_binds = function()
  37. local custom_keys = {}
  38. for comm,bind in pairs(asckey.keymap) do
  39. if not comm:match("^:.*") then
  40. table.insert(custom_keys,asckey.k(comm,function()
  41. awful.spawn(comm)
  42. end,{description = comm, group = "custom"}))
  43. end
  44. end
  45. return custom_keys
  46. end
  47. return asckey