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.

182 lines
6.7 KiB

2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
1 year ago
1 year 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 keys = gears.table.join(
  17. k(':root.tag_next',
  18. awful.tag.viewnext,
  19. {description = "switch to next tag", group = "client"}),
  20. k(':root.tag_prev',
  21. awful.tag.viewprev,
  22. {description = "switch to previous tag", group = "client"}),
  23. k(':root.client_next',
  24. function()
  25. awful.client.focus.byidx(1)
  26. end,
  27. {description = "switch to next client", group = "client"}),
  28. k(":root.client_previous",
  29. function()
  30. awful.client.focus.byidx(-1)
  31. end,
  32. {description = "switch to previous client", group = "client"}),
  33. k(":root.screen_next",
  34. function()
  35. awful.screen.focus_relative(1)
  36. end,
  37. {description = "switch to next screen", group = "screen"}),
  38. k(":root.screen_previous",
  39. function()
  40. awful.screen.focus_relative(-1)
  41. end,
  42. {description = "switch to previous screen", group = "screen"}),
  43. k(":root.client_swap",
  44. function()
  45. awful.client.focus.history.previous()
  46. if client.focus then
  47. client.focus:raise()
  48. end
  49. end,
  50. {description = "go back", group = "client"}),
  51. k(":root.spawn_terminal",
  52. function()
  53. awful.spawn(global.terminal)
  54. end,
  55. {description = "open terminal", group = "launcher"}),
  56. k(":root.spawn_browser",
  57. function()
  58. awful.spawn(global.browser)
  59. end,
  60. {description = "open browser", group = "launcher"}),
  61. k(":root.toggle_titlebars",
  62. function (c)
  63. awesome.emit_signal("titlebar::toggle")
  64. end ,
  65. {description = "(un)hide all titlebars", group = "client"}),
  66. k(":layout.increase_master",
  67. function() awful.tag.incmwfact(0.05) end,
  68. {description = "increase master width factor", group = "layout"}),
  69. k(":layout.decrease_master",
  70. function() awful.tag.incmwfact(-0.05) end,
  71. {description = "decrease master width factor", group = "layout"}),
  72. k(":layout.increase_master_count",
  73. function() awful.tag.incnmaster(1, nil, true) end,
  74. {description = "increase the number of master clients", group = "layout"}),
  75. k(":layout.decrease_master_count",
  76. function() awful.tag.incnmaster(-1, nil, true) end,
  77. {description = "decrease the number of master clients", group = "layout"}),
  78. k(":layout.increase_column_count",
  79. function() awful.tag.incncol(1, nil, true) end,
  80. {description = "increase the number of columns", group = "layout"}),
  81. k(":layout.decrease_column_count",
  82. function() awful.tag.incncol(-1, nil, true) end,
  83. {description = "decrease the number of columns", group = "layout"}),
  84. k(":layout.next_layout",
  85. function() awful.layout.inc(1) end,
  86. {description = "next layout", group = "layout"}),
  87. k(":layout.prev_layout",
  88. function() awful.layout.inc(-1) end,
  89. {description = "previous layout", group = "layout"}),
  90. k(":layout.swap_next_client",
  91. function() awful.client.swap.byidx(1) end,
  92. {description = "swap with next client by index", group = "client"}),
  93. k(":layout.swap_next_client",
  94. function() awful.client.swap.byidx(-1) end,
  95. {description = "swap with previous client by index", group = "client"}),
  96. table.unpack(custom_keys))
  97. root.keys(keys)
  98. local buttons = gears.table.join(
  99. awful.button({}, 3, function() end),
  100. awful.button({}, 4, awful.tag.viewnext),
  101. awful.button({}, 5, awful.tag.viewprev)
  102. )
  103. root.buttons(buttons)
  104. local clientkeys = gears.table.join(
  105. k(":client.kill",
  106. function(c)
  107. c:kill()
  108. end,
  109. {description = "close client", group = "client"}),
  110. k(":client.cycle_screen",
  111. function(c)
  112. c:move_to_screen()
  113. end,
  114. {description = "move to screen", group = "client"}),
  115. k(":client.ontop",
  116. function(c)
  117. c.ontop = not c.ontop
  118. end,
  119. {description = "toggle ontop", group = "client"}),
  120. k(":client.below",
  121. function(c)
  122. c.below = not c.below
  123. end,
  124. {description = "toggle below", group = "client"}),
  125. k(":client.fullscreen",
  126. function(c)
  127. c.fullscreen = not c.fullscreen
  128. c:raise()
  129. end,
  130. {description = "toggle fullscreen", group = "client"}),
  131. k(":client.minimize",
  132. function (c)
  133. c.minimized = true
  134. end ,
  135. {description = "minimize", group = "client"}),
  136. k(":client.maximize",
  137. function (c)
  138. c.maximized = not c.maximized
  139. c:raise()
  140. end ,
  141. {description = "(un)maximize", group = "client"}),
  142. k(":client.pin",
  143. function (c)
  144. c.sticky = not c.sticky
  145. end ,
  146. {description = "(un)pin", group = "client"}),
  147. k(":client.toggle_titlebars",
  148. function (c)
  149. c:emit_signal("titlebar::toggle")
  150. end ,
  151. {description = "(un)hide titlebars", group = "client"}),
  152. k(":client.swap_to_master",
  153. function (c)
  154. c:swap(awful.client.getmaster())
  155. end,
  156. {description = "swap with master", group = "client"}),
  157. k(":client.move_to_screen",
  158. function (c)
  159. c:move_to_screen()
  160. end,
  161. {description = "move to screen", group = "client"}))
  162. awful.rules.rules[1].properties.keys = clientkeys
  163. local clientbuttons = gears.table.join(
  164. awful.button({ }, 1, function (c)
  165. c:emit_signal("request::activate", "mouse_click", {raise = true})
  166. end),
  167. awful.button({ global.modkey }, 1, function (c)
  168. c:emit_signal("request::activate", "mouse_click", {raise = true})
  169. awful.mouse.client.move(c)
  170. end),
  171. awful.button({ global.modkey }, 3, function (c)
  172. c:emit_signal("request::activate", "mouse_click", {raise = true})
  173. awful.mouse.client.resize(c)
  174. end)
  175. )
  176. awful.rules.rules[1].properties.buttons = clientbuttons