diff options
Diffstat (limited to 'community/gnome-clocks/0002-Add-argument-to-start-initial-instance-in-the-backgr.patch')
-rw-r--r-- | community/gnome-clocks/0002-Add-argument-to-start-initial-instance-in-the-backgr.patch | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/community/gnome-clocks/0002-Add-argument-to-start-initial-instance-in-the-backgr.patch b/community/gnome-clocks/0002-Add-argument-to-start-initial-instance-in-the-backgr.patch new file mode 100644 index 00000000000..f5479ce83fc --- /dev/null +++ b/community/gnome-clocks/0002-Add-argument-to-start-initial-instance-in-the-backgr.patch @@ -0,0 +1,63 @@ +From 94e223701269f5c9e60bd69575b62aca91c0f85a Mon Sep 17 00:00:00 2001 +From: Adam Plumb <adamplumb@gmail.com> +Date: Fri, 10 Sep 2021 20:14:19 -0400 +Subject: [PATCH] Add argument to start initial instance in the background + +--- + src/application.vala | 19 ++++++++++++++++++- + 1 file changed, 18 insertions(+), 1 deletion(-) + +diff --git a/src/application.vala b/src/application.vala +index 6c1e39a..864b277 100644 +--- a/src/application.vala ++++ b/src/application.vala +@@ -21,6 +21,7 @@ namespace Clocks { + public class Application : Adw.Application { + const OptionEntry[] OPTION_ENTRIES = { + { "version", 'v', 0, OptionArg.NONE, null, N_("Print version information and exit"), null }, ++ { "background", 'b', 0, OptionArg.NONE, null, N_("Start in the background"), null }, + { (string) null } + }; + +@@ -37,6 +38,7 @@ public class Application : Adw.Application { + private uint world_clocks_id = 0; + private Window? window; + private List<string> system_notifications; ++ private bool background = false; + + private Window ensure_window () ensures (window != null) { + if (window == null) { +@@ -97,7 +99,15 @@ public class Application : Adw.Application { + base.activate (); + + var win = ensure_window (); +- win.present (); ++ ++ // The first activation will toggle the background flag to false ++ // That way the next activation (of other instances) ++ // will cause the window to display ++ if (background) { ++ background = false; ++ } else { ++ win.present (); ++ } + } + + protected override void startup () { +@@ -117,6 +127,13 @@ public class Application : Adw.Application { + return 0; + } + ++ // This allows the primary instance to start in the background ++ // Any subsequent instances will cause the window to display ++ // Even if they pass in the background argument ++ if (options.contains ("background")) { ++ background = true; ++ } ++ + return -1; + } + +-- +2.35.1 + |