diff --git a/extension.js b/extension.js index 70da150..d34bdac 100644 --- a/extension.js +++ b/extension.js @@ -490,7 +490,11 @@ class Extension { // If that was the case, we also check the application name. if (matches && profileApp != '') { const app = actor.meta_window.get_wm_class().toLowerCase(); - matches = app == profileApp.toLowerCase(); + + // Split app names at |, remove any whitespace, and transform to lower case. + const profileApps = + profileApp.split('|').map(item => item.trim().toLowerCase()); + matches = profileApps.includes(app); } // If the profile is still matching, we also check the color scheme. diff --git a/prefs.js b/prefs.js index a510476..8575c18 100644 --- a/prefs.js +++ b/prefs.js @@ -150,14 +150,30 @@ var PreferencesDialog = class PreferencesDialog { null, null, Gio.DBusCallFlags.NO_AUTO_START, -1, null, null); }); - // If the window picking was successful, this D-Bus signal will be emitted. + // If the window picking was successful, this D-Bus signal will be emitted. If a + // window was picked, we add it to the list of window name. this._dbusConnection = Gio.DBus.session.signal_subscribe( 'org.gnome.Shell', 'org.gnome.shell.extensions.BurnMyWindows', 'WindowPicked', '/org/gnome/shell/extensions/BurnMyWindows', null, Gio.DBusSignalFlags.NONE, (conn, sender, obj_path, iface, signal, params) => { const val = params.get_child_value(0).get_string()[0]; if (val != 'window-not-found') { - this._builder.get_object('profile-app').text = val; + const entry = this._builder.get_object('profile-app'); + + // Split the current value at each |, trim spaces, and remove empty components. + let apps = entry.text.split('|').map(item => item.trim()).filter(v => v != ''); + + // If the list is empty, we simply use the name of the picked window. + if (apps.length == 0) { + entry.text = val; + } else { + + // Else we append the new application name, remove any duplicates, and sort + // the resulting list alphabetically. + apps.push(val); + apps = [...new Set(apps)].sort(); + entry.text = apps.join(' | '); + } } }); @@ -350,15 +366,15 @@ var PreferencesDialog = class PreferencesDialog { toast.set_button_label(_('View Changelog')); toast.set_action_name('prefs.changelog'); toast.set_timeout(0); - + toast.connect( 'dismissed', () => this._settings.set_int('last-version', Me.metadata.version)); - + window.add_toast(toast); - }else { - const infoBar = this._builder.get_object("update-info"); - infoBar.connect("response", i => { + } else { + const infoBar = this._builder.get_object('update-info'); + infoBar.connect('response', i => { this._settings.set_int('last-version', Me.metadata.version); i.set_revealed(false); });