2 local utils = require("utils")
4 -- Widget and layout library
5 local wibox = require("wibox")
8 local volume_widget = require("widgets/volume_widget")
9 if utils.host == "chronos" then
10 local battery_widget = require("widgets/battery_widget")
12 local network_widget = require("widgets/network_widget")
14 -- Create a textclock widget
15 mytextclock = awful.widget.textclock()
16 separator = wibox.widget.textbox()
17 separator:set_markup('<span font="Symbola 10" color="#404040">│</span>')
20 -- Create a wibox for each screen and add it
25 mytaglist.buttons = awful.util.table.join(
26 awful.button({ }, 1, awful.tag.viewonly),
27 awful.button({ modkey }, 1, awful.client.movetotag),
28 awful.button({ }, 3, awful.tag.viewtoggle),
29 awful.button({ modkey }, 3, awful.client.toggletag),
30 awful.button({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
31 awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
34 mytasklist.buttons = awful.util.table.join(
35 awful.button({ }, 1, function (c)
36 if c == client.focus then
39 -- Without this, the following
40 -- :isvisible() makes no sense
42 if not c:isvisible() then
43 awful.tag.viewonly(c:tags()[1])
45 -- This will also un-minimize
46 -- the client, if needed
51 awful.button({ }, 2, function (c) c:kill() end),
52 awful.button({ }, 3, function ()
57 instance = awful.menu.clients({ width=250 })
60 awful.button({ }, 4, function ()
61 awful.client.focus.byidx(1)
62 if client.focus then client.focus:raise() end
64 awful.button({ }, 5, function ()
65 awful.client.focus.byidx(-1)
66 if client.focus then client.focus:raise() end
70 for s = 1, screen.count() do
71 -- Create a promptbox for each screen
72 mypromptbox[s] = awful.widget.prompt()
73 -- Create an imagebox widget which will contains an icon indicating which layout we're using.
74 -- We need one layoutbox per screen.
75 mylayoutbox[s] = awful.widget.layoutbox(s)
76 mylayoutbox[s]:buttons(awful.util.table.join(
77 awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
78 awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
79 awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
80 awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
81 -- Create a taglist widget
82 mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
84 -- Create a tasklist widget
85 mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
88 mywibox[s] = awful.wibox({ position = "top", screen = s })
90 -- Widgets that are aligned to the left
91 local left_layout = wibox.layout.fixed.horizontal()
92 left_layout:add(mylauncher)
93 left_layout:add(mytaglist[s])
94 left_layout:add(mypromptbox[s])
96 -- Widgets that are aligned to the right
97 local right_layout = wibox.layout.fixed.horizontal()
98 if s == 1 then right_layout:add(wibox.widget.systray()) end
99 right_layout:add(separator)
100 right_layout:add(network_widget)
101 right_layout:add(separator)
102 right_layout:add(volume_widget)
103 if utils.host == "chronos" then
104 right_layout:add(separator)
105 right_layout:add(battery_widget)
107 right_layout:add(separator)
108 right_layout:add(mytextclock)
109 right_layout:add(mylayoutbox[s])
111 -- Now bring it all together (with the tasklist in the middle)
112 local layout = wibox.layout.align.horizontal()
113 layout:set_left(left_layout)
114 layout:set_middle(mytasklist[s])
115 layout:set_right(right_layout)
117 mywibox[s]:set_widget(layout)