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()
18 -- Create a wibox for each screen and add it
23 mytaglist.buttons = awful.util.table.join(
24 awful.button({ }, 1, awful.tag.viewonly),
25 awful.button({ modkey }, 1, awful.client.movetotag),
26 awful.button({ }, 3, awful.tag.viewtoggle),
27 awful.button({ modkey }, 3, awful.client.toggletag),
28 awful.button({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
29 awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
32 mytasklist.buttons = awful.util.table.join(
33 awful.button({ }, 1, function (c)
34 if c == client.focus then
37 -- Without this, the following
38 -- :isvisible() makes no sense
40 if not c:isvisible() then
41 awful.tag.viewonly(c:tags()[1])
43 -- This will also un-minimize
44 -- the client, if needed
49 awful.button({ }, 2, function (c) c:kill() end),
50 awful.button({ }, 3, function ()
55 instance = awful.menu.clients({ width=250 })
58 awful.button({ }, 4, function ()
59 awful.client.focus.byidx(1)
60 if client.focus then client.focus:raise() end
62 awful.button({ }, 5, function ()
63 awful.client.focus.byidx(-1)
64 if client.focus then client.focus:raise() end
68 for s = 1, screen.count() do
69 -- Create a promptbox for each screen
70 mypromptbox[s] = awful.widget.prompt()
71 -- Create an imagebox widget which will contains an icon indicating which layout we're using.
72 -- We need one layoutbox per screen.
73 mylayoutbox[s] = awful.widget.layoutbox(s)
74 mylayoutbox[s]:buttons(awful.util.table.join(
75 awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
76 awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
77 awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
78 awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
79 -- Create a taglist widget
80 mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
82 -- Create a tasklist widget
83 mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
86 mywibox[s] = awful.wibox({ position = "top", screen = s })
88 -- Widgets that are aligned to the left
89 local left_layout = wibox.layout.fixed.horizontal()
90 left_layout:add(mylauncher)
91 left_layout:add(mytaglist[s])
92 left_layout:add(mypromptbox[s])
94 -- Widgets that are aligned to the right
95 local right_layout = wibox.layout.fixed.horizontal()
96 if s == 1 then right_layout:add(wibox.widget.systray()) end
97 right_layout:add(network_widget)
98 right_layout:add(volume_widget)
99 if utils.host == "chronos" then
100 right_layout:add(battery_widget)
102 right_layout:add(mytextclock)
103 right_layout:add(mylayoutbox[s])
105 -- Now bring it all together (with the tasklist in the middle)
106 local layout = wibox.layout.align.horizontal()
107 layout:set_left(left_layout)
108 layout:set_middle(mytasklist[s])
109 layout:set_right(right_layout)
111 mywibox[s]:set_widget(layout)