summaryrefslogtreecommitdiff
path: root/Userland/Utilities/notify.cpp
blob: 5be167dd0b6c4cf5327a791669ffe7a5a22e71c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
 * Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <LibCore/ArgsParser.h>
#include <LibGUI/Application.h>
#include <LibGUI/Notification.h>
#include <LibGfx/Bitmap.h>
#include <stdio.h>

int main(int argc, char** argv)
{
    auto app = GUI::Application::construct(argc, argv);

    Core::ArgsParser args_parser;
    const char* title = nullptr;
    const char* message = nullptr;
    const char* icon_path = nullptr;
    args_parser.add_positional_argument(title, "Title of the notification", "title");
    args_parser.add_positional_argument(message, "Message to display in the notification", "message");
    args_parser.add_positional_argument(icon_path, "Path of icon to display in the notification", "icon-path", Core::ArgsParser::Required::No);
    args_parser.parse(argc, argv);

    auto notification = GUI::Notification::construct();
    notification->set_text(message);
    notification->set_title(title);
    notification->set_icon(Gfx::Bitmap::load_from_file(icon_path));
    notification->show();

    return 0;
}