-
-
Notifications
You must be signed in to change notification settings - Fork 385
/
Copy pathconfig.js
83 lines (76 loc) · 3.17 KB
/
config.js
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
"use strict";
// Import
import Gdk from 'gi://Gdk';
import GLib from 'gi://GLib';
import App from 'resource:///com/github/Aylur/ags/app.js'
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js'
// Stuff
import userOptions from './modules/.configuration/user_options.js';
import { firstRunWelcome, startBatteryWarningService } from './services/messages.js';
import { startAutoDarkModeService } from './services/darkmode.js';
// Widgets
import { Bar, BarCornerTopleft, BarCornerTopright } from './modules/bar/main.js';
import Cheatsheet from './modules/cheatsheet/main.js';
// import DesktopBackground from './modules/desktopbackground/main.js';
import Dock from './modules/dock/main.js';
import Corner from './modules/screencorners/main.js';
import Crosshair from './modules/crosshair/main.js';
import Indicator from './modules/indicators/main.js';
import Osk from './modules/onscreenkeyboard/main.js';
import Overview from './modules/overview/main.js';
import Session from './modules/session/main.js';
import SideLeft from './modules/sideleft/main.js';
import SideRight from './modules/sideright/main.js';
import { WallpaperPicker, autoWallpaper } from './modules/wallpaper/main.js';
import { COMPILED_STYLE_DIR } from './init.js';
const range = (length, start = 1) => Array.from({ length }, (_, i) => i + start);
function forMonitors(widget) {
const n = Gdk.Display.get_default()?.get_n_monitors() || 1;
return range(n, 0).map(widget).flat(1);
}
function forMonitorsAsync(widget) {
const n = Gdk.Display.get_default()?.get_n_monitors() || 1;
return range(n, 0).forEach((n) => widget(n).catch(print))
}
// Start stuff
handleStyles(true);
autoWallpaper();
startAutoDarkModeService().catch(print);
firstRunWelcome().catch(print);
startBatteryWarningService().catch(print);
const Windows = () => [
// forMonitors(DesktopBackground),
forMonitors(Crosshair),
Overview(),
forMonitors(Indicator),
forMonitors(Cheatsheet),
SideLeft(),
SideRight(),
// forMonitors(Dock),
forMonitors(Osk),
forMonitors(Session),
...(userOptions.dock.enabled ? [forMonitors(Dock)] : []),
...(userOptions.appearance.fakeScreenRounding !== 0 ? [
forMonitors((id) => Corner(id, 'top left', true)),
forMonitors((id) => Corner(id, 'top right', true)),
] : []),
forMonitors((id) => Corner(id, 'bottom left', userOptions.appearance.fakeScreenRounding !== 0)),
forMonitors((id) => Corner(id, 'bottom right', userOptions.appearance.fakeScreenRounding !== 0)),
forMonitors(BarCornerTopleft),
forMonitors(BarCornerTopright),
forMonitors(WallpaperPicker),
];
const CLOSE_ANIM_TIME = 210; // Longer than actual anim time to make sure widgets animate fully
const closeWindowDelays = {}; // For animations
for (let i = 0; i < (Gdk.Display.get_default()?.get_n_monitors() || 1); i++) {
closeWindowDelays[`osk${i}`] = CLOSE_ANIM_TIME;
}
App.config({
css: `${COMPILED_STYLE_DIR}/style.css`,
stackTraceOnError: true,
closeWindowDelay: closeWindowDelays,
windows: Windows().flat(1),
});
// Stuff that don't need to be toggled. And they're async so ugh...
forMonitorsAsync(Bar);
// Bar().catch(print); // Use this to debug the bar. Single monitor only.