forked from worron/awesome-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rc-orange.lua
312 lines (245 loc) · 11.4 KB
/
rc-orange.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
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
-----------------------------------------------------------------------------------------------------------------------
-- Orange config --
-----------------------------------------------------------------------------------------------------------------------
-- Load modules
-----------------------------------------------------------------------------------------------------------------------
-- Standard awesome library
------------------------------------------------------------
local awful = require("awful")
local wibox = require("wibox")
local beautiful = require("beautiful")
require("awful.autofocus")
-- User modules
------------------------------------------------------------
local redflat = require("redflat")
-- global module
timestamp = require("redflat.timestamp")
-- Error handling
-----------------------------------------------------------------------------------------------------------------------
require("orange.ercheck-config") -- load file with error handling
-- Setup theme and environment vars
-----------------------------------------------------------------------------------------------------------------------
local env = require("orange.env-config") -- load file with environment
env:init({ theme = "orange" })
-- Layouts setup
-----------------------------------------------------------------------------------------------------------------------
local layouts = require("orange.layout-config") -- load file with tile layouts setup
layouts:init()
-- Main menu configuration
-----------------------------------------------------------------------------------------------------------------------
local mymenu = require("orange.menu-config") -- load file with menu configuration
mymenu:init({ env = env })
-- Panel widgets
-----------------------------------------------------------------------------------------------------------------------
-- Separator
--------------------------------------------------------------------------------
local separator = redflat.gauge.separator.vertical()
-- Tasklist
--------------------------------------------------------------------------------
local tasklist = {}
-- load list of app name aliases from files and set it as part of tasklist theme
tasklist.style = { appnames = require("orange.alias-config")}
tasklist.buttons = awful.util.table.join(
awful.button({}, 1, redflat.widget.tasklist.action.select),
awful.button({}, 2, redflat.widget.tasklist.action.close),
awful.button({}, 3, redflat.widget.tasklist.action.menu),
awful.button({}, 4, redflat.widget.tasklist.action.switch_next),
awful.button({}, 5, redflat.widget.tasklist.action.switch_prev)
)
-- Taglist widget
--------------------------------------------------------------------------------
local taglist = {}
taglist.style = { widget = redflat.gauge.tag.orange.new, show_tip = true }
taglist.buttons = awful.util.table.join(
awful.button({ }, 1, function(t) t:view_only() end),
awful.button({ env.mod }, 1, function(t) if client.focus then client.focus:move_to_tag(t) end end),
awful.button({ }, 2, awful.tag.viewtoggle),
awful.button({ }, 3, function(t) redflat.widget.layoutbox:toggle_menu(t) end),
awful.button({ env.mod }, 3, function(t) if client.focus then client.focus:toggle_tag(t) end end),
awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
)
-- Textclock widget
--------------------------------------------------------------------------------
local textclock = {}
textclock.widget = redflat.widget.textclock({ timeformat = "%H:%M", dateformat = "%b %d %a" })
-- Software update indcator
--------------------------------------------------------------------------------
local upgrades = {}
upgrades.widget = redflat.widget.upgrades({ command = env.upgrades })
-- Layoutbox configure
--------------------------------------------------------------------------------
local layoutbox = {}
layoutbox.buttons = awful.util.table.join(
awful.button({ }, 1, function () mymenu.mainmenu:toggle() end),
awful.button({ }, 3, function () redflat.widget.layoutbox:toggle_menu(mouse.screen.selected_tag) end),
awful.button({ }, 4, function () awful.layout.inc( 1) end),
awful.button({ }, 5, function () awful.layout.inc(-1) end)
)
-- Tray widget
--------------------------------------------------------------------------------
local tray = {}
tray.widget = redflat.widget.minitray()
tray.buttons = awful.util.table.join(
awful.button({}, 1, function() redflat.widget.minitray:toggle() end)
)
-- PA volume control
--------------------------------------------------------------------------------
local volume = {}
volume.widget = redflat.widget.pulse(nil, { widget = redflat.gauge.audio.blue.new })
-- activate player widget
redflat.float.player:init({ name = env.player })
volume.buttons = awful.util.table.join(
awful.button({}, 4, function() redflat.widget.pulse:change_volume() end),
awful.button({}, 5, function() redflat.widget.pulse:change_volume({ down = true }) end),
awful.button({}, 2, function() redflat.widget.pulse:mute() end),
awful.button({}, 3, function() redflat.float.player:show() end),
awful.button({}, 1, function() redflat.float.player:action("PlayPause") end),
awful.button({}, 8, function() redflat.float.player:action("Previous") end),
awful.button({}, 9, function() redflat.float.player:action("Next") end)
)
-- Keyboard layout indicator
--------------------------------------------------------------------------------
local kbindicator = {}
kbindicator.widget = redflat.widget.keyboard({ layouts = { "English", "Russian" } })
kbindicator.buttons = awful.util.table.join(
awful.button({}, 1, function () redflat.widget.keyboard:toggle_menu() end),
awful.button({}, 4, function () redflat.widget.keyboard:toggle() end),
awful.button({}, 5, function () redflat.widget.keyboard:toggle(true) end)
)
-- Mail widget
--------------------------------------------------------------------------------
-- safe load private mail settings
local my_mails = {}
pcall(function() my_mails = require("orange.mail-config") end)
-- widget setup
local mail = {}
mail.widget = redflat.widget.mail({ maillist = my_mails })
-- buttons
mail.buttons = awful.util.table.join(
awful.button({ }, 1, function () awful.spawn.with_shell(env.mail) end),
awful.button({ }, 2, function () redflat.widget.mail:update() end)
)
-- System resource monitoring widgets
--------------------------------------------------------------------------------
local sysmon = { widget = {}, buttons = {} }
-- battery
sysmon.widget.battery = redflat.widget.sysmon(
{ func = redflat.system.pformatted.bat(25), arg = "BAT1" },
{ timeout = 60, widget = redflat.gauge.monitor.circle }
)
-- network speed
sysmon.widget.network = redflat.widget.net(
{
interface = "wlp3s0",
speed = { up = 5 * 1024^2, down = 5 * 1024^2 },
autoscale = false
},
{ timeout = 2, widget = redflat.gauge.icon.double }
)
-- CPU usage
sysmon.widget.cpu = redflat.widget.sysmon(
{ func = redflat.system.pformatted.cpu(80) },
{ timeout = 2, widget = redflat.gauge.monitor.circle }
)
sysmon.buttons.cpu = awful.util.table.join(
awful.button({ }, 1, function() redflat.float.top:show("cpu") end)
)
-- RAM usage
sysmon.widget.ram = redflat.widget.sysmon(
{ func = redflat.system.pformatted.mem(80) },
{ timeout = 10, widget = redflat.gauge.monitor.circle }
)
sysmon.buttons.ram = awful.util.table.join(
awful.button({ }, 1, function() redflat.float.top:show("mem") end)
)
-- Screen setup
-----------------------------------------------------------------------------------------------------------------------
-- aliases for setup
local al = awful.layout.layouts
-- setup
awful.screen.connect_for_each_screen(
function(s)
-- wallpaper
env.wallpaper(s)
-- tags
awful.tag({ "Main", "Full", "Edit", "Read", "Free", "Vbox" }, s, { al[5], al[6], al[6], al[4], al[5], al[3] })
-- layoutbox widget
layoutbox[s] = redflat.widget.layoutbox({ screen = s })
-- taglist widget
taglist[s] = redflat.widget.taglist({ screen = s, buttons = taglist.buttons, hint = env.tagtip }, taglist.style)
-- tasklist widget
tasklist[s] = redflat.widget.tasklist({ screen = s, buttons = tasklist.buttons }, tasklist.style)
-- panel wibox
s.panel = awful.wibar({ position = "bottom", screen = s, height = beautiful.panel_height or 36 })
-- add widgets to the wibox
s.panel:setup {
layout = wibox.layout.align.horizontal,
{ -- left widgets
layout = wibox.layout.fixed.horizontal,
env.wrapper(layoutbox[s], "layoutbox", layoutbox.buttons),
separator,
env.wrapper(taglist[s], "taglist"),
separator,
env.wrapper(kbindicator.widget, "keyboard", kbindicator.buttons),
separator,
env.wrapper(mail.widget, "mail", mail.buttons),
separator,
},
{ -- middle widget
layout = wibox.layout.align.horizontal,
expand = "outside",
nil,
env.wrapper(tasklist[s], "tasklist"),
},
{ -- right widgets
layout = wibox.layout.fixed.horizontal,
separator,
env.wrapper(sysmon.widget.network, "network"),
separator,
env.wrapper(sysmon.widget.cpu, "cpu", sysmon.buttons.cpu),
env.wrapper(sysmon.widget.ram, "ram", sysmon.buttons.ram),
env.wrapper(sysmon.widget.battery, "battery"),
separator,
env.wrapper(volume.widget, "volume", volume.buttons),
separator,
env.wrapper(textclock.widget, "textclock"),
separator,
env.wrapper(tray.widget, "tray", tray.buttons),
},
}
end
)
-- Desktop widgets
-----------------------------------------------------------------------------------------------------------------------
local desktop = require("orange.desktop-config") -- load file with desktop widgets configuration
desktop:init({
env = env,
buttons = awful.util.table.join(awful.button({}, 3, function () mymenu.mainmenu:toggle() end))
})
-- Active screen edges
-----------------------------------------------------------------------------------------------------------------------
local edges = require("orange.edges-config") -- load file with edges configuration
edges:init()
-- Key bindings
-----------------------------------------------------------------------------------------------------------------------
local hotkeys = require("orange.keys-config") -- load file with hotkeys configuration
hotkeys:init({ env = env, menu = mymenu.mainmenu })
-- Rules
-----------------------------------------------------------------------------------------------------------------------
local rules = require("orange.rules-config") -- load file with rules configuration
rules:init({ hotkeys = hotkeys})
-- Titlebar setup
-----------------------------------------------------------------------------------------------------------------------
local titlebar = require("orange.titlebar-config") -- load file with titlebar configuration
titlebar:init()
-- Base signal set for awesome wm
-----------------------------------------------------------------------------------------------------------------------
local signals = require("orange.signals-config") -- load file with signals configuration
signals:init({ env = env })
-- Autostart user applications
-----------------------------------------------------------------------------------------------------------------------
local autostart = require("orange.autostart-config") -- load file with autostart application list
if timestamp.is_startup() then
autostart.run()
end