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.

64 lines
2.3 KiB

2 years ago
  1. -- Basic client control keys
  2. local awmtk2 = require("awmtk2")
  3. local wibox = require("wibox")
  4. local gears = require("gears")
  5. local awful = require("awful")
  6. local beautiful = require("beautiful")
  7. local menugen = require("context_menu")
  8. return function(args)
  9. local style = awmtk2.create_style("client_controls",awmtk2.default,args.style)
  10. local templates = awmtk2.create_template_lib("client_controls",awmtk2.templates,args.templates)
  11. local t = awmtk2.build_templates(templates,style)
  12. local move_to_tag = {}
  13. local add_to_tag = {}
  14. awful.screen.connect_for_each_screen(function(s)
  15. table.insert(move_to_tag,{
  16. "Screen "..s.index,
  17. (function()
  18. local t = {}
  19. for k,v in pairs(s.tags) do
  20. table.insert(t,{v.name,function()
  21. if client.focus then
  22. client.focus:tags({v})
  23. end
  24. end})
  25. end
  26. return t
  27. end)()
  28. })
  29. table.insert(add_to_tag,{
  30. "Screen "..s.index,
  31. (function()
  32. local t = {}
  33. for k,v in pairs(s.tags) do
  34. table.insert(t,{v.name,function()
  35. if client.focus then
  36. local tags = client.focus:tags()
  37. for k,tag in pairs(tags) do
  38. if v == tag then
  39. table.remove(tags,k)
  40. client.focus:tags(tags)
  41. return
  42. end
  43. end
  44. table.insert(tags,v)
  45. client.focus:tags(tags)
  46. end
  47. end})
  48. end
  49. return t
  50. end)()
  51. })
  52. end)
  53. local widget = menugen({
  54. items = {
  55. { "Kill client", function() client.focus:kill() end },
  56. { "Raise client", function() client.focus:raise() end},
  57. { "Lower client", function() client.focus:lower() end},
  58. { "Move to tag", move_to_tag },
  59. { "Switch on tag", add_to_tag }
  60. },
  61. })
  62. return widget
  63. end