nixos-configs/nixosModules/ags-v2/config/app.ts

90 lines
2.3 KiB
TypeScript
Raw Normal View History

2024-10-30 23:43:37 -04:00
import { execAsync } from 'astal';
import { App } from 'astal/gtk3';
2024-10-22 13:09:39 -04:00
import GLib from 'gi://GLib';
2024-10-22 00:14:39 -04:00
import style from './style/main.scss';
2024-10-18 00:44:45 -04:00
import AppLauncher from './widgets/applauncher/main';
2024-09-26 23:55:06 -04:00
import Bar from './widgets/bar/wim';
import BgFade from './widgets/bg-fade/main';
2024-10-21 16:35:20 -04:00
import Calendar from './widgets/date/main';
2024-10-30 01:42:20 -04:00
import Clipboard from './widgets/clipboard/main';
2024-10-12 16:48:23 -04:00
import Corners from './widgets/corners/main';
import IconBrowser from './widgets/icon-browser/main';
2024-10-16 22:33:15 -04:00
import { NotifPopups, NotifCenter } from './widgets/notifs/main';
2024-10-29 20:35:52 -04:00
import OSD from './widgets/osd/main';
import PowerMenu from './widgets/powermenu/main';
2024-10-28 14:45:10 -04:00
import Screenshot from './widgets/screenshot/main';
2024-10-29 00:11:37 -04:00
import { closeAll as closeAllFunc } from './lib';
import BrightnessService from './services/brightness';
2024-10-16 21:44:45 -04:00
import MonitorClicks from './services/monitor-clicks';
2024-10-22 00:14:39 -04:00
import Lockscreen from './widgets/lockscreen/main';
2024-10-29 00:11:37 -04:00
declare global {
function closeAll(): void;
// eslint-disable-next-line
var Brightness: typeof BrightnessService;
}
globalThis.closeAll = closeAllFunc;
globalThis.Brightness = BrightnessService;
2024-10-22 00:14:39 -04:00
const CONF = GLib.getenv('CONF');
switch (CONF) {
case 'lock': {
App.start({
css: style,
instanceName: CONF,
main: () => {
Lockscreen();
},
});
break;
}
case 'wim': {
App.start({
css: style,
2024-09-23 23:52:17 -04:00
2024-10-29 00:11:37 -04:00
requestHandler(js, res) {
App.eval(js).then(res).catch(res);
},
2024-10-22 00:14:39 -04:00
main: () => {
2024-10-30 23:43:37 -04:00
execAsync('hyprpaper').catch(print);
2024-10-22 00:14:39 -04:00
AppLauncher();
Bar();
BgFade();
Calendar();
2024-10-30 01:42:20 -04:00
Clipboard();
2024-10-22 00:14:39 -04:00
Corners();
IconBrowser();
NotifPopups();
NotifCenter();
2024-10-29 20:35:52 -04:00
OSD();
2024-10-22 00:14:39 -04:00
PowerMenu();
2024-10-28 14:45:10 -04:00
Screenshot();
2024-10-29 00:11:37 -04:00
Brightness.initService({
kbd: 'tpacpi::kbd_backlight',
caps: 'input1::capslock',
});
2024-10-22 00:14:39 -04:00
new MonitorClicks();
2024-10-30 23:43:37 -04:00
setTimeout(() => {
App.get_window('win-applauncher')?.set_visible(true);
}, 3 * 1000);
2024-10-22 00:14:39 -04:00
},
});
2024-10-16 21:44:45 -04:00
2024-10-22 00:14:39 -04:00
break;
}
}