From 555d1db3ba6ac7a1c3ee78e2ee99071f45e79c5a Mon Sep 17 00:00:00 2001 From: matt1432 Date: Wed, 10 Apr 2024 21:04:19 -0400 Subject: [PATCH] refactor(ags): remove blur and unused stuff from popup window class --- modules/ags/config/global-types.d.ts | 3 -- modules/ags/config/ts/applauncher/main.ts | 2 +- modules/ags/config/ts/date.ts | 2 +- modules/ags/config/ts/misc/popup.ts | 44 +++----------------- modules/ags/config/ts/notifications/binto.ts | 2 +- modules/ags/config/ts/notifications/wim.ts | 2 +- modules/ags/config/ts/osd/main.ts | 2 +- modules/ags/config/ts/powermenu.ts | 2 +- modules/ags/config/ts/quick-settings/main.ts | 2 +- 9 files changed, 12 insertions(+), 49 deletions(-) diff --git a/modules/ags/config/global-types.d.ts b/modules/ags/config/global-types.d.ts index 92ec6d0..6f7d47b 100644 --- a/modules/ags/config/global-types.d.ts +++ b/modules/ags/config/global-types.d.ts @@ -128,10 +128,7 @@ WindowProps & { transition?: HyprTransition; on_open?(self: PopupWindow): void on_close?(self: PopupWindow): void - blur?: boolean close_on_unfocus?: CloseType - attribute?: Attr; - content?: Widget anchor?: Array<'top' | 'bottom' | 'right' | 'left'>; }; import { PopupWindow } from 'ts/misc/popup'; diff --git a/modules/ags/config/ts/applauncher/main.ts b/modules/ags/config/ts/applauncher/main.ts index c0844a3..6ed14b2 100644 --- a/modules/ags/config/ts/applauncher/main.ts +++ b/modules/ags/config/ts/applauncher/main.ts @@ -152,5 +152,5 @@ export default () => PopupWindow({ name: 'applauncher', transition: 'slide top', keymode: 'on-demand', - content: Applauncher(), + child: Applauncher(), }); diff --git a/modules/ags/config/ts/date.ts b/modules/ags/config/ts/date.ts index 23f4ff1..10c5da7 100644 --- a/modules/ags/config/ts/date.ts +++ b/modules/ags/config/ts/date.ts @@ -90,7 +90,7 @@ export default () => PopupWindow({ anchor: ['top'], margins: [TOP_MARGIN, 0, 0, 0], - content: Box({ + child: Box({ class_name: 'date', vertical: true, diff --git a/modules/ags/config/ts/misc/popup.ts b/modules/ags/config/ts/misc/popup.ts index f29772c..0a5f8a6 100644 --- a/modules/ags/config/ts/misc/popup.ts +++ b/modules/ags/config/ts/misc/popup.ts @@ -1,12 +1,8 @@ import Gtk from 'gi://Gtk?version=3.0'; const Hyprland = await Service.import('hyprland'); -const { Box, register } = Widget; -const { timeout } = Utils; - -// Types +/* Types */ import { Window } from 'resource:///com/github/Aylur/ags/widgets/window.js'; -import { Variable as Var } from 'types/variable'; import { CloseType, @@ -20,26 +16,17 @@ export class PopupWindow< Attr, > extends Window { static { - register(this, { + Widget.register(this, { properties: { - content: ['widget', 'rw'], + close_on_unfocus: ['string', 'rw'], + transition: ['string', 'rw'], }, }); } - #content: Var; #close_on_unfocus: CloseType; #transition: HyprTransition; - get content() { - return this.#content.value; - } - - set content(value: Gtk.Widget) { - this.#content.setValue(value); - this.child.show_all(); - } - get close_on_unfocus() { return this.#close_on_unfocus; } @@ -59,7 +46,6 @@ export class PopupWindow< constructor({ transition = 'slide top', - transition_duration = 800, on_open = () => {/**/}, on_close = () => {/**/}, @@ -68,25 +54,15 @@ export class PopupWindow< visible = false, anchor = [], layer = 'overlay', - attribute, - content = Box(), - blur = false, close_on_unfocus = 'released', ...rest }: PopupWindowProps) { - const contentVar = Variable(Box() as Gtk.Widget); - - if (content) { - contentVar.setValue(content); - } - super({ ...rest, name: `win-${name}`, visible, anchor, layer, - attribute, setup: () => { const id = App.connect('config-parsed', () => { // Add way to make window open on startup @@ -98,17 +74,10 @@ export class PopupWindow< App.disconnect(id); }); - if (blur) { - Hyprland.messageAsync('[[BATCH]] ' + - `keyword layerrule ignorealpha 0.97, win-${name}; ` + - `keyword layerrule blur, win-${name}`); - } - Hyprland.messageAsync( `keyword layerrule animation ${transition}, win-${name}`, ); }, - child: contentVar.bind(), }); this.hook(App, (_, currentName, isOpen) => { @@ -117,14 +86,11 @@ export class PopupWindow< on_open(this); } else { - timeout(Number(transition_duration), () => { - on_close(this); - }); + on_close(this); } } }); - this.#content = contentVar; this.#close_on_unfocus = close_on_unfocus; this.#transition = transition; } diff --git a/modules/ags/config/ts/notifications/binto.ts b/modules/ags/config/ts/notifications/binto.ts index 975b30b..5f59f6b 100644 --- a/modules/ags/config/ts/notifications/binto.ts +++ b/modules/ags/config/ts/notifications/binto.ts @@ -22,5 +22,5 @@ export const NotifCenter = () => PopupWindow({ transition: 'slide bottom', monitor: 1, - content: NotifCenterWidget(), + child: NotifCenterWidget(), }); diff --git a/modules/ags/config/ts/notifications/wim.ts b/modules/ags/config/ts/notifications/wim.ts index 3acc89e..eead7d7 100644 --- a/modules/ags/config/ts/notifications/wim.ts +++ b/modules/ags/config/ts/notifications/wim.ts @@ -21,5 +21,5 @@ export const NotifCenter = () => PopupWindow({ anchor: ['top', 'right'], margins: [TOP_MARGIN, 0, 0, 0], - content: NotifCenterWidget(), + child: NotifCenterWidget(), }); diff --git a/modules/ags/config/ts/osd/main.ts b/modules/ags/config/ts/osd/main.ts index f584902..e4b3e83 100644 --- a/modules/ags/config/ts/osd/main.ts +++ b/modules/ags/config/ts/osd/main.ts @@ -74,5 +74,5 @@ export default () => PopupWindow({ exclusivity: 'ignore', close_on_unfocus: 'stay', transition: 'slide bottom', - content: OSDs(), + child: OSDs(), }); diff --git a/modules/ags/config/ts/powermenu.ts b/modules/ags/config/ts/powermenu.ts index 055c142..56dad1c 100644 --- a/modules/ags/config/ts/powermenu.ts +++ b/modules/ags/config/ts/powermenu.ts @@ -45,5 +45,5 @@ const PowermenuWidget = () => CenterBox({ export default () => PopupWindow({ name: 'powermenu', transition: 'slide bottom', - content: PowermenuWidget(), + child: PowermenuWidget(), }); diff --git a/modules/ags/config/ts/quick-settings/main.ts b/modules/ags/config/ts/quick-settings/main.ts index 6f5e113..84eb7d9 100644 --- a/modules/ags/config/ts/quick-settings/main.ts +++ b/modules/ags/config/ts/quick-settings/main.ts @@ -54,5 +54,5 @@ export default () => PopupWindow({ name: 'quick-settings', anchor: ['top', 'right'], margins: [TOP_MARGIN, 0, 0, 0], - content: QuickSettingsWidget(), + child: QuickSettingsWidget(), });