2 local utils = require("utils")
4 -- Widget and layout library
5 local wibox = require("wibox")
8 local volume_widget = require("widgets/volume_widget")
9 local battery_widget = { }
10 if utils.host == "chronos" then
11 battery_widget = require("widgets/battery_widget")
13 local network_widget = require("widgets/network_widget")
15 -- Create a textclock widget
16 mytextclock = awful.widget.textclock()
19 -- Create a wibox for each screen and add it
24 mytaglist.buttons = awful.util.table.join(
25 awful.button({ }, 1, awful.tag.viewonly),
26 awful.button({ modkey }, 1, awful.client.movetotag),
27 awful.button({ }, 3, awful.tag.viewtoggle),
28 awful.button({ modkey }, 3, awful.client.toggletag),
29 awful.button({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
30 awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
33 mytasklist.buttons = awful.util.table.join(
34 awful.button({ }, 1, function (c)
35 if c == client.focus then
38 -- Without this, the following
39 -- :isvisible() makes no sense
41 if not c:isvisible() then
42 awful.tag.viewonly(c:tags()[1])
44 -- This will also un-minimize
45 -- the client, if needed
50 awful.button({ }, 2, function (c) c:kill() end),
51 awful.button({ }, 3, function ()
56 instance = awful.menu.clients({ width=250 })
59 awful.button({ }, 4, function ()
60 awful.client.focus.byidx(1)
61 if client.focus then client.focus:raise() end
63 awful.button({ }, 5, function ()
64 awful.client.focus.byidx(-1)
65 if client.focus then client.focus:raise() end
69 for s = 1, screen.count() do
70 -- Create a promptbox for each screen
71 mypromptbox[s] = awful.widget.prompt()
72 -- Create an imagebox widget which will contains an icon indicating which layout we're using.
73 -- We need one layoutbox per screen.
74 mylayoutbox[s] = awful.widget.layoutbox(s)
75 mylayoutbox[s]:buttons(awful.util.table.join(
76 awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
77 awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
78 awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
79 awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
80 -- Create a taglist widget
81 mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
83 -- Create a tasklist widget
84 mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
87 mywibox[s] = awful.wibox({ position = "top", screen = s })
89 -- Widgets that are aligned to the left
90 local left_layout = wibox.layout.fixed.horizontal()
91 left_layout:add(mylauncher)
92 left_layout:add(mytaglist[s])
93 left_layout:add(mypromptbox[s])
95 -- Widgets that are aligned to the right
96 local right_layout = wibox.layout.fixed.horizontal()
97 if s == 1 then right_layout:add(wibox.widget.systray()) end
98 right_layout:add(network_widget)
99 right_layout:add(volume_widget)
100 if utils.host == "chronos" then
101 right_layout:add(battery_widget)
103 right_layout:add(mytextclock)
104 right_layout:add(mylayoutbox[s])
106 -- Now bring it all together (with the tasklist in the middle)
107 local layout = wibox.layout.align.horizontal()
108 layout:set_left(left_layout)
109 layout:set_middle(mytasklist[s])
110 layout:set_right(right_layout)
112 mywibox[s]:set_widget(layout)