Skip to content

Commit

Permalink
windowAttentionHandler: remove notification fallback, re-add all
Browse files Browse the repository at this point in the history
5.2 names to the pass-thru list.

- Some people don't use window lists, but 3rd-party docks instead,
so there's no need for notifications. Assume we have window lists
or a dock for attention grabbing.
- Tests seemed to indicate focus issues were resolved with the apps
originally listed as 'pass-thru', but with more users now it seems
not to entirely be the case, so just restore the entire list.

Fixes #11024
Fixes #11018
  • Loading branch information
mtwebster committed Aug 9, 2022
1 parent f584c79 commit 7186686
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 32 deletions.
2 changes: 1 addition & 1 deletion data/org.cinnamon.gschema.xml
Expand Up @@ -543,7 +543,7 @@
</key>

<key type="as" name="demands-attention-passthru-wm-classes">
<default>['firefox']</default>
<default>['gnome-screenshot', 'lxterminal', 'xfce4-terminal', 'firefox', 'libreoffice', 'soffice']</default>
<summary>WM class names to always give focus to in windowAttentionHandler.js</summary>
</key>
<key name="app-menu-icon-name" type="s">
Expand Down
41 changes: 10 additions & 31 deletions js/ui/windowAttentionHandler.js
Expand Up @@ -34,42 +34,21 @@ WindowAttentionHandler.prototype = {
* user's attention (like blinking in the window list). Some windows aren't
* directly tied to a user action, but are generated by the user's action anyhow -
* these we make an exception for and focus them. */
try {
if (!window || window.has_focus() || window.is_skip_taskbar() || !Main.isInteresting(window)) {
return;
}
if (!window || window.has_focus() || window.is_skip_taskbar() || !Main.isInteresting(window)) {
return;
}

let wmclass = window.get_wm_class();
let wmclass = window.get_wm_class();

if (wmclass) {
let ignored_classes = global.settings.get_strv("demands-attention-passthru-wm-classes");
if (wmclass) {
let ignored_classes = global.settings.get_strv("demands-attention-passthru-wm-classes");

for (let i = 0; i < ignored_classes.length; i++) {
if (wmclass.toLowerCase().includes(ignored_classes[i].toLowerCase())) {
window.activate(global.get_current_time());
return;
}
for (let i = 0; i < ignored_classes.length; i++) {
if (wmclass.toLowerCase().includes(ignored_classes[i].toLowerCase())) {
window.activate(global.get_current_time());
return;
}
}

if (AppletManager.get_role_provider_exists(Main.AppletManager.Roles.WINDOW_ATTENTION_HANDLER)) {
return;
}

let app = this._tracker.get_window_app(window);

let name = ""
if (app !== null) {
name = app.get_name();
}

let source = new WindowHandlerSource(app, window);
Main.messageTray.add(source);

let notification = new MessageTray.Notification(source, name, window.get_title());
source.notify(notification);
} catch (e) {
global.logError('Error showing window demanding attention', e);
}
}
};
Expand Down

0 comments on commit 7186686

Please sign in to comment.