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.

123 lines
5.1 KiB

  1. local awful = require("awful")
  2. local wibox = require("wibox")
  3. local gears = require("gears")
  4. local awmtk2 = require("awmtk2")
  5. local tasklist_buttons = gears.table.join(
  6. awful.button({}, 1, function(c)
  7. if c == client.focus then
  8. c.minimized = true
  9. else
  10. c:emit_signal(
  11. "request::activate",
  12. "tasklist",
  13. {raise = true}
  14. )
  15. end
  16. end),
  17. awful.button({}, 4, function()
  18. awful.client.focus.byidx(1)
  19. end),
  20. awful.button({}, 5, function()
  21. awful.client.focus.byidx(-1)
  22. end)
  23. )
  24. return function(args)
  25. local style = awmtk2.create_style("tasklist", awmtk2.default, args.style)
  26. local templates = awmtk2.create_template_lib("tasklist", awmtk2.templates, args.templates)
  27. local t = awmtk2.build_templates(templates,style)
  28. local button = t.button({
  29. {
  30. {
  31. id = "clienticon",
  32. widget = awful.widget.clienticon
  33. },
  34. (not args.vertical) and t.textbox({
  35. id = "text_role"
  36. }),
  37. layout = wibox.layout.fixed.horizontal,
  38. spacing = style.button.spacing
  39. },
  40. widget = wibox.container.constraint,
  41. strategy="exact",
  42. width = style.button.width,
  43. height = style.button.height,
  44. id = "constraint_task"
  45. },{
  46. create_callback = function(self, c, index, objects)
  47. self:get_children_by_id('clienticon')[1].client = c
  48. -- If for some ungodly reason you enabled the behaviour of the original awesomewm, this script will just stop after setting the client icon.
  49. if self.id == "background_role" then
  50. return
  51. end
  52. local textbox = self:get_children_by_id("text_role")[1] or {}
  53. -- Apparently the original system for changing bgimage is
  54. -- 1) broken
  55. -- 2) uses deprecated functions (nice code practices awesomewm)
  56. -- Solution: write my own. I blame material design for all this.
  57. -- (P.S: Not to bullshit you, check it yourself - replicatable
  58. -- by adding theme.tasklist_bg_image_normal or
  59. -- theme.tasklist_bg_image_focus in current beautiful theme.)
  60. local onfocus = function()
  61. self.bgimage = style.button.bgimage_focus
  62. self.bg = style.button.bg_focus
  63. self.shape = style.button.shape_focus
  64. self.shape_border_width = style.button.shape_border_width_focus
  65. self.shape_border_color = style.button.shape_border_color_focus
  66. textbox.font = style.textbox.font_focus
  67. end
  68. local onunfocus = function()
  69. self.bgimage = style.button.bgimage_normal
  70. self.bg = style.button.bg_normal
  71. self.shape = style.button.shape_normal
  72. self.shape_border_width = style.button.shape_border_width_normal
  73. self.shape_border_color = style.button.shape_border_color_normal
  74. textbox.font = style.textbox.font_normal
  75. end
  76. local onurgent = function()
  77. if not c.urgent then return end
  78. self.bgimage = style.button.bgimage_urgent
  79. self.bg = style.button.bg_urgent
  80. self.shape = style.button.shape_urgent
  81. self.shape_border_width = style.button.shape_border_width_urgent
  82. self.shape_border_color = style.button.shape_border_color_urgent
  83. textbox.font = style.textbox.font_urgent
  84. end
  85. local onminimize = function()
  86. if not c.minimized then return end
  87. self.bgimage = style.button.bgimage_minimize
  88. self.bg = style.button.bg_minimize
  89. self.shape = style.button.shape_minimize
  90. self.shape_border_width = style.button.shape_border_width_minimize
  91. self.shape_border_color = style.button.shape_border_color_minimize
  92. textbox.font = style.textbox.font_minimize
  93. end
  94. c:connect_signal("focus",onfocus)
  95. c:connect_signal("unfocus",onunfocus)
  96. c:connect_signal("property::urgent",onurgent)
  97. c:connect_signal("property::minimized",onminimize)
  98. onfocus()
  99. end,
  100. -- Uncomment this only, and **ONLY** if you actually need it.
  101. --id = "background_role"
  102. })
  103. return awful.widget.tasklist {
  104. screen = args.screen,
  105. filter = awful.widget.tasklist.filter.currenttags,
  106. buttons = tasklist_buttons,
  107. layout = {
  108. -- basically we just map every property of this to beautiful.tasklist.base
  109. spacing = style.base.spacing,
  110. spacing_widget = style.base.spacing_widget,
  111. -- Now THIS is shit racing
  112. layout = (
  113. (args.vertical and style.base.layout_vertical) or
  114. style.base.layout_horizontal
  115. ) or (
  116. (args.vertical and wibox.layout.fixed.vertical) or
  117. wibox.layout.fixed.horizontal
  118. )
  119. },
  120. widget_template = button
  121. }
  122. end