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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
local awful = require("awful")
local wibox = require("wibox")
local beautiful = require("beautiful")
-- 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 widget_volume = volume_control.textbox
-- store widgets here
local spacing = 8
local separator = { widget = wibox.widget.separator, opacity = 0 }
local widgets = {
spacing = spacing, -- constant
layoutlist = wibox.widget {
layout = wibox.layout.fixed.horizontal,
buttons = layout_buttons,
wibox.container.margin(
classiclayoutbox(s),
spacing, spacing, 0, 0
),
},
taglist = function(s) return awful.widget.taglist {
screen = s,
filter = awful.widget.taglist.filter.noempty,
buttons = taglist_buttons,
} end,
tasklist = function(s) return wibox.widget {
layout = wibox.layout.align.horizontal,
expand = "outside",
separator,
awful.widget.tasklist {
screen = s,
filter = awful.widget.tasklist.filter.focused,
buttons = tasklist_buttons,
widget_template = {
id = "text_role",
widget = wibox.widget.textbox,
align = "center",
},
},
separator,
} end,
textclock = wibox.widget.textclock("%A, %B %e, %-I:%M %p"),
cpu = wibox.widget {
layout = wibox.layout.fixed.horizontal,
wibox.widget.textbox "CPU: ",
widget_cpu_usage,
wibox.widget.textbox "% ",
widget_temperature "/sys/class/hwmon/hwmon2/temp1_input", -- FIXME
wibox.widget.textbox "°",
},
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,
buttons = volume_buttons,
wibox.widget.textbox "BAT: ",
widget_battery,
},
}
-- left widget group func
function widgets.left_widgets(s) return wibox.widget {
layout = wibox.layout.fixed.horizontal,
spacing = spacing,
{
layout = wibox.layout.fixed.horizontal,
widgets.layoutlist,
widgets.taglist(s),
},
widgets.tasklist(s),
} end
-- miggle 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 = spacing,
widgets.cpu,
widgets.ram,
widgets.vol,
widgets.bat,
},
{
widget = wibox.widget.separator,
opacity = 0,
forced_width = spacing
},
--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 = spacing,
widgets.left_widgets(s),
widgets.middle_widgets(s),
widgets.right_widgets(s),
}
end)
---- signal for changing tasklist filter based on layout
---- DOESNT WORK TODO
--local naughty = require("naughty")
--s:connect_signal("property::layout", function()
-- naughty.notify({
-- title = "Hello, AwesomeWM!",
-- text = "This is a notification.",
-- timeout = 5, -- Timeout in seconds
-- position = "top_right" -- Position on the screen
-- })
-- if awful.layout.get(s) == awful.layout.suit.max then
-- s.mytasklist.filter = awful.widget.tasklist.filter.currenttags
-- else
-- s.mytasklist.filter = awful.widget.tasklist.filter.focused
-- end
--end
--)
return widgets
|