From e9555789be3f4165befc6960a108adcf82fd4b68 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Mon, 18 Sep 2023 17:39:10 -0400 Subject: [PATCH] feat(ags): only close related window when pressing bar button --- config/ags/js/bar/clock.js | 2 -- config/ags/js/bar/notif-button.js | 2 -- config/ags/js/bar/quick-settings.js | 2 -- config/ags/js/misc/closer.js | 5 +++++ nixos/home/hyprland.nix | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/config/ags/js/bar/clock.js b/config/ags/js/bar/clock.js index 379bfdc..1da870b 100644 --- a/config/ags/js/bar/clock.js +++ b/config/ags/js/bar/clock.js @@ -3,7 +3,6 @@ const { toggleWindow, openWindow } = ags.App; const { DateTime } = imports.gi.GLib; import { EventBox } from '../misc/cursorbox.js'; -import { closeAll } from '../misc/closer.js'; const ClockModule = ({ interval = 1000, @@ -31,7 +30,6 @@ export const Clock = EventBox({ } else { Clock.toggleClassName('toggle-on', false); - closeAll(); } } }], diff --git a/config/ags/js/bar/notif-button.js b/config/ags/js/bar/notif-button.js index de3c136..90cd09d 100644 --- a/config/ags/js/bar/notif-button.js +++ b/config/ags/js/bar/notif-button.js @@ -4,7 +4,6 @@ const { Notifications } = ags.Service; import { Separator } from '../misc/separator.js'; import { EventBox } from '../misc/cursorbox.js'; -import { closeAll } from '../misc/closer.js'; export const NotifButton = EventBox({ className: 'toggle-off', @@ -18,7 +17,6 @@ export const NotifButton = EventBox({ } else { NotifButton.toggleClassName('toggle-on', false); - closeAll(); } } }], diff --git a/config/ags/js/bar/quick-settings.js b/config/ags/js/bar/quick-settings.js index 7e6b384..de19f8f 100644 --- a/config/ags/js/bar/quick-settings.js +++ b/config/ags/js/bar/quick-settings.js @@ -2,7 +2,6 @@ const { Box, Label } = ags.Widget; const { toggleWindow, openWindow } = ags.App; import { EventBox } from '../misc/cursorbox.js'; -import { closeAll } from '../misc/closer.js'; export const QsToggle = EventBox({ className: 'toggle-off', @@ -16,7 +15,6 @@ export const QsToggle = EventBox({ } else { QsToggle.toggleClassName('toggle-on', false); - closeAll(); } } }], diff --git a/config/ags/js/misc/closer.js b/config/ags/js/misc/closer.js index 3cabac7..7337fdd 100644 --- a/config/ags/js/misc/closer.js +++ b/config/ags/js/misc/closer.js @@ -18,5 +18,10 @@ export const Closer = Window({ child: EventBox({ onPrimaryClickRelease: () => closeAll(), + connections: [[ags.App, (box, windowName, visible) => { + if (!Array.from(ags.App.windows).some(w => w[1].visible && w[0] != 'bar' && w[0] != 'notifications' && w[0] != 'closer')) { + closeWindow('closer'); + } + }]], }), }); diff --git a/nixos/home/hyprland.nix b/nixos/home/hyprland.nix index e171f5f..b5a31e2 100644 --- a/nixos/home/hyprland.nix +++ b/nixos/home/hyprland.nix @@ -11,7 +11,7 @@ in { home.packages = [ - (builtins.getFlake "github:matt1432/ags").packages.x86_64-linux.default + (builtins.getFlake "github:Aylur/ags").packages.x86_64-linux.default pkgs.sassc pkgs.kora-icon-theme pkgs.coloryou