Mintmenu (or Zeitgeist) forgets about my own files

Questions about applications and software
Forum rules
Before you post please read this

Mintmenu (or Zeitgeist) forgets about my own files

Postby rezitengaM on Wed Jan 30, 2013 6:05 am

Hello everybody,

A lot of discussion is out there to prevent Zeitgeist form logging your activity, but I actually find it quite handy that the menu wil show recently used files.

But what is the definition of "recently"? All files I used yesterday could be found yesterday, but today they are gone.

Is there a possibility to configure this "time to live" or is it a bug or a misconfiguration on my system?

Can I find some logs to see if there something wrong?

Would be nice to get this sorted out. The functionality is nice if it helps finding files faster but if it forgets about them in a short period of time, it is not useful at all.

Thanks for your help.
rezitengaM
Level 1
Level 1
 
Posts: 23
Joined: Sun Oct 09, 2011 3:01 pm

Linux Mint is funded by ads and donations.
 

Re: Mintmenu (or Zeitgeist) forgets about my own files

Postby xenopeek on Wed Jan 30, 2013 6:25 am

Which Linux Mint version are you using, and with what desktop environment?
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14804
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Mintmenu (or Zeitgeist) forgets about my own files

Postby rezitengaM on Wed Jan 30, 2013 7:06 am

Linux Mint 14 64 bits with cinnamon.
rezitengaM
Level 1
Level 1
 
Posts: 23
Joined: Sun Oct 09, 2011 3:01 pm

Re: Mintmenu (or Zeitgeist) forgets about my own files

Postby xenopeek on Wed Jan 30, 2013 7:19 am

That isn't using Zeitgeist, at least not that I know of (it's not installed here). The list of Recent Files is created from your file ~/.local/share/recently-used.xbel. Are you perhaps using something like Ubuntu Tweak or Bleachbit to clear this file?
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14804
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Mintmenu (or Zeitgeist) forgets about my own files

Postby rezitengaM on Wed Jan 30, 2013 7:33 am

Ok, perhaps that can set me on track:

I have the file:

~/.local/share/recently-used.xbel

and the directory:

~/.local/share/zeitgeist

with some sqlite databases. And zeitgeist is running on my system as "ps aux | grep zeitgeist" shows.

But you are right. I just opened a file on my Desktop and it is added to

~/.local/share/recently-used.xbel

and can be found in the menu. I do not clear this file by myself or with bleachbit.

I will investigate what happens to the file after a reboot, or a day later.

One thing is strange, though: One of the bookmarks in this file is:

<bookmark href="file:///..../Desktop/data.txt" added="2013-01-12T15:20:38Z" modified="2013-01-12T15:20:40Z" visited="2013-01-12T15:20:38Z">

but it is not shown in the menu. It seems there is a period of time the files will show up in the menu, but why are they still in this file?
rezitengaM
Level 1
Level 1
 
Posts: 23
Joined: Sun Oct 09, 2011 3:01 pm

Re: Mintmenu (or Zeitgeist) forgets about my own files

Postby xenopeek on Wed Jan 30, 2013 7:41 am

Having a look at the code for the menu (in /usr/share/cinnamon/applets/menu@cinnamon.org/applet.js), it seems it will show a maximum of 20 recently used files in the menu. Older used files will not be displayed.

As for Zeitgeist, that may have been added if you installed another desktop environment or perhaps it is needed for some other application you installed.
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14804
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Mintmenu (or Zeitgeist) forgets about my own files

Postby rezitengaM on Wed Jan 30, 2013 7:58 am

Ah thanks, that explains a lot. Even if I think this is a very strange implementation.

Where can I do a suggestion to make this number of files configurable or make it a number of days which seems much more logical to me?

Ok, I could change it myself (hail, opensource...;-) ) but then I have to patch it after every update...;-)

In addition, I do not know why Zeitgeist is installed on my system. I just installed the "activity journal" and can find all files in there. Only the search functionality is much more tedious.
rezitengaM
Level 1
Level 1
 
Posts: 23
Joined: Sun Oct 09, 2011 3:01 pm

Re: Mintmenu (or Zeitgeist) forgets about my own files

Postby xenopeek on Wed Jan 30, 2013 8:21 am

You installed activity journal? :)
gnome-activity-journal - graphical user interface for Zeitgeist

Suggestions for Cinnamon can be made in various places. Here on the forum, in the Suggestions & New Ideas area (viewforum.php?f=29). On the Community site's ideas pool (http://community.linuxmint.com/idea/welcome), where other users can easily comment and vote their support for your idea. Or probably best as a feature request on GitHub (https://github.com/linuxmint/Cinnamon).
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14804
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Mintmenu (or Zeitgeist) forgets about my own files

Postby rezitengaM on Wed Jan 30, 2013 8:28 am

Haha, I know, but Zeitgeist was already on my system before I installed "activity journal". I just installed it to see what is in the sqlite databases.

