Skip to content

Commit 0484ffb

Browse files
committed
fix: Disconnect window attention handler
1 parent 98a3997 commit 0484ffb

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

src/extension.ts

+22-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const GLib: GLib = imports.gi.GLib;
4444
const { Gio, Meta, St, Shell } = imports.gi;
4545
const { GlobalEvent, WindowEvent } = Events;
4646
const { cursor_rect, is_move_op } = Lib;
47-
const { layoutManager, loadTheme, overview, panel, setThemeStylesheet, screenShield, sessionMode } = imports.ui.main;
47+
const { layoutManager, loadTheme, overview, panel, setThemeStylesheet, screenShield, sessionMode, windowAttentionHandler } = imports.ui.main;
4848
const { ScreenShield } = imports.ui.screenShield;
4949
const { AppSwitcher, AppIcon, WindowSwitcherPopup } = imports.ui.altTab;
5050
const { SwitcherList } = imports.ui.switcherPopup;
@@ -2454,6 +2454,8 @@ function enable() {
24542454
ext.injections_add();
24552455
ext.signals_attach();
24562456

2457+
disable_window_attention_handler()
2458+
24572459
layoutManager.addChrome(ext.overlay);
24582460

24592461
if (!indicator) {
@@ -2503,6 +2505,25 @@ function disable() {
25032505
indicator.destroy();
25042506
indicator = null;
25052507
}
2508+
2509+
enable_window_attention_handler()
2510+
}
2511+
2512+
const handler = windowAttentionHandler
2513+
2514+
function enable_window_attention_handler() {
2515+
if (handler && !handler._windowDemandsAttentionId) {
2516+
handler._windowDemandsAttentionId = global.display.connect('window-demands-attention', (display, window) => {
2517+
handler._onWindowDemandsAttention(display, window)
2518+
})
2519+
}
2520+
}
2521+
2522+
function disable_window_attention_handler() {
2523+
if (handler && handler._windowDemandsAttentionId) {
2524+
global.display.disconnect(handler._windowDemandsAttentionId);
2525+
handler._windowDemandsAttentionId = null
2526+
}
25062527
}
25072528

25082529
function stylesheet_path(name: string) { return Me.path + "/" + name + ".css"; }

0 commit comments

Comments
 (0)