-
-
Notifications
You must be signed in to change notification settings - Fork 13
/
rc.lua
213 lines (172 loc) · 5.96 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
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
-- Enable jit if on luajit
pcall(function() jit.on() end)
local gears = require('gears')
-- Localization
os.setlocale(os.getenv("LANG"))
-- Default icon size
awesome.set_preferred_icon_size(256)
local awful_util = require("awful.util")
local awful_spawn = require("awful.spawn")
-- Add third-party modules to lua path
local userconfdir = awful_util.get_configuration_dir()
package.path = package.path .. ';' .. userconfdir .. 'third_party/?.lua;' .. userconfdir .. 'third_party/?/init.lua'
-- Run session and settings daemon
-------------------------------------------------------------------------------
-- option a)
awful_spawn("xsettingsd")
awful_spawn.once("/usr/lib/mate-polkit/polkit-mate-authentication-agent-1")
-- option b)
--awful_spawn.once("lxsession -a -n -r -s awesome -e LXDE")
--awful_spawn.once("lxpolkit")
-- option c)
--awful_spawn.with_shell("gnome-session")
--awful_spawn.with_shell("/usr/lib/gnome-settings-daemon/gnome-settings-daemon")
-- Hotkeys help for apps
-------------------------------------------------------------------------------
-- Enable all available hotkey help maps
local hotkeys_module = require("awful.hotkeys_popup.keys")
-- Set custom rules for tmux help
hotkeys_module.tmux.add_rules_for_terminal({ rule_any = {
class = {"xst-256color"}
}})
-- Load local hotkeys help
require("hotkeys")
-- GLOBAL debug helpers:
-------------------------------------------------------------------------------
local debug = require("actionless.util.debug")
nlog = debug.nlog
log = debug.log
-- Config state object:
-------------------------------------------------------------------------------
local editor = "vim"
local terminal = "xst"
local context = {
--DEVEL_DYNAMIC_LAYOUTS = true,
DEVEL_DYNAMIC_LAYOUTS = false,
modkey = "Mod4",
altkey = "Mod1",
clientbuttons = nil,
clientkeys = nil,
theme_dir = awful_util.getdir("config") .. "/themes/lcars-xresources-hidpi/theme.lua",
--theme_dir = awful_util.getdir("config") .. "/themes/gtk/theme.lua",
--theme_dir = awful_util.getdir("config") .. "/themes/twmish/theme.lua",
-- @TODO: rename to 'widget_config'
config = {
--net_preset = 'netctl-auto',
net_preset = nil,
wlan_if = 'wlp12s0',
eth_if = 'enp0s25',
music_players = { 'spotify', 'clementine' },
swap_screen_hotkeys = false,
have_backlight = false,
},
-- @TODO: move to 'widget_config'?
have_battery = true,
sensors = {
gpu = {
device = 'amdgpu-pci-0100',
sensor = 'temp1',
warning = 89,
},
cpu = {
device = 'k10temp-pci-00c3',
sensor = 'temp1',
warning = 65,
},
},
apw_on_the_left = false,
cmds = {
terminal = terminal,
terminal_light = terminal, -- @TODO: add it
editor_cmd = terminal .. " -e " .. editor,
compositor = "killall compton; compton",
--file_manager = "nautilus",
file_manager = "nemo",
tmux = terminal .. " -e tmux",
--tmux = terminal .. " -e bash \\-c tmux",
--tmux_light = terminal .. " -e bash \\-c tmux", -- @TODO: add it
tmux_run = terminal .. " -e tmux new-session ",
scrot_preview_cmd = "viewnior ~/images/$f",
system_monitor = 'gnome-system-monitor -p',
},
autorun = {},
-- place for custom callbacks:
before_config_loaded = {},
after_config_loaded = {},
extra_global_keys = {},
-- can't be overriden in local settings:
widgets = {},
menu = {},
topwibox = {},
topwibox_layout = {},
lcars_assets = {},
}
-- Override config from local settings file
-------------------------------------------------------------------------------
local workstation_settings_result, workstation_settings_details = gears.protected_call(function()
context = require("config.workstation").init(context) or context
return true
end)
if workstation_settings_result ~= true then
log("!!!WARNING: ~/.config/awesome/config/workstation.lua not found")
print(workstation_settings_details)
end
local local_settings_result, local_settings_details = gears.protected_call(function()
context = require("config.local").init(context) or context
return true
end)
if local_settings_result ~= true then
log("!!!WARNING: ~/.config/awesome/config/local.lua not found")
print(local_settings_details)
end
-- Make it global for debugging:
CONFIG_CONTEXT = context
-- Init default terminal emulator
-------------------------------------------------------------------------------
require("menubar.utils").terminal = context.cmds.terminal
-- Init theme
-------------------------------------------------------------------------------
local beautiful = require("beautiful")
local h_table = require("actionless.util.table")
if not gears.protected_call(function()
beautiful.init(context.theme_dir)
return true
end) or (h_table.getn(beautiful.get()) == 0) then
nlog("CAN'T LOAD THEME, loading default one")
beautiful.init(gears.filesystem.get_themes_dir() .. "xresources/theme.lua")
end
-- Init config
-------------------------------------------------------------------------------
for _, callback in ipairs(context.before_config_loaded) do
if not gears.protected_call(function()
callback()
return true
end) then
nlog('error when calling local config callback, check the logs')
end
end
local config = require("config")
config.notify.init(context)
config.autorun.init(context)
config.menu.init(context)
config.menubar.init(context)
config.layouts.init(context)
config.widgets.init(context)
config.toolbar_horizontal.init(context)
config.keys.init(context)
config.mouse.init(context)
config.signals.init(context)
local persistent = require("actionless.persistent")
if persistent.lcarslist.get() then
--@TODO: somewhere inside a nasty memory leak is hiding:
config.lcars_toolbar_vertical.init(context)
config.lcars_toolbar_horizontal.init(context)
config.lcars_features.init(context)
end
config.rules.init(context)
for _, callback in ipairs(context.after_config_loaded) do
callback()
end
-- END
-------------------------------------------------------------------------------
-- vim: set shiftwidth=2: