My configuration files for Debian/Ubuntu applications
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

118 satır
2.8 KiB

  1. --[[
  2. Licensed under GNU General Public License v2
  3. * (c) 2015, Luca CPZ
  4. * (c) 2015, plotnikovanton
  5. --]]
  6. local wibox = require("wibox")
  7. local gears = require("gears")
  8. -- Lain Cairo separators util submodule
  9. -- lain.util.separators
  10. local separators = { height = 0, width = 9 }
  11. -- [[ Arrow
  12. -- Right
  13. function separators.arrow_right(col1, col2)
  14. local widget = wibox.widget.base.make_widget()
  15. widget.col1 = col1
  16. widget.col2 = col2
  17. widget.fit = function(_, _, _)
  18. return separators.width, separators.height
  19. end
  20. widget.update = function(_, _)
  21. widget.col1 = col1
  22. widget.col2 = col2
  23. widget:emit_signal("widget::redraw_needed")
  24. end
  25. widget.draw = function(_, _, cr, width, height)
  26. if widget.col2 ~= "alpha" then
  27. cr:set_source_rgba(gears.color.parse_color(widget.col2))
  28. cr:new_path()
  29. cr:move_to(0, 0)
  30. cr:line_to(width, height/2)
  31. cr:line_to(width, 0)
  32. cr:close_path()
  33. cr:fill()
  34. cr:new_path()
  35. cr:move_to(0, height)
  36. cr:line_to(width, height/2)
  37. cr:line_to(width, height)
  38. cr:close_path()
  39. cr:fill()
  40. end
  41. if widget.col1 ~= "alpha" then
  42. cr:set_source_rgba(gears.color.parse_color(widget.col1))
  43. cr:new_path()
  44. cr:move_to(0, 0)
  45. cr:line_to(width, height/2)
  46. cr:line_to(0, height)
  47. cr:close_path()
  48. cr:fill()
  49. end
  50. end
  51. return widget
  52. end
  53. -- Left
  54. function separators.arrow_left(col1, col2)
  55. local widget = wibox.widget.base.make_widget()
  56. widget.col1 = col1
  57. widget.col2 = col2
  58. widget.fit = function(_, _, _)
  59. return separators.width, separators.height
  60. end
  61. widget.update = function(c1, c2)
  62. widget.col1 = c1
  63. widget.col2 = c2
  64. widget:emit_signal("widget::redraw_needed")
  65. end
  66. widget.draw = function(_, _, cr, width, height)
  67. if widget.col1 ~= "alpha" then
  68. cr:set_source_rgba(gears.color.parse_color(widget.col1))
  69. cr:new_path()
  70. cr:move_to(width, 0)
  71. cr:line_to(0, height/2)
  72. cr:line_to(0, 0)
  73. cr:close_path()
  74. cr:fill()
  75. cr:new_path()
  76. cr:move_to(width, height)
  77. cr:line_to(0, height/2)
  78. cr:line_to(0, height)
  79. cr:close_path()
  80. cr:fill()
  81. end
  82. if widget.col2 ~= "alpha" then
  83. cr:new_path()
  84. cr:move_to(width, 0)
  85. cr:line_to(0, height/2)
  86. cr:line_to(width, height)
  87. cr:close_path()
  88. cr:set_source_rgba(gears.color.parse_color(widget.col2))
  89. cr:fill()
  90. end
  91. end
  92. return widget
  93. end
  94. -- ]]
  95. return separators