summaryrefslogtreecommitdiffstats
path: root/extensions/46/vertical-workspaces/lib/windowAttentionHandler.js
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--extensions/46/vertical-workspaces/lib/windowAttentionHandler.js53
1 files changed, 38 insertions, 15 deletions
diff --git a/extensions/46/vertical-workspaces/lib/windowAttentionHandler.js b/extensions/46/vertical-workspaces/lib/windowAttentionHandler.js
index 744f5b6..ae115ed 100644
--- a/extensions/46/vertical-workspaces/lib/windowAttentionHandler.js
+++ b/extensions/46/vertical-workspaces/lib/windowAttentionHandler.js
@@ -10,9 +10,13 @@
'use strict';
+import Clutter from 'gi://Clutter';
+
import * as Main from 'resource:///org/gnome/shell/ui/main.js';
import * as MessageTray from 'resource:///org/gnome/shell/ui/messageTray.js';
+const shellVersion46 = !Clutter.Container;
+
let Me;
let opt;
@@ -86,9 +90,8 @@ const WindowAttentionHandlerCommon = {
}
const app = this._tracker.get_window_app(window);
- // const source = new WindowAttentionHandler.WindowAttentionSource(app, window);
let args;
- if (!Main.overview.dash.add_actor) // detects GS 46 - Clutter.Container has been removed
+ if (shellVersion46)
args = { title: app.get_name() };
else
args = app.get_name();
@@ -98,24 +101,44 @@ const WindowAttentionHandlerCommon = {
source._init(app, window);
Main.messageTray.add(source);
- let [title, banner] = this._getTitleAndBanner(app, window);
+ let [title, body] = this._getTitleAndBanner(app, window);
+ args = shellVersion46
+ ? [{ source, title, body, forFeedback: true }]
+ : [source, title, body];
+
+ const notification = new MessageTray.Notification(...args);
+ if (!shellVersion46)
+ notification.setForFeedback(true);
- const notification = new MessageTray.Notification(source, title, banner);
notification.connect('activated', () => {
source.open();
});
- notification.setForFeedback(true);
- if (opt.WINDOW_ATTENTION_DISABLE_NOTIFICATIONS)
- // just push the notification to the message tray without showing notification
- source.pushNotification(notification);
- else
- source.showNotification(notification);
-
- window.connectObject('notify::title', () => {
- [title, banner] = this._getTitleAndBanner(app, window);
- notification.update(title, banner);
- }, source);
+ if (shellVersion46) {
+ notification.acknowledged = opt.WINDOW_ATTENTION_DISABLE_NOTIFICATIONS;
+ source.addNotification(notification);
+ if (opt.WINDOW_ATTENTION_DISABLE_NOTIFICATIONS) {
+ // just push the notification to the message tray without showing notification
+ notification.acknowledged = true;
+ Main.messageTray._notificationQueue.push(notification);
+ Main.panel.statusArea.dateMenu._indicator.show();
+ }
+ window.connectObject('notify::title', () => {
+ [title, body] = this._getTitleAndBanner(app, window);
+ notification.set({ title, body });
+ }, source);
+ } else {
+ if (opt.WINDOW_ATTENTION_DISABLE_NOTIFICATIONS)
+ // just push the notification to the message tray without showing notification
+ source.pushNotification(notification);
+ else
+ source.showNotification(notification);
+
+ window.connectObject('notify::title', () => {
+ [title, body] = this._getTitleAndBanner(app, window);
+ notification.update(title, body);
+ }, source);
+ }
},
};