2024-11-19 23:55:17 -05:00
|
|
|
import { execAsync } from 'astal';
|
|
|
|
import { App } from 'astal/gtk3';
|
2024-11-01 18:16:43 -04:00
|
|
|
|
2024-11-19 23:55:17 -05:00
|
|
|
import style from '../style/main.scss';
|
2024-11-01 18:16:43 -04:00
|
|
|
|
2024-11-19 23:55:17 -05:00
|
|
|
import AppLauncher from '../widgets/applauncher/main';
|
|
|
|
import Bar from '../widgets/bar/wim';
|
|
|
|
import BgLayer from '../widgets/bg-layer/main';
|
|
|
|
import Calendar from '../widgets/date/wim';
|
|
|
|
import Clipboard from '../widgets/clipboard/main';
|
|
|
|
import Corners from '../widgets/corners/main';
|
|
|
|
import IconBrowser from '../widgets/icon-browser/main';
|
|
|
|
import { NotifPopups, NotifCenter } from '../widgets/notifs/wim';
|
|
|
|
import OSD from '../widgets/osd/main';
|
|
|
|
import PowerMenu from '../widgets/powermenu/main';
|
|
|
|
import Screenshot from '../widgets/screenshot/main';
|
2024-11-01 18:16:43 -04:00
|
|
|
|
2024-11-19 23:55:17 -05:00
|
|
|
import { closeAll, perMonitor } from '../lib';
|
|
|
|
import Brightness from '../services/brightness';
|
|
|
|
import MonitorClicks from '../services/monitor-clicks';
|
2024-11-01 18:16:43 -04:00
|
|
|
|
|
|
|
|
2024-11-19 23:55:17 -05:00
|
|
|
export default () => {
|
2024-11-01 18:16:43 -04:00
|
|
|
App.start({
|
|
|
|
css: style,
|
|
|
|
|
2024-11-07 10:39:28 -05:00
|
|
|
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')) {
|
2024-11-20 23:38:41 -05:00
|
|
|
Brightness.get_default().fetchCapsState();
|
2024-11-07 10:39:28 -05:00
|
|
|
respond('fetched caps_lock state');
|
|
|
|
}
|
|
|
|
else if (request.startsWith('Brightness.screen')) {
|
2024-11-20 23:38:41 -05:00
|
|
|
Brightness.get_default().screen += parseFloat(request.replace('Brightness.screen ', ''));
|
2024-11-07 10:39:28 -05:00
|
|
|
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');
|
|
|
|
}
|
2024-11-01 18:16:43 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
main: () => {
|
2024-11-01 18:24:03 -04:00
|
|
|
execAsync('hyprpaper').catch(() => { /**/ });
|
2024-11-01 18:16:43 -04:00
|
|
|
|
2024-11-18 10:40:40 -05:00
|
|
|
perMonitor((monitor) => BgLayer(monitor, true));
|
|
|
|
|
2024-11-01 18:16:43 -04:00
|
|
|
AppLauncher();
|
|
|
|
Bar();
|
|
|
|
Calendar();
|
|
|
|
Clipboard();
|
|
|
|
Corners();
|
|
|
|
IconBrowser();
|
|
|
|
NotifPopups();
|
|
|
|
NotifCenter();
|
|
|
|
OSD();
|
|
|
|
PowerMenu();
|
|
|
|
Screenshot();
|
|
|
|
|
2024-11-20 23:38:41 -05:00
|
|
|
Brightness.get_default({
|
2024-11-01 18:16:43 -04:00
|
|
|
kbd: 'tpacpi::kbd_backlight',
|
|
|
|
caps: 'input1::capslock',
|
|
|
|
});
|
2024-11-20 23:38:41 -05:00
|
|
|
MonitorClicks.get_default();
|
2024-11-01 18:16:43 -04:00
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|