GNOME
I’ve implemented 2 extensions for the gnome-shell (version 3.2, 3.4, 3.6, 3.8):
Desktop Icons Switch
Recent Items
This extension adds a switch to enable or disable the desktop icons. This is also possible via gnome-tweak-tool, but this is for faster access to turn the icons on and off…
Latest version: 4 (update for gnome-shell 3.8)
Download and activate it via extensions.gnome.org: Desktop Icons Switch
Alternatively download and extract to “~/.local/share/gnome-shell/extensions/”: DesktopIconsSwitch-4.tar.gz
Something missing for the GNOME 3: a simple list for the last recently used items and, since you can search your recently used porns in the overview mode, an easy way to delete this list. So, this is my first extension.
Latest Version 7: update for gnome-shell 3.8 (thanks to grynays!)
Changelog version 4:
- “More…”-Button
- Blacklisting MIME Media Types
- Fixed undeclared Variable (thx oib)
Todos:
- right-click on single entry: remove from list, show in folder
- gui for settings
- hide button after cleaning
- folders?
- private-mode?
- error-msg if file does not exist
- overview tab (like the extension for zeitgeist)?
Settings:
To change the default settings (10 items, 50 more-items, no blacklisting), go to the top of your extensions.js, should be here:
~/.local/share/gnome-shell/extensions/RecentItems@bananenfisch.net/extension.js
or /usr/share/gnome-shell/extensions/RecentItems@bananenfisch.net/extension.js
|
1 2 3 |
const ITEMS = 10; // number of items to list const MORE = 50; // number of items to list under "more..." const BLACKLIST = ""; // to blacklist (hide) spezific MIME media types |
If you set MORE = 0, there will be no “More…”-Button. Available media-types are: text, image, audio, video, application, multipart, message, model. You can define one or more (seperate with “,”) types.
For example, to blacklist all images use:
|
1 |
const BLACKLIST = "image"; |
To blacklist all images, videos and audios, you can use:
|
1 |
const BLACKLIST = "image,audio,video"; |
Don’t forget to restart the shell, after changing settings…
Install
Download and activate it via extensions.gnome.org: Recent Items
Alternatively download and extract to “~/.local/share/gnome-shell/extensions/”: RecentItems-7.tar.gz
The code:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
/* RECENT ITEMS (Version 6), an extension for the gnome-shell. (C) 2011, 2012 Kurt Fleisch; <http://www.bananenfisch.net/gnome/> Gnome Shell Extensions: <https://extensions.gnome.org/> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. <http://www.gnu.org/licenses/> DEFINE YOUR SETTINGS HERE (restart the gnome-shell after changing...) */ const ITEMS = 10; // number of items to list const MORE = 50; // number of items to list under "more..." const BLACKLIST = ""; // to blacklist (hide) spezific MIME media types /* available media-types are: text, image, audio, video, application, multipart, message, model. you can define one or more (seperate with ",") types. for example to blacklist all images use: const BLACKLIST = "image"; to blacklist all images, videos and audios, you can use: const BLACKLIST = "image,audio,video"; END OF SETTINGS SECTION */ const Gtk = imports.gi.Gtk; const Gio = imports.gi.Gio; const St = imports.gi.St; const Main = imports.ui.main; const PopupMenu = imports.ui.popupMenu; const PanelMenu = imports.ui.panelMenu; const Lang = imports.lang; function sortfunc(x,y) { return y[0] - x[0]; } function MyPopupMenuItem() { this._init.apply(this, arguments); } MyPopupMenuItem.prototype = { __proto__: PopupMenu.PopupBaseMenuItem.prototype, _init: function(gicon, text, params) { PopupMenu.PopupBaseMenuItem.prototype._init.call(this, params); this.box = new St.BoxLayout({ style_class: 'popup-combobox-item' }); if (gicon) this.icon = new St.Icon({ gicon: gicon, style_class: 'popup-menu-icon' }); else this.icon = new St.Icon({ icon_name: 'edit-clear-symbolic', icon_size: 22 }); this.box.add(this.icon); this.label = new St.Label({ text: text }); this.box.add(this.label); this.addActor(this.box); } }; function RecentItems() { this._init.apply(this, arguments); } RecentItems.prototype = { __proto__: PanelMenu.Button.prototype, _init: function() { PanelMenu.Button.prototype._init.call(this, 0.0); this.connect('destroy', Lang.bind(this, this._onDestroy)); this._iconActor = new St.Icon({ icon_name: 'document-open-recent-symbolic', style_class: 'system-status-icon' }); this.actor.add_actor(this._iconActor); this.actor.add_style_class_name('panel-status-button'); this.RecentManager = new Gtk.RecentManager(); this._display(); this.conhandler = this.RecentManager.connect('changed', Lang.bind(this, this._redisplay)); Main.panel.addToStatusArea('recent-items', this); }, _onDestroy: function() { this.RecentManager.disconnect(this.conhandler); }, _display: function() { let items = this.RecentManager.get_items(); let modlist = new Array(); let countItem = items.length; for (let i = 0; i < countItem; i++) { modlist[i] = new Array(2); modlist[i][0] = items[i].get_modified(); modlist[i][1] = i; } modlist.sort(sortfunc); let id = 0; let idshow = 0; let blacklistString = BLACKLIST.replace(/\s/g, ""); let blacklistList = blacklistString.split(","); while (idshow < ITEMS && id < countItem) { let itemtype = items[modlist[id][1]].get_mime_type(); if (blacklistList.indexOf((itemtype.split("/"))[0]) == -1) { let gicon = Gio.content_type_get_icon(itemtype); let menuItem = new MyPopupMenuItem(gicon, items[modlist[id][1]].get_display_name(), {}); this.menu.addMenuItem(menuItem); menuItem.connect('activate', Lang.bind(this, this._launchFile, items[modlist[id][1]].get_uri())); idshow++; } id++; } if (id < countItem && MORE > 0) { this.moreItem = new PopupMenu.PopupSubMenuMenuItem(_("More...")); this.menu.addMenuItem(this.moreItem); while (idshow < ITEMS+MORE && id < countItem) { let itemtype = items[modlist[id][1]].get_mime_type(); if (blacklistList.indexOf((itemtype.split("/"))[0]) == -1) { let gicon = Gio.content_type_get_icon(itemtype); let menuItem = new MyPopupMenuItem(gicon, items[modlist[id][1]].get_display_name(), {}); this.moreItem.menu.addMenuItem(menuItem); menuItem.connect('activate', Lang.bind(this, this._launchFile, items[modlist[id][1]].get_uri())); idshow++; } id++; } } if (countItem > 0) { this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); let menuItem = new MyPopupMenuItem(false, 'Clear list', {}); this.menu.addMenuItem(menuItem); menuItem.connect('activate', Lang.bind(this, this._clearAll)); } }, _redisplay: function() { this.menu.removeAll(); this._display(); }, _launchFile: function(a, b, c) { Gio.app_info_launch_default_for_uri(c, global.create_app_launch_context()); }, _clearAll: function() { let GtkRecent = new Gtk.RecentManager(); GtkRecent.purge_items(); }, }; function init() { } let Rec; function enable() { Rec = new RecentItems(); } function disable() { Rec.destroy(); } |


























