From 50fac6ad56fe9493e55a4f5b1db0a8f707b114b6 Mon Sep 17 00:00:00 2001 From: teamcons Date: Fri, 12 Sep 2025 16:20:53 +0200 Subject: [PATCH 01/10] use native handler --- src/MainWindow.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index a329344..d343bc2 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -33,6 +33,7 @@ public class Badger.MainWindow : Gtk.Window { construct { Intl.setlocale (); + hide_on_close = true; settings = new GLib.Settings ("com.github.elfenware.badger.timers"); // We cannot resize window if it is allowed to change @@ -84,7 +85,6 @@ public class Badger.MainWindow : Gtk.Window { // Avoid a bug whence reopened windows cannot be closed private bool before_destroy () { - hide (); - return true; + return false; } } From 403659794eca9a16ad97ffdeae4e41048b21353e Mon Sep 17 00:00:00 2001 From: teamcons Date: Fri, 12 Sep 2025 16:23:49 +0200 Subject: [PATCH 02/10] prettier option declaration --- src/Application.vala | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/Application.vala b/src/Application.vala index 76f0f57..0945026 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -104,15 +104,10 @@ public class Badger.Application : Gtk.Application { public override int command_line (ApplicationCommandLine command_line) { stdout.printf ("\n💲️ Command line mode started"); - OptionEntry[] options = new OptionEntry[2]; - options[0] = { - "headless", 0, 0, OptionArg.NONE, - ref headless, "Run without window", null - }; - options[1] = { - "request-autostart", 0, 0, OptionArg.NONE, - ref ask_autostart, "Request autostart permission", null - }; + OptionEntry[] options = { + {"request-autostart", 'r', 0, OptionArg.NONE, ref ask_autostart, "Request autostart permission", null}, + {"headless", 'h', 0, OptionArg.NONE, ref headless, "Run without window", null}, + } // We have to make an extra copy of the array, since .parse assumes // that it can remove strings from the array without freeing them. From 374d8a85ac52027b3f28c27d165837dfa9bfe8ca Mon Sep 17 00:00:00 2001 From: teamcons Date: Fri, 12 Sep 2025 16:24:25 +0200 Subject: [PATCH 03/10] i forgot the semicolon --- src/Application.vala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Application.vala b/src/Application.vala index 0945026..1f195cd 100644 --- a/src/Application.vala +++ b/src/Application.vala @@ -107,7 +107,7 @@ public class Badger.Application : Gtk.Application { OptionEntry[] options = { {"request-autostart", 'r', 0, OptionArg.NONE, ref ask_autostart, "Request autostart permission", null}, {"headless", 'h', 0, OptionArg.NONE, ref headless, "Run without window", null}, - } + }; // We have to make an extra copy of the array, since .parse assumes // that it can remove strings from the array without freeing them. From 7c52dce86451624a9cd5283e6e2e422d129c5c2a Mon Sep 17 00:00:00 2001 From: teamcons Date: Fri, 12 Sep 2025 16:27:13 +0200 Subject: [PATCH 04/10] Do not linger if toggle is off --- src/MainWindow.vala | 1 + 1 file changed, 1 insertion(+) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index d343bc2..b888106 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -85,6 +85,7 @@ public class Badger.MainWindow : Gtk.Window { // Avoid a bug whence reopened windows cannot be closed private bool before_destroy () { + if (!settings.get_boolean ("all")) { application.quit ();}; return false; } } From db103d842f7b74bb007dd6e53961663702194f01 Mon Sep 17 00:00:00 2001 From: teamcons Date: Fri, 12 Sep 2025 16:29:50 +0200 Subject: [PATCH 05/10] Explicit in debug --- src/MainWindow.vala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index b888106..27ddb3a 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -85,7 +85,10 @@ public class Badger.MainWindow : Gtk.Window { // Avoid a bug whence reopened windows cannot be closed private bool before_destroy () { - if (!settings.get_boolean ("all")) { application.quit ();}; + if (!settings.get_boolean ("all")) { + debug ("All reminders are disabled, Badger will now go to sleep"); + application.quit (); + }; return false; } } From dec0ca0a2a5852ac0926b3b535f0a408764f362c Mon Sep 17 00:00:00 2001 From: teamcons Date: Fri, 12 Sep 2025 16:30:05 +0200 Subject: [PATCH 06/10] remove unnecessary newlines --- src/MainWindow.vala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 27ddb3a..d8b4d3a 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -73,11 +73,11 @@ public class Badger.MainWindow : Gtk.Window { } private void on_toggle_changed () { - debug ("\nToggle changed!"); + debug ("Toggle changed!"); main.revealer.reveal_child = settings.get_boolean ("all"); if (!settings.get_boolean ("all")) { - debug ("\nToggle is off! Resizing window"); + debug ("Toggle is off! Resizing window"); set_size_request (12, 12); queue_resize (); } From 5f8569e9da3d26422574d58244c9d0c47e7a25fe Mon Sep 17 00:00:00 2001 From: teamcons Date: Fri, 12 Sep 2025 16:31:22 +0200 Subject: [PATCH 07/10] add debug --- src/MainWindow.vala | 1 + 1 file changed, 1 insertion(+) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index d8b4d3a..57b301d 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -85,6 +85,7 @@ public class Badger.MainWindow : Gtk.Window { // Avoid a bug whence reopened windows cannot be closed private bool before_destroy () { + debug ("Window closed!"); if (!settings.get_boolean ("all")) { debug ("All reminders are disabled, Badger will now go to sleep"); application.quit (); From 3496bf316f932bd4259c22f0f01849236bd1ddbe Mon Sep 17 00:00:00 2001 From: teamcons Date: Fri, 12 Sep 2025 16:59:42 +0200 Subject: [PATCH 08/10] Withdraw older notification before notifying same thing --- src/Reminder.vala | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Reminder.vala b/src/Reminder.vala index 90cf41b..575eda2 100644 --- a/src/Reminder.vala +++ b/src/Reminder.vala @@ -68,6 +68,7 @@ public class Badger.Reminder : GLib.Object { public bool remind () { if (global_active && checkbox_active) { + app.withdraw_notification (name); app.send_notification (name, notification); } return true; From 213f15666a15bc2bd46a08e0a89bf8d03d68b3ca Mon Sep 17 00:00:00 2001 From: Stella and Charlie <147658063+teamcons@users.noreply.github.com> Date: Sat, 13 Sep 2025 17:19:51 +0200 Subject: [PATCH 09/10] Undo withdraw notif. Will do in a separate branch --- src/Reminder.vala | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Reminder.vala b/src/Reminder.vala index 575eda2..90cf41b 100644 --- a/src/Reminder.vala +++ b/src/Reminder.vala @@ -68,7 +68,6 @@ public class Badger.Reminder : GLib.Object { public bool remind () { if (global_active && checkbox_active) { - app.withdraw_notification (name); app.send_notification (name, notification); } return true; From a5f58a3b077c2e7573265b088e217057e4e183a6 Mon Sep 17 00:00:00 2001 From: Stella and Charlie <147658063+teamcons@users.noreply.github.com> Date: Sat, 13 Sep 2025 17:47:00 +0200 Subject: [PATCH 10/10] Move this to separate branch --- src/MainWindow.vala | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 57b301d..de927a8 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -85,11 +85,6 @@ public class Badger.MainWindow : Gtk.Window { // Avoid a bug whence reopened windows cannot be closed private bool before_destroy () { - debug ("Window closed!"); - if (!settings.get_boolean ("all")) { - debug ("All reminders are disabled, Badger will now go to sleep"); - application.quit (); - }; return false; } }