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.

88 lines
4.2 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
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. -- 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,args.vertical)
  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(t.icon({
  24. image = (client.focus and client.focus.floating and floating_on) or floating_off,
  25. id = "icon"
  26. }),{
  27. forced_height = style.button.forced_height,
  28. forced_width = style.button.forced_width
  29. }))
  30. floating:connect_signal("button::press",style.button.onpress)
  31. floating:connect_signal("button::release",style.button.onrelease)
  32. floating:connect_signal("button::press",function(widget)
  33. client.focus.floating = (not client.focus.floating)
  34. widget:emit_signal("widget::update",widget)
  35. end)
  36. floating:connect_signal("widget::update",function(widget)
  37. local icon = widget:get_children_by_id("icon")[1]
  38. icon.image = (client.focus.floating and floating_on) or floating_off
  39. end)
  40. local ontop = wibox.widget(t.button(t.icon({
  41. image = (client.focus and client.focus.ontop and ontop_on) or ontop_off,
  42. id = "icon"
  43. }),{
  44. forced_height = style.button.forced_height,
  45. forced_width = style.button.forced_width
  46. }))
  47. ontop:connect_signal("button::press",style.button.onpress)
  48. ontop:connect_signal("button::release",style.button.onrelease)
  49. ontop:connect_signal("button::press",function(widget)
  50. client.focus.ontop = (not client.focus.ontop)
  51. widget:emit_signal("widget::update",widget)
  52. end)
  53. ontop:connect_signal("widget::update",function(widget)
  54. local icon = widget:get_children_by_id("icon")[1]
  55. icon.image = (client.focus.ontop and ontop_on) or ontop_off
  56. end)
  57. local sticky = wibox.widget(t.button(t.icon({
  58. image = (client.focus and client.focus.sticky and sticky_on) or sticky_off,
  59. id = "icon"
  60. }),{
  61. forced_height = style.button.forced_height,
  62. forced_width = style.button.forced_width
  63. }))
  64. sticky:connect_signal("button::press",style.button.onpress)
  65. sticky:connect_signal("button::release",style.button.onrelease)
  66. sticky:connect_signal("button::press",function(widget)
  67. client.focus.sticky = (not client.focus.sticky)
  68. widget:emit_signal("widget::update",widget)
  69. end)
  70. sticky:connect_signal("widget::update",function(widget)
  71. local icon = widget:get_children_by_id("icon")[1]
  72. icon.image = (client.focus.sticky and sticky_on) or sticky_off
  73. end)
  74. client.connect_signal("focus",function(c)
  75. sticky:emit_signal("widget::update")
  76. ontop:emit_signal("widget::update")
  77. floating:emit_signal("widget::update")
  78. end)
  79. local widget = wibox.widget({
  80. floating,
  81. ontop,
  82. sticky,
  83. layout = wibox.layout.fixed.horizontal,
  84. spacing = style.base.spacing
  85. })
  86. return widget
  87. end