Commit 50884b98 authored by Julian Sparber's avatar Julian Sparber
Browse files

add option to start hidden

parent 97f5c6f0
......@@ -21,6 +21,7 @@ namespace Clocks {
public class Application : Gtk.Application {
const OptionEntry[] option_entries = {
{ "version", 'v', 0, OptionArg.NONE, null, N_("Print version information and exit"), null },
{ "hidden", 0, 0, OptionArg.NONE, null, N_("Start without showing a window"), null },
{ null }
};
......@@ -34,11 +35,13 @@ public class Application : Gtk.Application {
private SearchProvider search_provider;
private uint search_provider_id = 0;
private Window window;
private bool start_hidden = false;
private List<string> system_notifications;
private void ensure_window () {
if (window == null) {
window = new Window (this);
window.visible = false;
window.delete_event.connect(() => {
return window.hide_on_delete();
});
......@@ -84,7 +87,10 @@ public class Application : Gtk.Application {
base.activate ();
ensure_window ();
window.present ();
if (!start_hidden)
window.present ();
else
start_hidden = false;
window.focus_in_event.connect (() => {
withdraw_notifications ();
......@@ -127,6 +133,9 @@ public class Application : Gtk.Application {
print ("%s %s\n", Environment.get_application_name (), Config.VERSION);
return 0;
}
if (options.contains("hidden")) {
start_hidden = true;
}
return -1;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment