blue-systems / plasma-5.5

Plasma 5.2 - 5.5
0 stars 0 forks source link

[Recent documents]: symlinking ~/.kde/share/apps/RecentDocuments #122

Closed star-buck closed 8 years ago

star-buck commented 9 years ago

Recent documents: How do we get the information that some document was opened or edited in for example LibreOffice? It seems doubtful that LibreOffice will adapt to kamd... so any way to get the information what document was edited or opened from within Plasma?

Note: Under Windows(7), any recent document gets listed (even from old programs like photoshop6.0 which is 15 years old and has not been adjusted by this probably, but still gets documents added even when opened from within that old program via its ancient filepicker...). Maybe they monitor "modified date" on document types? (->baloo?)

star-buck commented 9 years ago

Quote from @ivan-cukic : "

About Recent documents: How do we get the information that some document was opened or edited in for example LibreOffice?

KAMD listens to changes in .local/share/RecentDocuments (or more precisely, it watches for the directory returned by KRecentDocument::recentDocumentDirectory()), so if an application supports the XDG spec for that, it will be supported. It should be populated every time someone clicks a file in dolphin or opens a file through kde's file dialogue.

Now, there is something wrong in NetRunner's setup - that directory remains empty.

Update:

After some digging, I realized the XDG Recent Documents reported by Dolphin go to ~/.kde/share/apps/RecentDocuments folder (dolphin 4.x with KRecentDocument library from 4.x), so it does not end up in kamd (which uses KRecentDocument library from 5.x).

This can be fixed simply by making ~/.kde/share/apps/RecentDocuments a symbolic link to ~/.local/share/RecentDocuments. But this needs to be done while setting up the account, or possibly on user log-in (the later option is safer - if the user decides to rm -fr .kde at some point)."

llelectronics commented 9 years ago

For now I created an env script in plasma-workspace folder that forces creating a link ln -sf ~/.kde/share/apps/RecentDocuments ~/.local/share/RecentDocuments . Not sure if there is a better or easier way to fix this. (Maybe also upstream somehow)

star-buck commented 9 years ago

Seems the symlink doesnt do much... Any way to test specifically if the symlink is working with regards to Recent Documents?

ivan-cukic commented 9 years ago

Can you do a ls ~/.local/share/RecentDocuments/ ls ~/.kde/share/apps/RecentDocuments/ after opening a few docs in LOffice?

star-buck commented 9 years ago

here it is a user report of it: http://www.netrunner.com/netrunner-16-ozymandias/#comment-2034079901

ivan-cukic commented 9 years ago

I've just installed the final release of Ozymandias, did the linking, and it works.

Screencast is available here: https://dl.dropboxusercontent.com/u/55072503/Testing/recentdocuments.mkv

The only thing that comes to mind that could be a cause for this not working is if the ~/.kde/share/apps/RecentDocuments/ existed before calling ln -s. In that case, this directory will not point to .local/..., but will have another RecentDocuments (~/.kde/share/apps/RecentDocuments/RecentDocuments) inside that will point to .local/...

llelectronics commented 9 years ago

Strange the linking did not work here during the development. The linking was correct and both folders (or in this case the folder and the link to the folder) had the same files inside. Despite that RecentDocuments in the menu did not show anything. I will test that again and if it really works now I will try thinking about reenabling the env script.

llelectronics commented 9 years ago

Ok linking does work now. Turns out that the direction how you link matters. So this is a working solution now: https://github.com/netrunner/netrunner-default-settings/blob/master/etc/skel/.config/plasma-workspace/env/recentdoc_fix.sh

ivan-cukic commented 9 years ago

Yes, the order is important - I haven't noticed that you swapped them in the above post. Otherwise, Qt does not report directory changes - since it is not a directory, but a symlink. (kamd listens for changes in .local/...)

star-buck commented 8 years ago

can this be closed?