import { App } from "astal/gtk3"
import style from "./style.scss"

import not from "./handler"

App.start({
    instanceName: "notifier",
    css: style,
    main() {
        not.startNotificationHandler( 0, App.get_monitors()[0] )
    },
    requestHandler(request, res) {
        if ( request == 'show' ) {
            not.openNotificationMenu( 0 );
            res( 'Showing all open notifications' );
        } else if ( request == 'hide' ) {
            not.closeNotificationMenu( 0 );
            res( 'Hid all notifications' );
        } else if ( request == 'clear' ) {
            not.clearAllNotifications( 0 );
            res( 'Cleared all notifications' );
        } else if ( request == 'clear-newest' ) {
            not.clearNewestNotifications( 0 );
            res( 'Cleared newest notification' );
        } else if ( request == 'toggle' ) {
            not.toggleNotificationMenu( 0 );
            res( 'Toggled notifications' );
        } else {
            res( 'Unknown command!' );
        }
    },
})
