Skip to content

Commit 1cb594b

Browse files
authored
fix: update CI workflow and improve logger initialization (#44)
* fix: update CI workflow and improve logger initialization * chore: update version-name to 50.6
1 parent 69eca61 commit 1cb594b

7 files changed

Lines changed: 77 additions & 43 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches: [main]
66
pull_request:
7+
merge_group:
78
workflow_call:
89

910
concurrency:

metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Aurora Shell",
33
"description": "A customizable GNOME Shell extension that enhances the user experience with various modules and features. The optional Clipboard History module reads and stores clipboard text locally so it can be browsed and restored; no clipboard data is shared with third parties, and its open shortcut is unset by default.",
4-
"version-name": "50.5",
4+
"version-name": "50.6",
55
"uuid": "aurora-shell@luminusos.github.io",
66
"url": "https://github.com/luminusOS/aurora-shell",
77
"settings-schema": "org.gnome.shell.extensions.aurora-shell",

src/core/logger.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,19 @@ export class ConsoleLogger implements Logger {
8080
}
8181
}
8282

83-
let _activeLogger: Logger = new ConsoleLogger();
83+
let _activeLogger: Logger | null = null;
84+
85+
function _getActiveLogger(): Logger {
86+
_activeLogger ??= new ConsoleLogger();
87+
return _activeLogger;
88+
}
8489

8590
export const logger: Logger = {
86-
log: (...args) => _activeLogger.log(...args),
87-
debug: (...args) => _activeLogger.debug(...args),
88-
info: (...args) => _activeLogger.info(...args),
89-
warn: (...args) => _activeLogger.warn(...args),
90-
error: (...args) => _activeLogger.error(...args),
91+
log: (...args) => _getActiveLogger().log(...args),
92+
debug: (...args) => _getActiveLogger().debug(...args),
93+
info: (...args) => _getActiveLogger().info(...args),
94+
warn: (...args) => _getActiveLogger().warn(...args),
95+
error: (...args) => _getActiveLogger().error(...args),
9196
};
9297

