Is there a way to change `eog` sort order?

I am admittedly not using Eye of GNOME on GNOME, but on sway on Fedora 35. This is eog 41.1.

Given a directory full of basenames of differing lengths, e.g.

$ ls -l
total 504
-rw-rw-r--. 1 kalvin kalvin 71809 Feb 13 00:54 foo-0100.jpg
-rw-rw-r--. 1 kalvin kalvin 71809 Feb 13 00:54 foo-0101.jpg
-rw-rw-r--. 1 kalvin kalvin 71809 Feb 13 00:31 foo-010.jpg
-rw-rw-r--. 1 kalvin kalvin 71809 Feb 13 00:54 foo-0110.jpg
-rw-rw-r--. 1 kalvin kalvin 71809 Feb 13 00:53 foo-011.jpg
-rw-rw-r--. 1 kalvin kalvin 71809 Feb 13 00:53 foo-012.jpg
-rw-rw-r--. 1 kalvin kalvin 71809 Feb 13 00:55 foo-020.jpg

I’d like eog to go through them in the order given above (where the suffix isn’t treated as strongly numeric).

What actually happens is that eog appears to interpret the suffixes numerically and presents them in the order

foo-010.jpg
foo-011.jpg
foo-012.jpg
foo-020.jpg
foo-0100.jpg
foo-0101.jpg
foo-0110.jpg

Is there a quick fix for this on my side? Some hidden advanced preference, environment variable, GTK setting?

Well, theoretically there’s Bug 74 with a merge request still in need of some work that’ll add support for sorting by other criteria.

But I think that won’t be of much help to you as your wish is a very special form of sorting by filename which won’t change with that feature.

That leaves the option to patch your local eog installation to use g_utf8_collate_key (which sorts strictly alphabetically) instead of g_utf8_collate_key_for_filename (which is smart with numbers) or you could try leveraging eog’s plugin interface to change the search function for a window’s list of images. The eog-plugins package ships with the “Python Console” which allows playing with API.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.