diff --git a/extension.js b/extension.js
index 16e6596e..945bab43 100644
--- a/extension.js
+++ b/extension.js
@@ -52,6 +52,8 @@ export default class DashToDockExtension extends Extension.Extension {
enable() {
this._isEnabled = true;
SettingsManager.initialize(this);
+ const settings = SettingsManager.getDefault().gsettings;
+ settings.reset('recent-icons'); // clear in preparation of new collection
Util.tryCleanupOldIndicators();
this._maybeEnableAfterNameAvailable();
TrayIconsManager.TrayIconsManager.initialize();
diff --git a/indicatorStatusIcon.js b/indicatorStatusIcon.js
index 5ef516c2..226ca9dd 100644
--- a/indicatorStatusIcon.js
+++ b/indicatorStatusIcon.js
@@ -15,6 +15,7 @@
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
import Clutter from 'gi://Clutter';
+import GLib from 'gi://GLib';
import Gio from 'gi://Gio';
import GObject from 'gi://GObject';
import St from 'gi://St';
@@ -323,6 +324,16 @@ class IndicatorStatusIcon extends BaseStatusIcon {
}
}
+ _addToRecentIcons() {
+ const settings = SettingsManager.getDefaultGSettings();
+ const iconIDs = settings.get_value('recent-icons').deep_unpack();
+
+ if (this._indicator.id && !iconIDs.includes(this._indicator.id)) {
+ iconIDs.push(this._indicator.id);
+ settings.set_value('recent-icons', new GLib.Variant('as', iconIDs));
+ }
+ }
+
_showIfReady() {
if (!this.isReady())
return;
@@ -330,6 +341,7 @@ class IndicatorStatusIcon extends BaseStatusIcon {
this._updateLabel();
this._updateStatus();
this._updateMenu();
+ this._addToRecentIcons();
}
_updateClickCount(event) {
diff --git a/prefs.js b/prefs.js
index 625bc104..9f403c76 100644
--- a/prefs.js
+++ b/prefs.js
@@ -30,7 +30,7 @@ class AppIndicatorPreferences extends Gtk.Box {
margin_bottom: 30,
});
this.custom_icons_vbox = new Gtk.Box({
- orientation: Gtk.Orientation.HORIZONTAL,
+ orientation: Gtk.Orientation.VERTICAL,
spacing: 10,
margin_start: 10,
margin_end: 10,
@@ -267,7 +267,39 @@ class AppIndicatorPreferences extends Gtk.Box {
customTreeView.insert_column(customAttentionIconColumn, 2);
customTreeView.set_grid_lines(Gtk.TreeViewGridLines.BOTH);
+ const iconIDListStore = new Gtk.ListStore();
+ iconIDListStore.set_column_types([
+ GObject.TYPE_STRING,
+ ]);
+ const iconIDListTrack = [];
+ const iconIDTreeView = new Gtk.TreeView({
+ model: iconIDListStore,
+ });
+ const iconIDTreeViewColumn = new Gtk.TreeViewColumn({
+ title: 'Recent Indicator IDs',
+ });
+
+ const updateRecentIcons = () => {
+ const iconIDs = this._settings.get_value('recent-icons').deep_unpack();
+ iconIDs.forEach(v => {
+ if (!iconIDListTrack.includes(v)) {
+ iconIDListStore.set(iconIDListStore.append(), [0], [v]);
+ iconIDListTrack.push(v);
+ }
+ });
+ };
+
+ this._settings.connect('changed::recent-icons', updateRecentIcons);
+ updateRecentIcons();
+
+ const standardCellRenderer = new Gtk.CellRendererText();
+ iconIDTreeViewColumn.pack_start(standardCellRenderer, true);
+ iconIDTreeViewColumn.add_attribute(standardCellRenderer, 'text', 0);
+ iconIDTreeView.insert_column(iconIDTreeViewColumn, 0);
+ iconIDTreeView.set_grid_lines(Gtk.TreeViewGridLines.BOTH);
+
this.custom_icons_vbox.append(customTreeView);
+ this.custom_icons_vbox.append(iconIDTreeView);
cellrenderer.connect('edited', (w, path, text) => {
this.selection = customTreeView.get_selection();
diff --git a/schemas/org.gnome.shell.extensions.appindicator.gschema.xml b/schemas/org.gnome.shell.extensions.appindicator.gschema.xml
index 75bba7ce..9a00f8c9 100644
--- a/schemas/org.gnome.shell.extensions.appindicator.gschema.xml
+++ b/schemas/org.gnome.shell.extensions.appindicator.gschema.xml
@@ -45,5 +45,10 @@
Custom icons
Replace any icons with custom icons from themes
+
+ []
+ Recent icon IDs
+ List of recently encountered icon ids
+