Guest User

keybindings.lua

a guest
Jan 13th, 2024
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.61 KB | None | 0 0
  1. local gears = require("gears")
  2. local awful = require("awful")
  3. local scratch = require("scratch")
  4.  
  5. modkey = "Mod4"
  6. altkey = "Mod1"
  7.  
  8. bindings = {}
  9. bindings.keyboard = {
  10. client = gears.table.join(
  11. awful.key({ modkey, }, "f",
  12. function(c)
  13. c.fullscreen = not c.fullscreen
  14. c:raise()
  15. end),
  16.  
  17. awful.key({ modkey, "Shift" }, "a", function(c)
  18. c:kill()
  19. end),
  20.  
  21. awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle),
  22.  
  23. awful.key({ modkey, }, "n",
  24. function(c)
  25. c.minimized = true
  26. end)
  27.  
  28. ),
  29.  
  30. global = gears.table.join(
  31. awful.key({ modkey, }, "s", function () scratch.toggle(discord,{ class = "discord" })
  32. end ),
  33.  
  34. awful.key({ modkey, }, "Tab", awful.tag.history.restore),
  35.  
  36. awful.key({ modkey, }, "Right",
  37. function ()
  38. awful.client.focus.byidx(1)
  39. end
  40. ),
  41.  
  42. awful.key({ modkey, }, "Left",
  43. function ()
  44. awful.client.focus.byidx(-1)
  45. end
  46. ),
  47.  
  48. awful.key({ modkey, "Shift" }, "Right", function () awful.client.swap.byidx(1)
  49. end ),
  50.  
  51. awful.key({ modkey, "Shift" }, "Left", function () awful.client.swap.byidx(-1)
  52. end ),
  53.  
  54. awful.key({ modkey, }, "Escape",
  55. function ()
  56. if apps.visible then
  57. apps.visible = false
  58. else
  59. apps.visible = true
  60. end
  61. end ),
  62.  
  63. awful.key({ modkey, }, "Return",
  64. function () scratch.toggle(terminal,{ class = "kitty" })
  65. end
  66. ),
  67.  
  68. awful.key({ modkey, "Control" }, "r", awesome.restart),
  69.  
  70. awful.key({ modkey, "Shift" }, "q", awesome.quit),
  71.  
  72. awful.key({ modkey }, "d", function () awful.spawn.with_shell("rofi -show drun")
  73. end )
  74. ),}
  75. bindings.clientbuttons = {
  76. global = gears.table.join(
  77. awful.button({ }, 1, function(c)
  78. c:emit_signal("request::activate", "mouse_click", { raise = true })
  79. end),
  80. awful.button({ modkey }, 3, function(c)
  81. c:emit_signal("request::activate", "mouse_click", { raise = true })
  82. awful.mouse.client.move(c)
  83. end),
  84. awful.button({ modkey }, 1, function(c)
  85. c:emit_signal("request::activate", "mouse_click", { raise = true })
  86. awful.mouse.client.resize(c)
  87. end)
  88. ),
  89. }
  90.  
  91. for i = 1, 9 do
  92. bindings.keyboard = {
  93. global = gears.table.join(bindings.keyboard.global,
  94. awful.key({ modkey }, "#" .. i + 9,
  95. function ()
  96. local screen = awful.screen.focused()
  97. local tag = screen.tags[i]
  98. if tag then
  99. if tag~=screen.selected_tag then
  100. awful.spawn.with_shell("nitrogen --random --set-tiled")
  101. end
  102. tag:view_only()
  103. end
  104. end,
  105. {description = "view tag #"..i, group = "tag"}),
  106.  
  107. awful.key({ modkey, "Control" }, "#" .. i + 9,
  108. function ()
  109. local screen = awful.screen.focused()
  110. local tag = screen.tags[i]
  111. if tag then
  112. awful.tag.viewtoggle(tag)
  113. end
  114. end,
  115. {description = "toggle tag #" .. i, group = "tag"}),
  116.  
  117. awful.key({ modkey, "Shift" }, "#" .. i + 9,
  118. function ()
  119. if client.focus then
  120. local tag = client.focus.screen.tags[i]
  121. if tag then
  122. client.focus:move_to_tag(tag)
  123. end
  124. end
  125. end,
  126. {description = "move focused client to tag #"..i, group = "tag"}),
  127.  
  128. awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
  129. function ()
  130. if client.focus then
  131. local tag = client.focus.screen.tags[i]
  132. if tag then
  133. client.focus:toggle_tag(tag)
  134. end
  135. end
  136. end,
  137. {description = "toggle focused client on tag #" .. i, group = "tag"})
  138. )
  139. }
  140. end
  141.  
  142. return bindings
Add Comment
Please, Sign In to add comment