1 -- Widget and layout library
2 local wibox = require("wibox")
5 local volume_widget = require("widgets/volume_widget")
6 local battery_widget = require("widgets/battery_widget")
7 -- Create a textclock widget
8 mytextclock = awful.widget.textclock()
11 -- Create a wibox for each screen and add it
16 mytaglist.buttons = awful.util.table.join(
17 awful.button({ }, 1, awful.tag.viewonly),
18 awful.button({ modkey }, 1, awful.client.movetotag),
19 awful.button({ }, 3, awful.tag.viewtoggle),
20 awful.button({ modkey }, 3, awful.client.toggletag),
21 awful.button({ }, 4, function(t) awful.tag.viewnext(awful.tag.getscreen(t)) end),
22 awful.button({ }, 5, function(t) awful.tag.viewprev(awful.tag.getscreen(t)) end)
25 mytasklist.buttons = awful.util.table.join(
26 awful.button({ }, 1, function (c)
27 if c == client.focus then
30 -- Without this, the following
31 -- :isvisible() makes no sense
33 if not c:isvisible() then
34 awful.tag.viewonly(c:tags()[1])
36 -- This will also un-minimize
37 -- the client, if needed
42 awful.button({ }, 2, function (c) c:kill() end),
43 awful.button({ }, 3, function ()
48 instance = awful.menu.clients({ width=250 })
51 awful.button({ }, 4, function ()
52 awful.client.focus.byidx(1)
53 if client.focus then client.focus:raise() end
55 awful.button({ }, 5, function ()
56 awful.client.focus.byidx(-1)
57 if client.focus then client.focus:raise() end
61 for s = 1, screen.count() do
62 -- Create a promptbox for each screen
63 mypromptbox[s] = awful.widget.prompt()
64 -- Create an imagebox widget which will contains an icon indicating which layout we're using.
65 -- We need one layoutbox per screen.
66 mylayoutbox[s] = awful.widget.layoutbox(s)
67 mylayoutbox[s]:buttons(awful.util.table.join(
68 awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
69 awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
70 awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
71 awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
72 -- Create a taglist widget
73 mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all, mytaglist.buttons)
75 -- Create a tasklist widget
76 mytasklist[s] = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
79 mywibox[s] = awful.wibox({ position = "top", screen = s })
81 -- Widgets that are aligned to the left
82 local left_layout = wibox.layout.fixed.horizontal()
83 left_layout:add(mylauncher)
84 left_layout:add(mytaglist[s])
85 left_layout:add(mypromptbox[s])
87 -- Widgets that are aligned to the right
88 local right_layout = wibox.layout.fixed.horizontal()
89 if s == 1 then right_layout:add(wibox.widget.systray()) end
90 right_layout:add(volume_widget)
91 right_layout:add(battery_widget)
92 right_layout:add(mytextclock)
93 right_layout:add(mylayoutbox[s])
95 -- Now bring it all together (with the tasklist in the middle)
96 local layout = wibox.layout.align.horizontal()
97 layout:set_left(left_layout)
98 layout:set_middle(mytasklist[s])
99 layout:set_right(right_layout)
101 mywibox[s]:set_widget(layout)