nixos-configs/nixosModules/ags/config/configurations/wim.ts
matt1432 6eb0921ec8
All checks were successful
Discord / discord commits (push) Has been skipped
feat(ags): fix centerCursor and add perMonitor
2024-11-18 10:40:40 -05:00

78 lines
2.9 KiB
TypeScript

export default async() => {
const { execAsync } = await import('astal');
const { App } = await import('astal/gtk3');
const style = (await import('../style/main.scss')).default;
const AppLauncher = (await import('../widgets/applauncher/main')).default;
const Bar = (await import('../widgets/bar/wim')).default;
const BgLayer = (await import('../widgets/bg-layer/main')).default;
const Calendar = (await import('../widgets/date/wim')).default;
const Clipboard = (await import('../widgets/clipboard/main')).default;
const Corners = (await import('../widgets/corners/main')).default;
const IconBrowser = (await import('../widgets/icon-browser/main')).default;
const { NotifPopups, NotifCenter } = await import('../widgets/notifs/wim');
const OSD = (await import('../widgets/osd/main')).default;
const PowerMenu = (await import('../widgets/powermenu/main')).default;
const Screenshot = (await import('../widgets/screenshot/main')).default;
const { closeAll, perMonitor } = await import('../lib');
const Brightness = (await import('../services/brightness')).default;
const MonitorClicks = (await import('../services/monitor-clicks')).default;
App.start({
css: style,
requestHandler(request, respond) {
if (request.startsWith('open')) {
App.get_window(request.replace('open ', ''))?.set_visible(true);
respond('window opened');
}
else if (request.startsWith('closeAll')) {
closeAll();
respond('closed all windows');
}
else if (request.startsWith('fetchCapsState')) {
Brightness.fetchCapsState();
respond('fetched caps_lock state');
}
else if (request.startsWith('Brightness.screen')) {
Brightness.screen += parseFloat(request.replace('Brightness.screen ', ''));
respond('screen brightness changed');
}
else if (request.startsWith('popup')) {
popup_osd(request.replace('popup ', ''));
respond('osd popped up');
}
else if (request.startsWith('osk')) {
console.log(`TODO: ${request.replace('osk ', '')}`);
respond('implement this');
}
},
main: () => {
execAsync('hyprpaper').catch(() => { /**/ });
perMonitor((monitor) => BgLayer(monitor, true));
AppLauncher();
Bar();
Calendar();
Clipboard();
Corners();
IconBrowser();
NotifPopups();
NotifCenter();
OSD();
PowerMenu();
Screenshot();
Brightness.initService({
kbd: 'tpacpi::kbd_backlight',
caps: 'input1::capslock',
});
new MonitorClicks();
},
});
};