40 lines
1.3 KiB
TypeScript

import { App } from "astal/gtk3"
import style from "./style.scss"
import notifications from "./components/notifications/handler";
App.start({
instanceName: "runner",
css: style,
main() {
notifications.startNotificationHandler( 0, App.get_monitors()[0] )
},
requestHandler(request, res) {
const args = request.trimStart().split( ' ' );
// Notifications
if ( args[ 0 ] === 'notifier' ) {
if ( args[ 1 ] == 'show' ) {
notifications.openNotificationMenu( 0 );
res( 'Showing all open notifications' );
} else if ( args[ 1 ] == 'hide' ) {
notifications.closeNotificationMenu( 0 );
res( 'Hid all notifications' );
} else if ( args[ 1 ] == 'clear' ) {
notifications.clearAllNotifications( 0 );
res( 'Cleared all notifications' );
} else if ( args[ 1 ] == 'clear-newest' ) {
notifications.clearNewestNotifications( 0 );
res( 'Cleared newest notification' );
} else if ( args[ 1 ] == 'toggle' ) {
notifications.toggleNotificationMenu( 0 );
res( 'Toggled notifications' );
} else {
res( 'Unknown command!' );
}
} else if ( args[ 0 ] === 'bar' ) {
}
},
})