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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
local awful = require("awful")
local wibox = require("wibox")
local beautiful = require("beautiful")
local buttons = require("buttons")
-- load widgets
--local mylauncher = require("widgets.button")
local widget_cpu_usage = require("widgets.cpu")
local widget_ram_usage = require("widgets.ram")
local widget_temperature = require("widgets.temperature")
local widget_battery = require("widgets.battery")
local classiclayoutbox = require("widgets.classiclayouts")
local volume_control = require("widgets.pavolctld")
local tasklist = require("widgets.tasklist")
local widget_volume = volume_control.textbox
-- store widgets here
local widgets = {
temperature_file = nil;
spacing = beautiful.margin_leftright, -- constant
layoutlist = wibox.widget {
layout = wibox.layout.fixed.horizontal,
buttons = layout_buttons,
wibox.container.margin(
classiclayoutbox(s),
beautiful.margin_leftright, beautiful.margin_leftright, 0, 0
),
},
taglist = function(s) return awful.widget.taglist {
screen = s,
filter = awful.widget.taglist.filter.noempty,
buttons = taglist_buttons,
} end,
tasklist = tasklist,
textclock = wibox.widget.textclock {
format = "%A, %B %-e, %-I:%M %p",
font = beautiful.textclock_font,
},
cpu = {
layout = wibox.layout.fixed.horizontal,
wibox.widget.textbox "CPU: ",
widget_cpu_usage,
wibox.widget.textbox "% ",
},
temp = widget_temperature(),
ram = {
layout = wibox.layout.fixed.horizontal,
wibox.widget.textbox "RAM: ",
widget_ram_usage,
wibox.widget.textbox "%",
},
vol = {
layout = wibox.layout.fixed.horizontal,
buttons = volume_buttons,
wibox.widget.textbox "VOL: ",
widget_volume,
wibox.widget.textbox "%",
},
bat = {
layout = wibox.layout.fixed.horizontal,
wibox.widget.textbox "BAT: ",
widget_battery,
},
}
-- left widget group func
function widgets.left_widgets(s) return wibox.widget {
layout = wibox.layout.fixed.horizontal,
spacing = beautiful.margin_leftright,
{
layout = wibox.layout.fixed.horizontal,
widgets.layoutlist,
widgets.taglist(s),
},
widgets.tasklist(s),
} end
-- middle widget group func
function widgets.middle_widgets(s) return wibox.widget {
layout = wibox.layout.fixed.horizontal,
widgets.textclock,
} end
-- right widget group func
function widgets.right_widgets(s) return wibox.widget {
layout = wibox.layout.fixed.horizontal,
{
layout = wibox.layout.fixed.horizontal,
spacing = beautiful.margin_leftright * 2,
{
layout = wibox.layout.fixed.horizontal,
widgets.cpu,
widgets.temp,
},
widgets.ram,
widgets.bat,
widgets.vol,
},
{
widget = wibox.widget.separator,
opacity = 0,
forced_width = beautiful.margin_leftright
},
--mylauncher,
} end
-- create a wibox for each screen and add it
awful.screen.connect_for_each_screen(function (s)
awful.tag({"1", "2", "3", "4", "5", "6", "7", "8", "9"}, s, awful.layout.layouts[1])
s.mypromptbox = awful.widget.prompt()
-- create the wibox
s.mywibox = awful.wibar({ position = "top", screen = s })
-- add widgets to the wibox
s.mywibox:setup {
layout = wibox.layout.align.horizontal,
expand = "none",
spacing = beautiful.margin_leftright,
widgets.left_widgets(s),
wibox.container.margin(
widgets.middle_widgets(s),
beautiful.margin_leftright, beautiful.margin_leftright, 0, 0
),
widgets.right_widgets(s),
}
end)
return widgets
|