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.

91 lines
4.3 KiB

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. -- Additional client controls, hidden for cleaner UI in the submenu.
  9. local awmtk2 = require("awmtk2")
  10. local wibox = require("wibox")
  11. local beautiful = require("beautiful")
  12. return function(args)
  13. local style = awmtk2.create_style("client_buttons",
  14. awmtk2.generic.button_list,args.style)
  15. local templates = awmtk2.create_template_lib("client_buttons",awmtk2.templates,args.templates)
  16. local t = awmtk2.build_templates(templates,style)
  17. local floating_on = beautiful.titlebar_floating_button_normal_inactive
  18. local floating_off = beautiful.titlebar_floating_button_normal_active
  19. local ontop_on = beautiful.titlebar_ontop_button_normal_inactive
  20. local ontop_off = beautiful.titlebar_ontop_button_normal_active
  21. local sticky_on = beautiful.titlebar_sticky_button_normal_inactive
  22. local sticky_off = beautiful.titlebar_sticky_button_normal_active
  23. local floating = wibox.widget(t.button({
  24. image = (client.focus and client.focus.floating and floating_on) or floating_off,
  25. widget = wibox.widget.imagebox,
  26. id = "icon"
  27. },{
  28. forced_height = style.button.forced_height,
  29. forced_width = style.button.forced_width
  30. }))
  31. floating:connect_signal("button::press",style.button.onpress)
  32. floating:connect_signal("button::release",style.button.onrelease)
  33. floating:connect_signal("button::press",function(widget)
  34. client.focus.floating = (not client.focus.floating)
  35. widget:emit_signal("widget::update",widget)
  36. end)
  37. floating:connect_signal("widget::update",function(widget)
  38. local icon = widget:get_children_by_id("icon")[1]
  39. icon.image = (client.focus.floating and floating_on) or floating_off
  40. end)
  41. local ontop = wibox.widget(t.button({
  42. image = (client.focus and client.focus.ontop and ontop_on) or ontop_off,
  43. widget = wibox.widget.imagebox,
  44. id = "icon"
  45. },{
  46. forced_height = style.button.forced_height,
  47. forced_width = style.button.forced_width
  48. }))
  49. ontop:connect_signal("button::press",style.button.onpress)
  50. ontop:connect_signal("button::release",style.button.onrelease)
  51. ontop:connect_signal("button::press",function(widget)
  52. client.focus.ontop = (not client.focus.ontop)
  53. widget:emit_signal("widget::update",widget)
  54. end)
  55. ontop:connect_signal("widget::update",function(widget)
  56. local icon = widget:get_children_by_id("icon")[1]
  57. icon.image = (client.focus.ontop and ontop_on) or ontop_off
  58. end)
  59. local sticky = wibox.widget(t.button({
  60. image = (client.focus and client.focus.sticky and sticky_on) or sticky_off,
  61. widget = wibox.widget.imagebox,
  62. id = "icon"
  63. },{
  64. forced_height = style.button.forced_height,
  65. forced_width = style.button.forced_width
  66. }))
  67. sticky:connect_signal("button::press",style.button.onpress)
  68. sticky:connect_signal("button::release",style.button.onrelease)
  69. sticky:connect_signal("button::press",function(widget)
  70. client.focus.sticky = (not client.focus.sticky)
  71. widget:emit_signal("widget::update",widget)
  72. end)
  73. sticky:connect_signal("widget::update",function(widget)
  74. local icon = widget:get_children_by_id("icon")[1]
  75. icon.image = (client.focus.sticky and sticky_on) or sticky_off
  76. end)
  77. client.connect_signal("focus",function(c)
  78. sticky:emit_signal("widget::update")
  79. ontop:emit_signal("widget::update")
  80. floating:emit_signal("widget::update")
  81. end)
  82. local widget = wibox.widget({
  83. floating,
  84. ontop,
  85. sticky,
  86. layout = wibox.layout.fixed.horizontal,
  87. spacing = style.base.spacing
  88. })
  89. return widget
  90. end