]> git.madduck.net Git - etc/awesome.git/blob - util/separators.lua

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

quake: iterate on all screens; #339
[etc/awesome.git] / util / separators.lua
1 --[[
2
3      Licensed under GNU General Public License v2
4       * (c) 2015, Luke Bonham
5       * (c) 2015, plotnikovanton
6
7 --]]
8
9 local wibox     = require("wibox")
10 local gears     = require("gears")
11
12 -- Lain Cairo separators util submodule
13 -- lain.util.separators
14 local separators = { height = 0, width = 9 }
15
16 -- [[ Arrow
17
18 -- Right
19 function separators.arrow_right(col1, col2)
20     local widget = wibox.widget.base.make_widget()
21
22     widget.fit = function(m, w, h)
23         return separators.width, separators.height
24     end
25
26     widget.draw = function(mycross, wibox, cr, width, height)
27         if col2 ~= "alpha" then
28             cr:set_source_rgb(gears.color.parse_color(col2))
29             cr:new_path()
30             cr:move_to(0, 0)
31             cr:line_to(width, height/2)
32             cr:line_to(width, 0)
33             cr:close_path()
34             cr:fill()
35
36             cr:new_path()
37             cr:move_to(0, height)
38             cr:line_to(width, height/2)
39             cr:line_to(width, height)
40             cr:close_path()
41             cr:fill()
42         end
43
44         if col1 ~= "alpha" then
45             cr:set_source_rgb(gears.color.parse_color(col1))
46             cr:new_path()
47             cr:move_to(0, 0)
48             cr:line_to(width, height/2)
49             cr:line_to(0, height)
50             cr:close_path()
51             cr:fill()
52         end
53    end
54
55    return widget
56 end
57
58 -- Left
59 function separators.arrow_left(col1, col2)
60     local widget = wibox.widget.base.make_widget()
61
62     widget.fit = function(m, w, h)
63         return separators.width, separators.height
64     end
65
66     widget.draw = function(mycross, wibox, cr, width, height)
67         if col1 ~= "alpha" then
68             cr:set_source_rgb(gears.color.parse_color(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
76             cr:new_path()
77             cr:move_to(width, height)
78             cr:line_to(0, height/2)
79             cr:line_to(0, height)
80             cr:close_path()
81             cr:fill()
82         end
83
84         if col2 ~= "alpha" then
85             cr:new_path()
86             cr:move_to(width, 0)
87             cr:line_to(0, height/2)
88             cr:line_to(width, height)
89             cr:close_path()
90
91             cr:set_source_rgb(gears.color.parse_color(col2))
92             cr:fill()
93         end
94    end
95
96    return widget
97 end
98
99 -- ]]
100
101 return separators