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.

72 lines
2.9 KiB

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