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-12-19 18:04:12 -05:00
|
|
|
import AppLauncher from '../widgets/applauncher';
|
2024-12-07 14:17:37 -05:00
|
|
|
import AudioWindow from '../widgets/audio/wim';
|
2024-11-19 23:55:17 -05:00
|
|
|
import Bar from '../widgets/bar/wim';
|
2024-12-19 18:04:12 -05:00
|
|
|
import BgLayer from '../widgets/bg-layer';
|
2024-12-04 00:18:11 -05:00
|
|
|
import BluetoothWindow from '../widgets/bluetooth/wim';
|
2024-11-19 23:55:17 -05:00
|
|
|
import Calendar from '../widgets/date/wim';
|
2024-12-19 18:04:12 -05:00
|
|
|
import Clipboard from '../widgets/clipboard';
|
|
|
|
import Corners from '../widgets/corners';
|
|
|
|
import IconBrowser from '../widgets/icon-browser';
|
2024-12-19 17:46:57 -05:00
|
|
|
import NetworkWindow from '../widgets/network/wim';
|
2024-11-19 23:55:17 -05:00
|
|
|
import { NotifPopups, NotifCenter } from '../widgets/notifs/wim';
|
2024-12-19 18:04:12 -05:00
|
|
|
import OnScreenDisplay from '../widgets/on-screen-display';
|
|
|
|
import OnScreenKeyboard from '../widgets/on-screen-keyboard';
|
|
|
|
import PowerMenu from '../widgets/powermenu';
|
|
|
|
import Screenshot from '../widgets/screenshot';
|
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-12-14 19:36:54 -05:00
|
|
|
import Tablet from '../services/tablet';
|
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');
|
|
|
|
}
|
2024-12-14 19:36:54 -05:00
|
|
|
|
|
|
|
else if (request.startsWith('show-osk')) {
|
|
|
|
const tablet = Tablet.get_default();
|
|
|
|
|
|
|
|
if (tablet.currentMode === 'tablet') {
|
|
|
|
if (tablet.oskState) {
|
|
|
|
respond('osk state was unchanged');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
tablet.oskState = true;
|
|
|
|
tablet.oskAutoChanged = true;
|
|
|
|
respond('osk was shown');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
respond('osk state was unchanged');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (request.startsWith('hide-osk')) {
|
|
|
|
const tablet = Tablet.get_default();
|
|
|
|
|
|
|
|
if (tablet.currentMode === 'tablet') {
|
|
|
|
if (tablet.oskState && tablet.oskAutoChanged) {
|
|
|
|
tablet.oskState = false;
|
|
|
|
tablet.oskAutoChanged = true;
|
|
|
|
respond('osd was hidden');
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
respond('osk state was unchanged');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
respond('osk state was unchanged');
|
|
|
|
}
|
|
|
|
}
|
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();
|
2024-12-07 14:17:37 -05:00
|
|
|
AudioWindow();
|
2024-11-01 18:16:43 -04:00
|
|
|
Bar();
|
2024-12-04 00:18:11 -05:00
|
|
|
BluetoothWindow();
|
2024-11-01 18:16:43 -04:00
|
|
|
Calendar();
|
|
|
|
Clipboard();
|
|
|
|
Corners();
|
|
|
|
IconBrowser();
|
2024-12-19 17:46:57 -05:00
|
|
|
NetworkWindow();
|
2024-11-01 18:16:43 -04:00
|
|
|
NotifPopups();
|
|
|
|
NotifCenter();
|
2024-11-25 12:18:46 -05:00
|
|
|
OnScreenDisplay();
|
|
|
|
OnScreenKeyboard();
|
2024-11-01 18:16:43 -04:00
|
|
|
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
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|