-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrc.lua
149 lines (124 loc) · 6.46 KB
/
rc.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
-- ░█▀▀░█░█░█▀▄░█▀▄░█▀▀░█▀█░█░░
-- ░▀▀█░█░█░█▀▄░█▀▄░█▀▀░█▀█░█░░
-- ░▀▀▀░▀▀▀░▀░▀░▀░▀░▀▀▀░▀░▀░▀▀▀
-- Banner generated using `toilet -f pagga AwesomeWM"
local gears = require('gears')
local beautiful = require('beautiful')
local awful = require('awful')
local naughty = require('naughty')
local revelation = require("library.revelation")
-- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config)
if awesome.startup_errors then
naughty.notification {
urgency = "critical",
title = "Oops, an error happened" .. (startup and " during startup!" or "!"),
message = message
}
end
-- }}}
-- ░█▀▀░█░█░█▀▀░█░░░█░░
-- ░▀▀█░█▀█░█▀▀░█░░░█░░
-- ░▀▀▀░▀░▀░▀▀▀░▀▀▀░▀▀▀
awful.util.shell = 'sh'
-- ░▀█▀░█░█░█▀▀░█▄█░█▀▀
-- ░░█░░█▀█░█▀▀░█░█░█▀▀
-- ░░▀░░▀░▀░▀▀▀░▀░▀░▀▀▀
beautiful.init(require('theme'))
revelation.init()
-- ░█░░░█▀█░█░█░█▀█░█░█░▀█▀
-- ░█░░░█▀█░░█░░█░█░█░█░░█░
-- ░▀▀▀░▀░▀░░▀░░▀▀▀░▀▀▀░░▀░
require('layout')
-- ░█▀▀░█▀█░█▀█░█▀▀░▀█▀░█▀▀░█░█░█▀▄░█▀█░▀█▀░▀█▀░█▀█░█▀█░█▀▀
-- ░█░░░█░█░█░█░█▀▀░░█░░█░█░█░█░█▀▄░█▀█░░█░░░█░░█░█░█░█░▀▀█
-- ░▀▀▀░▀▀▀░▀░▀░▀░░░▀▀▀░▀▀▀░▀▀▀░▀░▀░▀░▀░░▀░░▀▀▀░▀▀▀░▀░▀░▀▀▀
require('configuration.client')
-- require('configuration.root')
require('configuration.tags')
root.keys(require('configuration.keys.global'))
-- ░█▄█░█▀█░█▀▄░█░█░█░░░█▀▀░█▀▀
-- ░█░█░█░█░█░█░█░█░█░░░█▀▀░▀▀█
-- ░▀░▀░▀▀▀░▀▀░░▀▀▀░▀▀▀░▀▀▀░▀▀▀
require('module.notifications')
require('module.auto-start')
require('module.exit-screen')
require('module.brightness-osd')
require('module.kbd-brightness-osd')
require('module.volume-osd')
require('module.lockscreen')
require('module.dynamic-wallpaper')
-- ░█░█░█▀█░█░░░█░░░█▀█░█▀█░█▀█░█▀▀░█▀▄
-- ░█▄█░█▀█░█░░░█░░░█▀▀░█▀█░█▀▀░█▀▀░█▀▄
-- ░▀░▀░▀░▀░▀▀▀░▀▀▀░▀░░░▀░▀░▀░░░▀▀▀░▀░▀
screen.connect_signal(
'request::wallpaper',
function(s)
-- If wallpaper is a function, call it with the screen
if beautiful.wallpaper then
if type(beautiful.wallpaper) == 'string' then
-- Check if beautiful.wallpaper is color/image
if beautiful.wallpaper:sub(1, #'#') == '#' then
-- If beautiful.wallpaper is color
gears.wallpaper.set(beautiful.wallpaper)
elseif beautiful.wallpaper:sub(1, #'/') == '/' then
-- If beautiful.wallpaper is path/image
gears.wallpaper.maximized(beautiful.wallpaper, s)
end
else
beautiful.wallpaper(s)
end
end
end
)
-- ▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
-- ██ ▄▄ █ ▄▄▀█ ▄▄▀█ ▄▄▀█ ▄▄▀█ ▄▄▄█ ▄▄████ ▄▄▀█▀▄▄▀█ ██ ██ ▄▄█▀▄▀█▄ ▄█▀▄▄▀█ ▄▄▀
-- ██ █▀▀█ ▀▀ █ ▀▀▄█ ▄▄▀█ ▀▀ █ █▄▀█ ▄▄████ ████ ██ █ ██ ██ ▄▄█ █▀██ ██ ██ █ ▀▀▄
-- ██ ▀▀▄█▄██▄█▄█▄▄█▄▄▄▄█▄██▄█▄▄▄▄█▄▄▄████ ▀▀▄██▄▄██▄▄█▄▄█▄▄▄██▄███▄███▄▄██▄█▄▄
-- ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
---@diagnostic disable-next-line: param-type-mismatch
collectgarbage("setpause", 160)
---@diagnostic disable-next-line: param-type-mismatch
collectgarbage("setstepmul", 400)
gears.timer.start_new(10, function()
collectgarbage("step", 20000)
return true
end)
-- ______ _ _____
-- | ___ \ | | |_ _|
-- | |_/ /___ ___| |_ ___ _ __ ___ | | __ _ __ _
-- | // _ \/ __| __/ _ \| '__/ _ \ | |/ _` |/ _` |
-- | |\ \ __/\__ \ || (_) | | | __/ | | (_| | (_| |
-- \_| \_\___||___/\__\___/|_| \___| \_/\__,_|\__, |
-- __/ |
-- |___/
local filesystem = require('gears.filesystem')
local config_dir = filesystem.get_configuration_dir()
local utils_dir = config_dir .. 'utilities/'
_G.ws_fname = utils_dir .. "/awesome-last-ws"
local save_current_tag = function()
local f = assert(io.open(ws_fname, "w"))
local t = client.focus and client.focus.first_tag or nil
if t ~= nil then
f:write(t.name, "\n")
end
f:close()
end
local load_last_active_tag = function()
local f = assert(io.open(ws_fname, "r"))
local tag_name = f:read("*line")
f:close()
local t = awful.tag.find_by_name(nil, tag_name)
if t ~= nil then
awful.tag.viewnone()
awful.tag.viewtoggle(t)
end
end
awesome.connect_signal("exit", function(c)
if c == true then
-- We are about to restart awesome, save our last used tag
save_current_tag()
end
end)
load_last_active_tag()