From bc709eb5f549cc4843779b0c355b020da9c9c306 Mon Sep 17 00:00:00 2001
From: matt1432 <matt@nelim.org>
Date: Tue, 12 Sep 2023 14:07:20 -0400
Subject: [PATCH] feat(ags): open closer at the same time as windows

---
 config/ags/js/bar/clock.js        | 10 ++++++++--
 config/ags/js/bar/notif-button.js | 10 ++++++++--
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/config/ags/js/bar/clock.js b/config/ags/js/bar/clock.js
index 1de4eb8a..1da870b6 100644
--- a/config/ags/js/bar/clock.js
+++ b/config/ags/js/bar/clock.js
@@ -1,5 +1,5 @@
 const { Box, Label } = ags.Widget;
-const { toggleWindow } = ags.App;
+const { toggleWindow, openWindow } = ags.App;
 const { DateTime } = imports.gi.GLib;
 
 import { EventBox } from '../misc/cursorbox.js';
@@ -24,7 +24,13 @@ export const Clock = EventBox({
   connections: [
     [ags.App, (box, windowName, visible) => {
       if (windowName == 'calendar') {
-        Clock.toggleClassName('toggle-on', visible);
+        if (visible) {
+          Clock.toggleClassName('toggle-on', true);
+          openWindow('closer');
+        }
+        else {
+          Clock.toggleClassName('toggle-on', false);
+        }
       }
     }],
   ],
diff --git a/config/ags/js/bar/notif-button.js b/config/ags/js/bar/notif-button.js
index 99aca965..19b7c59d 100644
--- a/config/ags/js/bar/notif-button.js
+++ b/config/ags/js/bar/notif-button.js
@@ -1,5 +1,5 @@
 const { Box, Label, Icon } = ags.Widget;
-const { toggleWindow } = ags.App;
+const { toggleWindow, openWindow } = ags.App;
 const { Notifications } = ags.Service;
 
 import { Separator } from '../misc/separator.js';
@@ -11,7 +11,13 @@ export const NotifButton = EventBox({
   connections: [
     [ags.App, (box, windowName, visible) => {
       if (windowName == 'notification-center') {
-        NotifButton.toggleClassName('toggle-on', visible);
+        if (visible) {
+          NotifButton.toggleClassName('toggle-on', true);
+          openWindow('closer');
+        }
+        else {
+          NotifButton.toggleClassName('toggle-on', false);
+        }
       }
     }],
   ],