-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwidgets.lua
76 lines (63 loc) · 2.62 KB
/
widgets.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
local vicious = require("modules.vicious")
local awful = require("awful")
local beautiful = require("beautiful")
awful.widget.tasklist = require("awful.widget.tasklist")
local wibox = require("wibox")
-- {{{ Wibar
-- Create a textclock widget
mytextclock = wibox.widget.textclock()
-- Create mem usage widget
memwidget = wibox.widget.textbox()
vicious.cache(vicious.widgets.mem)
vicious.register(memwidget, vicious.widgets.mem, " $1% ($2Mb/$3Mb) ", 5)
-- Create cpu usage widget
cpuwidget = wibox.widget.textbox()
vicious.register(cpuwidget, vicious.widgets.cpu, " $1% |", 5)
-- Create a wibox for each screen and add it
mywibox = {}
mypromptbox = {}
mylayoutbox = {}
mytaglist = {}
mytasklist = {}
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
menu = mymainmenu })
for s = 1, screen.count() do
-- Create a promptbox for each screen
mypromptbox[s] = awful.widget.prompt()
-- Create an imagebox widget which will contains an icon indicating which
-- layout we're using. We need one layoutbox per screen.
mylayoutbox[s] = awful.widget.layoutbox(s)
mylayoutbox[s]:buttons(awful.util.table.join(
awful.button({ }, 1, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
-- Create a taglist widget
mytaglist[s] = awful.widget.taglist(s, awful.widget.taglist.filter.all,
mytaglist.buttons)
-- Create a tasklist widget
mytasklist[s] = awful.widget.tasklist(s,
awful.widget.tasklist.filter.currenttags, mytasklist.buttons)
-- Create the wibox
mywibox[s] = awful.wibar({ position = "top", height = "24", screen = s })
-- Widgets that are aligned to the left
local left_layout = wibox.layout.fixed.horizontal()
left_layout:add(mylauncher)
left_layout:add(mytaglist[s])
left_layout:add(mypromptbox[s])
-- Widgets that are aligned to the right
local right_layout = wibox.layout.fixed.horizontal()
right_layout:add(cpuwidget)
right_layout:add(memwidget)
--right_layout:add(musicwidget.widget)
right_layout:add(wibox.widget.systray())
right_layout:add(mytextclock)
right_layout:add(mylayoutbox[s])
-- Now bring it all together (with the tasklist in the middle)
local layout = wibox.layout.align.horizontal()
layout:set_left(left_layout)
layout:set_middle(mytasklist[s])
layout:set_right(right_layout)
mywibox[s]:set_widget(layout)
end
-- }}}