Posts › Improving Koko (Part 2 of 2)

DRAFT: this post is currently hidden

TODO pictures (whatsnew: multiple kokos, maybe video of drag-drop between kokos; community: sidebar, maybe undo?)

Nearly two months ago, in the previous blog post, I introduced Koko and discussed several of the new features, fixes and visual changes that we’ve implemented. Since that first post, myself and others at Techpaladin have continued working, dotting Koko’s i’s and crossing its t’s (albeit not literally, because “Koko” does not have ‘i’ or ’t’).

In this likely final instalment, I’ll bring you up to date on what’s new and, as promised, describe how we’ve refactored Koko’s backend and dramatically improved performance.

Where applicable, bug fixes have been backported to Koko’s 26.08 release, but new features will arrive in Koko 26.12.

What’s New?

Koko is now, finally, a proper multi-instance application. Whilst making this work superficially is easy, simply changing KDBusService::Unique to KDBusService::Multiple, the backend database that Koko uses to drive its location and time views does not support multiple instances of Koko tracking new files and trying to write to it at the same time.

We made it so Koko’s FileSystemTracker only runs in a single instance of Koko. All instances will try to create it, but only one will be able to do so — others will wait until they can try again, so that when that first instance is closed, there will still be a FileSystemTracker interacting with Koko’s index (but only ever one).

Indexed files are referenced by a second database, which stores metadata. Since all instances of Koko will want to use this database, we’ve modified it to support concurrent usage and be more robust to conflicts, instead of wrapping all of its operations in one large transaction and blocking.

We’ve also cleaned up actions, with file actions shared between the gallery and media view pages belonging to the “File” group rather than “Media View”. Whether an action can be performed is properly advertised, so file actions are correctly disabled, which was broken in previous refactoring. “Properties” and “Rename” actions are now available.

Whilst Koko currently allows you to drag files out of the gallery (for instance, into dolphin), as well as to copy them, we did still lack pasting and dragging files into Koko. No longer — Koko now has a paste action, and the gallery will now accept dropped files for copying/moving.

When new files are introduced by pasting or dropping, they are selected and the view will move to show them.

Files can also be dropped on the URL navigator, as a handy way to move them up a level. Bookmarked locations (that aren’t ‘virtual’ like tags or time/location collections) also accept dropped files.

Adding the paste action to complement copying is great, but it exposes a bit of an oversight: there’s no cut action. Despite the fact that you should never run with scissors, we did it anyway and implemented it. It’s the same operation as copying a file, with a hint added to the clipboard to indicate that the file(s) are cut. It’s up the application to handle this properly when pasting, and to display these files as cut with the traditional opacity, and so Koko now does that too.

We’ve fixed broken folder bookmarking, selection mode sticking after navigating the gallery to a different location, and gallery search text disappearing when returning from the media view.

Community Contributions

We’re not the only ones who have been busy. Notably, Koko has attracted two new contributors (whom confusingly share a first name). I would be remiss not to point out their contributions also.

Jan R added the option to use a neutral gray background colour in the media view, in addition to the existing black, white and theme-specified options. In addition, a substantial change allows Koko to only present image files (and ignore videos). This does not currently extend to the database, only affecting browsing, but the foundation is laid for future work to affect the database also.

Jan M added a passive notification when deleting a file, allowing it to be undone directly. An issue where indexing ignores images marked executable was also resolved. Shortcuts were added to editor actions (flip, rotate and crop). Finally, a new collection (or view/page) that shows all the images indexed by Koko was added, with the sidebar rearranged slightly to better accommodate this.

Performance

TODO Copy content from previous blog wip (3-improving-koko-old) and edit

What’s Next?

Whilst Koko won’t be as big a focus for me under Techpaladin, we’ll continue to perform reviews, perform maintenance and look at bugs.

TODO expand