Skip to content

Commit d02ed71

Browse files
committed
version 11 updates
1 parent 0fd50e6 commit d02ed71

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

about.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* about.js */
22

33
export const releaseNotes = `
4-
Version 10 - What's new:
4+
What's new in this version:
55
66
• Keep toggle state synced with a command's output.
77
• Enable and view detailed logging for setup/troubleshooting.

extension.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ let buttonClick4 = 2; let buttonClick5 = 2; let buttonClick6 = 2;
4949
let shortcutId1; let shortcutId2; let shortcutId3;
5050
let shortcutId4; let shortcutId5; let shortcutId6;
5151

52-
let checkIntervals = [];
52+
let checkIntervals = []; let commandTimeouts = [];
5353
let isRunning = [];
5454
let debug = false;
5555

@@ -786,8 +786,15 @@ export default class CustomQuickToggleExtension extends Extension {
786786
return GLib.SOURCE_REMOVE;
787787
});
788788

789+
commandTimeouts.push(timeoutId);
790+
789791
function cleanup() {
792+
if (didFinish) return;
790793
didFinish = true;
794+
795+
try { GLib.source_remove(timeoutId); } catch (_) {}
796+
commandTimeouts = commandTimeouts.filter(id => id !== timeoutId);
797+
791798
try { dataStream.close_async(GLib.PRIORITY_DEFAULT, null, () => {}); } catch (_) {}
792799
try { baseStream.close_async(GLib.PRIORITY_DEFAULT, null, () => {}); } catch (_) {}
793800
}
@@ -799,7 +806,6 @@ export default class CustomQuickToggleExtension extends Extension {
799806
try {
800807
const bytes = stream.read_bytes_finish(res);
801808
if (bytes.get_size() === 0) {
802-
GLib.source_remove(timeoutId);
803809
const output = new TextDecoder().decode(Uint8Array.from(chunks.flat())).trim();
804810
const match = outputMatches(output, checkRegex);
805811

@@ -991,6 +997,12 @@ export default class CustomQuickToggleExtension extends Extension {
991997
}
992998
checkIntervals = [];
993999

1000+
for (let id of commandTimeouts) {
1001+
if (id)
1002+
GLib.source_remove(id);
1003+
}
1004+
commandTimeouts = [];
1005+
9941006
this._settings = null;
9951007

9961008
console.log(`[Custom Command Toggle] Extension disabled`);

metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
],
1616
"url": "https://github.com/StorageB/custom-command-toggle",
1717
"uuid": "[email protected]",
18-
"version": 10
18+
"version": 11
1919
}

0 commit comments

Comments
 (0)