diff options
author | Aylur <[email protected]> | 2024-09-01 14:17:36 +0200 |
---|---|---|
committer | Aylur <[email protected]> | 2024-09-01 14:17:36 +0200 |
commit | 3e3f045d650a839d21f7b649da7aa5c19bd2e38b (patch) | |
tree | 9a974eb0d38932d474940288c662bd1f01ea3088 /tray/src/cli.vala | |
parent | 408faee16911ccfaa3e7dad69f9938fd4a696704 (diff) |
monorepo structuring
Diffstat (limited to 'tray/src/cli.vala')
-rw-r--r-- | tray/src/cli.vala | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/tray/src/cli.vala b/tray/src/cli.vala deleted file mode 100644 index 3147fb5..0000000 --- a/tray/src/cli.vala +++ /dev/null @@ -1,54 +0,0 @@ -static bool version; -static bool daemonize; - -const OptionEntry[] options = { - { "version", 'v', OptionFlags.NONE, OptionArg.NONE, ref version, "Print version number", null }, - { "daemonize", 'd', OptionFlags.NONE, OptionArg.NONE, ref daemonize, "Monitor the systemtray", null }, - { null }, -}; - -int main(string[] argv) { - try { - var opts = new OptionContext(); - opts.add_main_entries(options, null); - opts.set_help_enabled(true); - opts.set_ignore_unknown_options(false); - opts.parse(ref argv); - } catch (OptionError err) { - printerr (err.message); - return 1; - } - - if (version) { - print(AstalTray.VERSION); - return 0; - } - - if (daemonize) { - var loop = new MainLoop(); - var tray = new AstalTray.Tray(); - - tray.item_added.connect((id) => { - AstalTray.TrayItem item = tray.get_item(id); - - stdout.printf("{\"event\":\"item_added\",\"id\":\"%s\",\"item\":%s}\n", - id, item.to_json_string()); - stdout.flush(); - - item.changed.connect(() => { - stdout.printf("{\"event\":\"item_changed\",\"id\":\"%s\",\"item\":%s}\n", - id, item.to_json_string()); - stdout.flush(); - }); - }); - - tray.item_removed.connect((id) => { - stdout.printf("{\"event\":\"item_removed\",\"id\":\"%s\"}\n", id); - stdout.flush(); - }); - - loop.run(); - } - - return 0; -} |