-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrc.lua
61 lines (45 loc) · 1.86 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
require("paths")
require("error-handling")
local gears = require("gears")
-- if AWM_DEBUG set in environment then require debug
Debugger = nil
if os.getenv("AWM_DEBUG") == '1' then
Debugger = require("awm-debug")
end
-- global namespace, on top before require any modules
RC = {
-- Reading:
-- https://github.com/djfdyuruiry/lua-di
diModule = require("sub.lua-di.lua-di.DependencyInjectionModule")
(function(config)
-- Only Register:
-- Singletons (i.e. types that need to be instantiated only once)
-- Values
-- Providers
-- Otherwise you should be using the auto configuration
config.enableAutoConfiguration()
--
-- Singletons
-- Note: Singletons must be instantiated by a provider
config.bindings.types.workspaceManagerService = "workspaceManagerService"
config.singletons.workspaceManagerService = true
config.providers.workspaceManagerService = function()
return RC.diModule.getInstance("rabbithole.services.workspaceManagerService")
end
config.bindings.types.theme = "rabbithole.services.theme-loader"
config.singletons.theme = true -- change theme from a singleton when we implement a live theme-switcher
config.bindings.types.dragondrop = "dragondrop"
config.singletons.dragondrop = true
config.providers.dragondrop = function()
return RC.diModule.getInstance("rabbithole.services.dragondrop")
end
--
-- Values
if gears.filesystem.file_readable(gears.filesystem.get_configuration_dir() .. "/settings.lua") then
config.bindings.values.settings = require("settings")
else
config.bindings.values.settings = require("settings-lxqt")
end
end)
}
RC.environment = RC.diModule.getInstance("rabbithole.environment")