It's a little strange, beside in the "activity journal" I do not encounter my activities anywhere in the user interface. So perhaps I will remove Zeitgeist + activity journal to see what happens. Perhaps there is some other dependency which I do not hope. (I do not have any other DE's installed).

I think using the recently-used.xbel file is the best option within the mintmenu but I would like to boost the number of "recently used files".

I will suggest it on Github or figure it out myself if nobody is on my side...;-)

Thanks for your great help!
rezitengaM
Level 1
Level 1
 
Posts: 23
Joined: Sun Oct 09, 2011 3:01 pm

Re: Mintmenu (or Zeitgeist) forgets about my own files

Postby xenopeek on Wed Jan 30, 2013 8:41 am

If you want, you can experiment. Probably editing the file:
Code: Select all
gksudo gedit /usr/share/cinnamon/applets/menu@cinnamon.org/applet.js

and changing the value on the following line, that is in the first 30 lines or so of the file:
Code: Select all
const MAX_RECENT_FILES = 20;

will let you display more files. You will likely have to restart Cinnamon for it to take effect. To do so, press Alt+F2 to show the run dialog, type r (single letter r) and press enter to restart.

Edit: yes you can remove activity journal and zeitgeist. Only the package libzeitgeist-1.0-1 is needed, as some programs depend on that library (it's a library for reading data from the zeitgeist database, so it doesn't do anything without zeitgeist).
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14804
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Mintmenu (or Zeitgeist) forgets about my own files

Postby rezitengaM on Wed Jan 30, 2013 9:02 am

Thanks again,

I changed it to 200 and that works perfectly. I will see if that is a better value.

Personlly, I think "recent files" should find files you used, let's say within the last 2-4 weeks, so perhaps I will have to make it even higher.

Of course, the ~./local/share/recently-used.xbel file is also used by other applications. That's why entries where still in it without showing up in the menu.

It's nice that the configuration is just in one of the .js files. This makes it much easier than I thought..;-)

Thanks and of course I hope this will be helpful to other people as well...

---

PS: I removed "Docky", "Zeitgeist", the directory ~/.local/share/zeitgeist & the "Activity Journal" because I do not use them anymore but I kept "libzeitgeist-1.0-1" as suggested.

PS2: After changing the number of recent files to 200, I did not have to restart Cinnamon. It works immediately.
rezitengaM
Level 1
Level 1
 
Posts: 23
Joined: Sun Oct 09, 2011 3:01 pm

Re: Mintmenu (or Zeitgeist) forgets about my own files

Postby rezitengaM on Wed Jan 30, 2013 9:17 am

Thinking about it, I now realize the reason for the choice

const MAX_RECENT_FILES = 20;

If you move/delete one of "recent files", they will still show up in the menu but, of course, clikcing on them does not work anymore. So by making the list only 20 items long one often prevents strange behaviour. Not really ideal, is it?

Perhaps I will write a little script and run it as a cronjob to check if the files are still in place and otherwise will remove the appropriate entries from

~./local/share/recently-used.xbel

(or change the location to the new one, if possible).

This script can also delete entries older than x days.

I will then set

const MAX_RECENT_FILES = 20;

to a very large value and my make sure the mintmenu behaves nicely.

Of course I would hope this would be the default behaviour of the mintmenu, but a nice workaround can be such an easy solution.

I will post the script here, if people are interested.
rezitengaM
Level 1
Level 1
 
Posts: 23
Joined: Sun Oct 09, 2011 3:01 pm

Re: Mintmenu (or Zeitgeist) forgets about my own files

Postby xenopeek on Wed Jan 30, 2013 10:03 am

It's this piece of code that does the work of adding the 20 recently used files and :
Code: Select all
            for (let id = 0; id < MAX_RECENT_FILES && id < this.RecentManager._infosByTimestamp.length; id++) {
                let button = new RecentButton(this, this.RecentManager._infosByTimestamp[id]);
                this._addEnterEvent(button, Lang.bind(this, function() {
                        this._clearPrevAppSelection(button.actor);
                        button.actor.style_class = "menu-application-button-selected";
                        this._scrollToButton(button);
                        this.selectedAppDescription.set_text(button.file.uri.slice(7));
                        }));
                button.actor.connect('leave-event', Lang.bind(this, function() {
                        button.actor.style_class = "menu-application-button";
                        this._previousSelectedActor = button.actor;
                        this.selectedAppTitle.set_text("");
                        this.selectedAppDescription.set_text("");
                        }));
                this._recentButtons.push(button);
                this.applicationsBox.add_actor(button.actor);
            }