9398
export function setGlobalLogger(l: Logger): void {

src/modules/clipboardHistory/clipboardPanel.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,12 @@ export class ClipboardPanel extends St.BoxLayout {
199199
this._isOpen = false;
200200
}
201201

202+
override destroy(): void {
203+
this.close();
204+
this._disconnectDragSignals();
205+
super.destroy();
206+
}
207+
202208
refresh(): void {
203209
if (this._isOpen) this._syncList(this._searchEntry.get_text());
204210
}
@@ -298,8 +304,11 @@ export class ClipboardPanel extends St.BoxLayout {
298304
}
299305

300306
private _endDrag(): void {
301-
if (!this._isDragging) return;
302307
this._isDragging = false;
308+
this._disconnectDragSignals();
309+
}
310+
311+
private _disconnectDragSignals(): void {
303312
if (this._dragMotionId !== 0) {
304313
global.stage.disconnect(this._dragMotionId);
305314
this._dragMotionId = 0;

src/modules/trayIcons/trayIconItem.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,9 +265,15 @@ export class TrayIconItem extends St.Button {
265265
override destroy(): void {
266266
_hideTooltip();
267267
this._dbusMenuClient?.destroy();
268+
if (this._menu && this._menuManager) {
269+
this._menuManager.removeMenu(this._menu);
270+
}
268271
this._menu?.destroy();
269272
this._menu = null;
270273
this._menuManager = null;
274+
if (this._localMenu && this._localMenuManager) {
275+
this._localMenuManager.removeMenu(this._localMenu);
276+
}
271277
this._localMenu?.destroy();
272278
this._localMenu = null;
273279
this._localMenuManager = null;

src/modules/volumeMixer/mixerPanel.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export const MAX_MIXER_HEIGHT = 300;
1818
export class VolumeMixerPanel extends St.BoxLayout {
1919
declare private _emptyLabel: St.Label;
2020
declare private _list: VolumeMixerList;
21-
declare private _scroll: St.ScrollView | null;
2221

2322
override _init(context?: ExtensionContext | Partial<St.BoxLayout.ConstructorProps>): void {
2423
super._init({
@@ -53,16 +52,15 @@ export class VolumeMixerPanel extends St.BoxLayout {
5352
context as ExtensionContext,
5453
);
5554
sections.add_child(this._list);
56-
this._scroll = scroll;
5755
this.add_child(scroll);
5856

59-
this._list.connectObject('notify::should-show', () => this._sync(), this);
60-
this._sync();
57+
this._list.connectObject('notify::should-show', () => this._sync(scroll), this);
58+
this._sync(scroll);
6159
}
6260

63-
private _sync(): void {
61+
private _sync(scroll: St.ScrollView): void {
6462
const hasStreams = this._list.shouldShow;
65-
this._scroll!.visible = hasStreams;
63+
scroll.visible = hasStreams;
6664
this._emptyLabel.visible = !hasStreams;
6765
}
6866

src/shared/ui/dash.ts

Lines changed: 44 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,6 @@ export interface DashBounds {
1919
const TARGET_BOX_PADDING = 8;
2020

2121
type TargetBoxListener = (bounds: DashBounds | null) => void;
22-
type TimeoutProp =
23-
| '_autohideTimeoutId'
24-
| '_delayEnsureAutoHideId'
25-
| '_blockAutoHideDelayId'
26-
| '_workAreaUpdateId'
27-
| '_iconResizeTimeoutId'
28-
| '_springLoadTimerId';
2922

3023
const AUTOHIDE_TIMEOUT = 100;
3124
const SPRING_LOAD_DELAY = 400;
@@ -139,7 +132,30 @@ export class AuroraDash extends Dash {
139132

140133
override destroy(): void {
141134
this._isDestroyed = true;
142-
this._clearAllTimeouts();
135+
if (this._autohideTimeoutId !== 0) {
136+
GLib.source_remove(this._autohideTimeoutId);
137+
this._autohideTimeoutId = 0;
138+
}
139+
if (this._delayEnsureAutoHideId !== 0) {
140+
GLib.source_remove(this._delayEnsureAutoHideId);
141+
this._delayEnsureAutoHideId = 0;
142+
}
143+
if (this._blockAutoHideDelayId !== 0) {
144+
GLib.source_remove(this._blockAutoHideDelayId);
145+
this._blockAutoHideDelayId = 0;
146+
}
147+
if (this._workAreaUpdateId !== 0) {
148+
GLib.source_remove(this._workAreaUpdateId);
149+
this._workAreaUpdateId = 0;
150+
}
151+
if (this._iconResizeTimeoutId !== 0) {
152+
GLib.source_remove(this._iconResizeTimeoutId);
153+
this._iconResizeTimeoutId = 0;
154+
}
155+
if (this._springLoadTimerId !== 0) {
156+
GLib.source_remove(this._springLoadTimerId);
157+
this._springLoadTimerId = 0;
158+
}
143159

144160
// Remove the global DND drag monitor so its captured `this` doesn't
145161
// keep firing against a disposed AuroraDash if the dash is destroyed
@@ -291,7 +307,10 @@ export class AuroraDash extends Dash {
291307

292308
/** Schedule a delayed hover re-evaluation after visibility changes. */
293309
ensureAutoHide(): void {
294-
this._clearTimeout('_delayEnsureAutoHideId');
310+
if (this._delayEnsureAutoHideId !== 0) {
311+
GLib.source_remove(this._delayEnsureAutoHideId);
312+
this._delayEnsureAutoHideId = 0;
313+
}
295314
this._delayEnsureAutoHideId = GLib.timeout_add(
296315
GLib.PRIORITY_DEFAULT,
297316
VISIBILITY_ANIMATION_TIME,
@@ -594,7 +613,10 @@ export class AuroraDash extends Dash {
594613
this._overrideIconActivation();
595614

596615
if (dashAny.iconSize !== oldIconSize) {
597-
this._clearTimeout('_iconResizeTimeoutId');
616+
if (this._iconResizeTimeoutId !== 0) {
617+
GLib.source_remove(this._iconResizeTimeoutId);
618+
this._iconResizeTimeoutId = 0;
619+
}
598620
this._iconResizeTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, ANIMATION_TIME, () => {
599621
this._iconResizeTimeoutId = 0;
600622
if (this._workArea) this.applyWorkArea(this._workArea);
@@ -817,14 +839,20 @@ export class AuroraDash extends Dash {
817839

818840
private _clearSpringLoad(): void {
819841
this._springLoadTarget?.remove_style_class_name?.('aurora-drag-hover');
820-
this._clearTimeout('_springLoadTimerId');
842+
if (this._springLoadTimerId !== 0) {
843+
GLib.source_remove(this._springLoadTimerId);
844+
this._springLoadTimerId = 0;
845+
}
821846
this._springLoadTarget = null;
822847
}
823848

824849
/** Start or restart the autohide timeout — hides the dock if not hovered/blocked. */
825850
private _onHover(): void {
826851
if (this._isDestroyed) return;
827-
this._clearTimeout('_autohideTimeoutId');
852+
if (this._autohideTimeoutId !== 0) {
853+
GLib.source_remove(this._autohideTimeoutId);
854+
this._autohideTimeoutId = 0;
855+
}
828856
this._autohideTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, AUTOHIDE_TIMEOUT, () => {
829857
if (this._isDestroyed) {
830858
this._autohideTimeoutId = 0;
@@ -845,7 +873,10 @@ export class AuroraDash extends Dash {
845873
/** If the cursor is still over the dash container, ensure the dock stays shown. */
846874
private _ensureHoverState(): void {
847875
if (this._isDestroyed) return;
848-
this._clearTimeout('_blockAutoHideDelayId');
876+
if (this._blockAutoHideDelayId !== 0) {
877+
GLib.source_remove(this._blockAutoHideDelayId);
878+
this._blockAutoHideDelayId = 0;
879+
}
849880
this._blockAutoHideDelayId = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
850881
if (!this._isDestroyed) {
851882
const dashContainer = (this as any)._dashContainer as St.Widget | undefined;
@@ -953,22 +984,6 @@ export class AuroraDash extends Dash {
953984
});
954985
}
955986

956-
private _clearTimeout(prop: TimeoutProp): void {
957-
if (this[prop]) {
958-
GLib.source_remove(this[prop]);
959-
this[prop] = 0;
960-
}
961-
}
962-
963-
private _clearAllTimeouts(): void {
964-
this._clearTimeout('_autohideTimeoutId');
965-
this._clearTimeout('_delayEnsureAutoHideId');
966-
this._clearTimeout('_blockAutoHideDelayId');
967-
this._clearTimeout('_workAreaUpdateId');
968-
this._clearTimeout('_iconResizeTimeoutId');
969-
this._clearTimeout('_springLoadTimerId');
970-
}
971-
972987
private static _boundsEqual(a: DashBounds | null, b: DashBounds | null): boolean {
973988
if (a === b) return true;
974989
if (!a || !b) return false;

0 commit comments

Comments
 (0)