-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathapp.ts
More file actions
79 lines (74 loc) · 1.84 KB
/
app.ts
File metadata and controls
79 lines (74 loc) · 1.84 KB
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
import app from "ags/gtk4/app";
import { exec } from "ags/process";
import { monitorFile } from "ags/file";
import GLib from "gi://GLib?version=2.0";
import { picker } from "utils/picker";
// Widgets
import {
Bar,
SystemMenu,
OnScreenDisplay,
Notifications,
LogoutMenu,
PickerWindow,
MusicPlayer,
Sidebar,
} from "./widgets";
// Style paths
const scss = `${GLib.get_user_config_dir()}/ags/style/main.scss`;
const css = `${GLib.get_user_config_dir()}/ags/style/main.css`;
const icons = `${GLib.get_user_config_dir()}/ags/assets/icons`;
const styleDirectories = ["abstracts", "components", "layouts", "base"];
function reloadCss() {
console.log("scss change detected - recompiling...");
exec(`sass ${scss} ${css}`);
app.apply_css(css);
}
app.start({
icons,
css,
instanceName: "matshell",
requestHandler(argv: string[], res: (response: any) => void) {
const request = argv[0];
switch (request) {
case "picker":
app.toggle_window("picker");
res("picker toggled");
break;
case "logout":
app.toggle_window("logout-menu");
res("logout menu toggled");
break;
case "sidebar":
app.toggle_window("sidebar");
res("sidebar toggled");
break;
case "reload-css":
reloadCss();
res("css reloaded");
break;
case "wall-rand":
picker.random("wp");
res("random wallpaper set");
break;
default:
res("not found");
}
},
main() {
// Compile & watch SCSS
exec(`sass ${scss} ${css}`);
styleDirectories.forEach((dir) =>
monitorFile(`${GLib.get_user_config_dir()}/ags/style/${dir}`, reloadCss),
);
// Initialize widgets
Bar();
Notifications();
OnScreenDisplay();
SystemMenu();
MusicPlayer();
PickerWindow();
LogoutMenu();
Sidebar();
},
});