It's probably not to hard to rewrite that to a while loop, with using two counters instead of one. Currently it uses the 'id' counter, starting at 0 and counting up to MAX_RECENT_FILES, or to this.RecentManager._infosByTimestamp.length, whichever is smaller. (this.RecentManager._infosByTimestamp has the list of recently used items, sorted by timestamp.) So if instead you add also a counter for 'items' or something, and keep increasing that if you add a recently used file that still exists... I don't know how to check if the file exists, but the rest of the code would look like this. Just needs the if statement done :wink:
Code: Select all
            for (let items = 0, id = 0; items < MAX_RECENT_FILES && id < this.RecentManager._infosByTimestamp.length; id++) {
                let button = new RecentButton(this, this.RecentManager._infosByTimestamp[id]);
                if (/* somehow test if button.file.uri exists, and if it doesn't then this if statement should be true so the loop continues with the next id */) {
                        continue;
                }
                this._addEnterEvent(button, Lang.bind(this, function() {
                        this._clearPrevAppSelection(button.actor);
                        button.actor.style_class = "menu-application-button-selected";
                        this._scrollToButton(button);
                        this.selectedAppDescription.set_text(button.file.uri.slice(7));
                        }));
                button.actor.connect('leave-event', Lang.bind(this, function() {
                        button.actor.style_class = "menu-application-button";
                        this._previousSelectedActor = button.actor;
                        this.selectedAppTitle.set_text("");
                        this.selectedAppDescription.set_text("");
                        }));
                this._recentButtons.push(button);
                this.applicationsBox.add_actor(button.actor);
                items++;
            }
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14804
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Mintmenu (or Zeitgeist) forgets about my own files

Postby rezitengaM on Fri Feb 01, 2013 4:10 pm

Hello everybody,

@xenopeek, thanks again. Yes, of course it is a good idea to change the mintmenu code directly. But I think I will just suggest it to Clem and the others and see if they like it.

In the meantime I fixed the problem with a little Perl script. I just finished it, so it is not really well-tested. But I think it works nicely. Running the script will remove all non-existent files from the recently-used files and also files that have not been accessed for more than 30 days.

If one combines this script (as a cronjob) with an increase of "const MAX_RECENT_FILES = 20;" to a large number (e.g. 200000) the mintmenu will find your recently-used files quite nicely.

If people are interested, I will post the script here.
rezitengaM
Level 1
Level 1
 
Posts: 23
Joined: Sun Oct 09, 2011 3:01 pm

Re: Mintmenu (or Zeitgeist) forgets about my own files

Postby xenopeek on Fri Feb 01, 2013 4:35 pm

Please do! That's always interesting and may even be a good example solution to include in a suggestion to the developers on how they can improve the "recently used" list in the menu.
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14804
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Mintmenu (or Zeitgeist) forgets about my own files

Postby rezitengaM on Sat Feb 02, 2013 4:24 am

Hello everybody,

attached you will find my little script to automatically remove nonexistent files from the recently used files menu. Using this script (as a cronjob) in conjunction with an increase of the number of items on the recently used files list (thanks xenopeek for pointing this out) will greatly improve the user experience when searching for recently used files in the mintmenu.

A detailed description can be found in the header of the script itself.

If you have any questions about the script, or you find a bug, please let me know in this thread.

Hopefully the script will be useful to some of you Mint-lovers.

Have fun and take care :-)

PS: I will also suggest to the Mint developers to further improve the search capabilities in the mintmenu. Personally I think it would be a great idea if my own files would be automatically indexed (e.g. with tracker) and that those results are shown with the search results in the menu.
Attachments
clean recent files.7z
(13.3 KiB) Downloaded 28 times
rezitengaM
Level 1
Level 1
 
Posts: 23
Joined: Sun Oct 09, 2011 3:01 pm

Re: Mintmenu (or Zeitgeist) forgets about my own files

Postby rezitengaM on Tue Feb 12, 2013 12:18 pm

Hello Mint-Lovers,

here is an updated version of the script to keep your recently used files complete and clean.

In this version I fixed a little annoyance with a work-around.

The problem is that editing the file "recently-used.xbel" will interrupt the smooth playing of a video in vlc or totem (and other video players) for a short period of time. The audio component will continue nicely but the video will come to a halt for a moment. (You can check this strange behaviour. Just play a video in vlc and open a text file. The video will be interrupted for a brief period of time.) As the script is run by cron at a several minute interval this can be annoying.

If you run the script with the flag "-v" it first checks whether vlc or totem uses more than 10% CPU in the "top" output. This is used as an indicator that a video is playing. If so, the script exits immeadiately without editing the recently-used.xbel file. In this way the playing of the video is not interrupted.

In addition the "recently-used.xbel" file is only written to if the contents have actually changed. By doing this the problem with the pausing videos is effectively prevented.

Of course, it would be nicer if vlc, totem would not interrupt the playing when the recently-used.xbel file is edited, but for the purpose of this script the chosen work-around is quite adequate.

Have fun and take care.

Kind regards,

rezitengaM (as Magnetizer was already in use)
Attachments
clean recent files.7z
(13.95 KiB) Downloaded 22 times
rezitengaM
Level 1
Level 1
 
Posts: 23
Joined: Sun Oct 09, 2011 3:01 pm

Linux Mint is funded by ads and donations.
 

Return to Software & Applications

Who is online

Users browsing this forum: Buzzsaw, focus77, Google Adsense [Bot], number nine and 15 guests