feat(ags): only close related window when pressing bar button

This commit is contained in:
matt1432 2023-09-18 17:39:10 -04:00
parent 7d45c18843
commit e9555789be
5 changed files with 6 additions and 7 deletions

View file

@ -3,7 +3,6 @@ const { toggleWindow, openWindow } = ags.App;
const { DateTime } = imports.gi.GLib; const { DateTime } = imports.gi.GLib;
import { EventBox } from '../misc/cursorbox.js'; import { EventBox } from '../misc/cursorbox.js';
import { closeAll } from '../misc/closer.js';
const ClockModule = ({ const ClockModule = ({
interval = 1000, interval = 1000,
@ -31,7 +30,6 @@ export const Clock = EventBox({
} }
else { else {
Clock.toggleClassName('toggle-on', false); Clock.toggleClassName('toggle-on', false);
closeAll();
} }
} }
}], }],

View file

@ -4,7 +4,6 @@ const { Notifications } = ags.Service;
import { Separator } from '../misc/separator.js'; import { Separator } from '../misc/separator.js';
import { EventBox } from '../misc/cursorbox.js'; import { EventBox } from '../misc/cursorbox.js';
import { closeAll } from '../misc/closer.js';
export const NotifButton = EventBox({ export const NotifButton = EventBox({
className: 'toggle-off', className: 'toggle-off',
@ -18,7 +17,6 @@ export const NotifButton = EventBox({
} }
else { else {
NotifButton.toggleClassName('toggle-on', false); NotifButton.toggleClassName('toggle-on', false);
closeAll();
} }
} }
}], }],

View file

@ -2,7 +2,6 @@ const { Box, Label } = ags.Widget;
const { toggleWindow, openWindow } = ags.App; const { toggleWindow, openWindow } = ags.App;
import { EventBox } from '../misc/cursorbox.js'; import { EventBox } from '../misc/cursorbox.js';
import { closeAll } from '../misc/closer.js';
export const QsToggle = EventBox({ export const QsToggle = EventBox({
className: 'toggle-off', className: 'toggle-off',
@ -16,7 +15,6 @@ export const QsToggle = EventBox({
} }
else { else {
QsToggle.toggleClassName('toggle-on', false); QsToggle.toggleClassName('toggle-on', false);
closeAll();
} }
} }
}], }],

View file

@ -18,5 +18,10 @@ export const Closer = Window({
child: EventBox({ child: EventBox({
onPrimaryClickRelease: () => closeAll(), 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');
}
}]],
}), }),
}); });

View file

@ -11,7 +11,7 @@
in in
{ {
home.packages = [ 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.sassc
pkgs.kora-icon-theme pkgs.kora-icon-theme
pkgs.coloryou pkgs.coloryou