[...] Meine fertige Extension kann übrigens auch direkt von dieser Seite installiert und aktiviert werden: https://extensions.gnome.org/extension/72/recent-items/. Der Code findet sich hier: GNOME. [...]
Thanks, this is a great extension,… I had no idea how to clear gnome-shell history, apparently deleting recently-used.xbel doesn’t do the trick, probably because it’s loaded into memory somewhere. So that hack probably only works if done from outside gnome-shell.
Anyways, I was thinking maybe an extension that enabled/disabled the recording of recently used files. Kind of like private mode in Firefox would be great. It shouldn’t necessarily clear the history, just allow me to stop recording the history. A thing that would be useful when accessing truecrypt partitions or external hard drives where I don’t need the files to show up in history later.
I tried looking for documentation of the JS api, but couldn’t really find any. Do you know where I can find an overview of methods on GtkRecentManager?
thats a good idea, jonas. i have to check, how this is possible to implement (the JS-bindings are not well documented, and i’m new at this libs…). it’s on the todo-list :-)
here is a doc: http://developer.gnome.org/gtkmm/stable/classGtk_1_1RecentManager.html
some functions are already implemented here: /usr/share/gnome-shell/js/misc/docInfo.js
i was searching in gconf/dconf for settings, but nothing found…
Thankyou for the amazing recent item extensions, i use it very often. Now that precise pangolin is out, colud you update the extension to gnome 3.4?
Thankyou so much!
Frà
Hi Francesco,
thank you!
i will update the extension for gnome 3.4 as soon as the gnome-shell 3.4 will be available on debian unstable (i hope, this could be very soon: http://www.0d.be/debian/debian-gnome-3.4-status.html ), as i use debian on all my systems…
Hi Kurt,
Could you please update the extension to Gnome 3.8?
Thanks,
Robert
The Recent Items extension is very nice. Thank you for developing it and compliment to all of us.
When you have time, consider updating it for gnome 3.8.
To use with gnome 3.8, just add 3.8 in version list on file “metadata.json” locate in “/home/username/.local/share/gnome-shell/extensions/DesktopIconsSwitch@bananenfisch.net”
Thanks Thiago! – i’m still on 3.6, but have updated the extensions by adding the version. Should be online at http://extensions.gnome.org/ now too!