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.

136 lines
4.6 KiB

2 years ago
2 years ago
2 years ago
2 years ago
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. -- Module that adds default keybindings
  9. local awful = require("awful")
  10. local gears = require("gears")
  11. local ask = require("asckey")
  12. global.modkey = global.modkey or "Mod4"
  13. ask.set_keymap(config.keys)
  14. local custom_keys = ask.custom_binds()
  15. local k = ask.k
  16. local titlebar_states = {}
  17. local keys = gears.table.join(
  18. k(':root.client_next',
  19. function()
  20. awful.client.focus.byidx(1)
  21. end,
  22. {description = "switch to next client", group = "client"}),
  23. k(":root.client_previous",
  24. function()
  25. awful.client.focus.byidx(-1)
  26. end,
  27. {description = "switch to previous client", group = "client"}),
  28. k(":root.screen_next",
  29. function()
  30. awful.screen.focus_relative(1)
  31. end,
  32. {description = "switch to next screen", group = "screen"}),
  33. k(":root.screen_previous",
  34. function()
  35. awful.screen.focus_relative(-1)
  36. end,
  37. {description = "switch to previous screen", group = "screen"}),
  38. k(":root.client_swap",
  39. function()
  40. awful.client.focus.history.previous()
  41. if client.focus then
  42. client.focus:raise()
  43. end
  44. end,
  45. {description = "go back", group = "client"}),
  46. k(":root.spawn_terminal",
  47. function()
  48. awful.spawn(global.terminal)
  49. end,
  50. {description = "open terminal", group = "launcher"}),
  51. k(":root.spawn_browser",
  52. function()
  53. awful.spawn(global.browser)
  54. end,
  55. {description = "open browser", group = "launcher"}),
  56. k(":root.toggle_titlebars",
  57. function (c)
  58. awesome.emit_signal("titlebar::toggle")
  59. end ,
  60. {description = "(un)hide all titlebars", group = "client"}),
  61. table.unpack(custom_keys))
  62. root.keys(keys)
  63. local buttons = gears.table.join(
  64. awful.button({}, 3, function() end),
  65. awful.button({}, 4, awful.tag.viewnext),
  66. awful.button({}, 5, awful.tag.viewprev)
  67. )
  68. root.buttons(buttons)
  69. local clientkeys = gears.table.join(
  70. k(":client.kill",
  71. function(c)
  72. c:kill()
  73. end,
  74. {description = "close client", group = "client"}),
  75. k(":client.cycle_screen",
  76. function(c)
  77. c:move_to_screen()
  78. end,
  79. {description = "move to screen", group = "client"}),
  80. k(":client.ontop",
  81. function(c)
  82. c.ontop = not c.ontop
  83. end,
  84. {description = "toggle ontop", group = "client"}),
  85. k(":client.below",
  86. function(c)
  87. c.below = not c.below
  88. end,
  89. {description = "toggle below", group = "client"}),
  90. k(":client.fullscreen",
  91. function(c)
  92. c.fullscreen = not c.fullscreen
  93. c:raise()
  94. end,
  95. {description = "toggle fullscreen", group = "client"}),
  96. k(":client.minimize",
  97. function (c)
  98. c.minimized = true
  99. end ,
  100. {description = "minimize", group = "client"}),
  101. k(":client.maximize",
  102. function (c)
  103. c.maximized = not c.maximized
  104. c:raise()
  105. end ,
  106. {description = "(un)maximize", group = "client"}),
  107. k(":client.pin",
  108. function (c)
  109. c.sticky = not c.sticky
  110. end ,
  111. {description = "(un)pin", group = "client"}),
  112. k(":client.toggle_titlebars",
  113. function (c)
  114. c:emit_signal("titlebar::toggle")
  115. end ,
  116. {description = "(un)hide titlebars", group = "client"}))
  117. awful.rules.rules[1].properties.keys = clientkeys
  118. local clientbuttons = gears.table.join(
  119. awful.button({ }, 1, function (c)
  120. c:emit_signal("request::activate", "mouse_click", {raise = true})
  121. end),
  122. awful.button({ global.modkey }, 1, function (c)
  123. c:emit_signal("request::activate", "mouse_click", {raise = true})
  124. awful.mouse.client.move(c)
  125. end),
  126. awful.button({ global.modkey }, 3, function (c)
  127. c:emit_signal("request::activate", "mouse_click", {raise = true})
  128. awful.mouse.client.resize(c)
  129. end))
  130. awful.rules.rules[1].properties.buttons = clientbuttons