Replacing Eye of GNOME and Nautilus =================================== :draft: :tags: blog, rant *WIP*: Move all the GNOME hate to why-gnome-sucks.adoc. ...or at least trying to _Warning: this is a massive rant, and many people will find parts of it offensive. I'll call things as I see them._ // I'm extremely good at finding and running into problems. *WIP*: what I have but others don't -- keeping the view settings, something a lot of people ask for, is more or less a single if statement. *WIP*: Implementing GFile https://gitlab.gnome.org/GNOME/glib/-/issues/2705 *WIP*: https://discuss.haiku-os.org/t/xlibe-an-xlib-x11-compatibility-layer-for-haiku/11692/7 *WIP*: I'm not sure whether Keith Packard deserves to be glorified, or sent anthrax to for all the suffering his legacy has brought on humanity, and as a warning to others to not impose gamma-naïve graphics libraries onto others. - https://lobste.rs/s/phl1jm/wine_on_wayland_year_end_update_improved#c_a6oir1 - At some point, the "Open With Other Application" dialog of Nautilus started remembering the choice. But I didn't _always_ want GIMP or Rawtherapee! It turned out that I didn't have default associations for such files, in which case it remembered the last used application. And up until recently, the dialog didn't allow for setting the default, nor did it indicate whether one currently existed at all. - Neither Eye of GNOME nor GIMP (2 and 3) can view images using more than 8 bits per channel, despite being able to run with a https://wiki.gentoo.org/wiki/30bpp[30-bit X.org visual]. And even if they could, GTK+{nbsp}4 would https://docs.gtk.org/gtk4/migrating-3to4.html#review-your-window-creation-flags[take that away] later, https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1756[unless] the GL backend is taught to handle it. - Eye of GNOME contains a duplicitous, incapable file manager--for my use case, the image viewer would greatly profit from being integrated into a proper file browser, so that it does not need to re-read the directory each time it's run. It'd also keep https://gitlab.gnome.org/BrainBlasted/loupe/-/issues/2[sorting] in sync, without the proposed clownery of using DBus. - vi-like controls would be welcome. - Last but not least, I'd like to tag my pictures, and detect duplicates early. From time to time I look around, yet I haven't been able to find any clearly better solution for Linux: - Nautilus forks were buggy, - Thunar is what I've had to start using once all GNOME software became complete rubbish, however it doesn't address all my pain points, - sxiv rather looks like a good starting point, although it's close to my vision of UI, - no other standalone image viewer is much better at the job either, - DigiKam is inexcusably bloated, - Shotwell wants to take '`ownership`' of all my files, - gThumb has actually almost become what I want, and it's being https://gitlab.gnome.org/GNOME/gthumb/-/blob/master/NEWS[actively developed], yet there are several practical issues (e.g., many missing shortcuts, and the staggered view would be inconvenient to implement), and it suffers from the terrible UX of modern GNOME (randomised placement of cryptic controls, pointless and annoying animations). I can make do with a minimalistic, spartan UI. But the foundations need to be rock-solid. '`I'll just use GTK+`' ---------------------- …and other famous last words. I'm familiar with the stack, having done some custom theming and programming for it, starting with its +++second major version+++, but I'm becoming progressively less and less happy about it. *WIP*: See what my things do under Sway at all https://gitlab.gnome.org/GNOME/mutter/-/issues/217 (remove reference, part of:) https://news.ycombinator.com/item?id=23795901 also https://news.ycombinator.com/item?id=25719796 //// - logdiag: - the menu is fucked up, clicking on Help opens File - Cannot reproduce. - But menus act weird, can't click on header, hold and depress on item, focus is also mangled. - Gdk-Message: 18:32:10.309: Unable to load dnd-copy from the cursor theme - dragging shows the pointer cursor - sdgui: - cannot read the PRIMARY selection - both work great under `env -u WAYLAND_DISPLAY` - in any case, server-side decorations are fine and working //// Surely a subset will do ----------------------- GTK+{nbsp}3, at its core, is _still_ a decent abstraction over X11 and Wayland (not that I care about the latter, XWayland forever), and I can draw my own widgets using '`raw`' https://viruta.org/helping-cairo.html[Cairo] and https://www.phoronix.com/scan.php?page=news_item&px=HarfBuzz-Hinting-Woe[Pango], similarly to the way I used to in my Win32 days.footnote:[Back in 2007 or so, as a kid, I even accidentally pre-invented the looks of GTK+{nbsp}3's GtkMessageDialog--it has buttons glued to the bottom side of the window, with a gradient background. I also animated it to disappear moving itself off the screen--that didn't catch on.] Also, before I finally implemented that staggered-view file browser, I could reuse https://jayfax.neocities.org/mediocrity/gnome-has-no-thumbnails-in-the-file-picker.html[the file open dialog]. *WIP*: https://release.gnome.org/44/ thumbnails Thumbnails ---------- My dreamt-of browser -------------------- *WIP*: Talk about, add a screenshot. // TODO: A screenshot of the staggered view in a directory full of SFW ponies, // with the caption "I told you." underneath. Finish this before publication, // to have anything to show. ...isn't all that magical. *WIP*: Add a section about the glow, how it's not using the usual hack with a blurred mask as it's actually harder to implement. Can add with a script to show it, since it's annoying to handle. The stupid method is CSS box-shadow, supported by GTK+. *WIP*: Maybe CSS isn't that awful after all, used a hack to do checkerboards. OpenGL ------ Because I hate myself, and since bi-cubic filtering turns out to be quite slow in software, I decided to spend countless hours on HW-accelerated scaling. OpenGL is definitely not easy to get into. Luckily, the GDK integration is almost sane, and quite appropriate for this usecase. *WIP*: Pull in notes from below. Boilerplate ----------- To affirm its existence, https://git.janouch.name/p/fiv[my project] needed a name and a logo. I went for describing the _intent_: I'm making a _fast image viewer_, the baseline being Eye of GNOME's gdk-pixbuf, hence _fiv. For the logo, or rather icon, I sketched something with lots of gradients in Inkscape, hated the experience, as well as the resulting bloated file, and remade it in clean, hand-written SVG, which wasn't nearly as painful as I feared it would be. One day I might automatically generate a bunch of PNGs from it for installation, e.g., https://git.janouch.name/p/logdiag/src/commit/3102bc0cb9d84676ed400935883687d8a738c835/CMakeLists.txt#L50[using ImageMagic's convert], or binaries this in turn may delegate to: rsvg-convert and Inkscape. *WIP*: Link them. Finally, I've made an AUR package, and a Nix derivation. Parasitic features ------------------ *WIP*: Lossless JPEG cropper. During the time it took me to finish this article, I found out there was no decent lossless JPEG cropping GUI application for Linux. Considering this is part of libjpeg-turbo's high-level API, I decided to make one, and _fiv_ seemed liked the best place to put it. The reason it's not a direct part of its UI is that I had a need for batch processing. Portability ----------- The primary target for the image viewer is Linux, but GTK+ is supposed to be portable. Future development ------------------ *WIP*: Add some thoughts about loader servers. https://tecnocode.co.uk/2013/10/21/writing-a-gnome-thumbnailer/ is interesting (they're https://wiki.gnome.org/DraftSpecs/ThumbnailerSpec already trying to screw it up). Note that I'll probably want a gdk-pixbuf-alike superserver for the common formats, so that starting the program doesn't cause a ton of fork-execs. Overrides deserve setting priorities. *WIP*: Make it colour-accurate, use the full range of the visual or dithering, proper gamma handling. Displays with different profiles set might be a problem. To curb performance, it should perhaps be a special colour-correct mode, but do it wrong normally. *WIP*: Unlike EoG or all GIMP version so far, fiv already supports 30-bit visuals for a subset of images, even though they do actually keep and use that visual on their windows under GTK+ 3. Dithering could theoretically be used through pixman--Cairo https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/24[doesn't] expose this functionality. *WIP*: Cairo can't do RGB30_A2, so we need to avoid it for serious operation. *WIP*: GIO has a lot of things that are necessary for a full-fledged file manager, so replacing Nautilus as a whole is possible. *WIP*: Consider using OpenGL for scaling https://www.phoronix.com/forums/forum/software/desktop-linux/921042-gnome-s-gtk-vulkan-renderer-faster-than-opengl-now-working-on-windows?p=921725#post921725 It has great potential of making the software much faster. In theory, Cairo has a GL backend, but it's marked as experimental, so Arch https://bugs.archlinux.org/task/56580[doesn't] include it. Using GTK's CSS requires going through Cairo, so OpenGL cannot otherwise be used as a rendering target for widgets. I feel like I'm doing archeology with this project. It's a bit of a shame that Cairo has lost most of its potential, in addition to GUI rendering, I successfully employed it in the past to render PDFs. Overall evaluation ------------------ There's a lingering sense of sadness. Somehow, I repeatedly expect things to just be there, work well, and make sense, yet that's rarely the case. ‘If you want something done right, https://blog.lexa.ru/2009/03/09/sdelaj_blin_sam.html[do it yourself]’, the saying goes. Which makes this frustrating, because the necessary time investment in software development tends to be extreme, no matter the approach. I'm an expert with deep domain knowledge (due to necessity, curiosity, and as a symptom of a pathological need to remake things how they _should_ be). Nonetheless, I struggle. *WIP*: I've done it. I've delivered value. To myself [...] I've ended up with an advanced prototype, and I might or might not continue working on it later. The codebase and all the related experience may certainly come handy, if only to experiment with https://www.hackerfactor.com/blog/index.php?/archives/432-Looks-Like-It.html[some] https://git.janouch.name/p/haven[ideas], but I have other things to do with my life. The best case would be to get noticed by a few senpais with too much time on their hands--a slightly silly hope, but https://github.com/muennich/sxiv/network[who knows]... I use one of the freeëst possible licencesfootnote:[In before '`You're enabling evil corporations to make profits off of your niche porn browser!`' Applying copyleft to the *nix desktop https://www.paritybit.ca/blog/free-software-is-an-abject-failure[surely] helps it grow. https://lumina-desktop.org/post/2021-07-01/#will-lumina-be-relicensed-to-the-gpl[:—D]], so steal whatever you like, and shape it to your liking. I might even want to merge it! *WIP*: I guess it's not "in the meantime" anymore. In the meantime, the most efficient course of action is probably patching up gThumb to the greatest extent upstream will let me. Or maybe restart from the (n)sxiv codebase, which builds on top of _a very stable stack_, and forget about the horrors of GNOME altogether--https://athenawalker.substack.com/p/goals-journeys-and-outcomes[let it go]. The relationship is clearly abusive, what with the project's heaps of chaotically destructive asshats and evergrowing complexity. Outsiders don't really have the know-how nor resources, much less rigour, to maintain forks of it all. Right now, having spent around a month of my life battling with https://www.youtube.com/watch?v=2MEcAPvkAkw[perfectionism], I need a rest. [.text-center] image::/files/pango.jpg[width="75%",link="https://raw.githubusercontent.com/steveklabnik/CLOSURE/master/CLOSURE.pdf"] *WIP*: Consider adding a poll to ask whether anyone would be willing to sponsor certain features. *WIP*: Seemingly possible to create a GVfs that browses imageboards. *WIP*: I can't wait for entitled users to demand features, as is usual. *WIP*: https://github.com/thestinger/termite README https://linuxreviews.org/Termite_Is_Dead._Dev_Lashes_Out_At_GNOME#comment-2265 (mildly confused: libadwaita is GTK+ 4, G_DECLARE_FINAL_TYPE is only scarcely used in GTK+ 3, more points sound off) *WIP*: https://github.com/eXeC64/imv might also be eligible for restarting the programming effort, though it's remarkably low-level. *WIP*: Use https://github.com/phw/peek to make a screen capture, prolly. Make it play on click. *WIP*: libheif is an extremely sad thing, yet there are no alternatives for HEIC. The good news is that the library doesn't look particularly involved. *WIP*: Samsung is a joke, and a copy-cat, but they do everything badly. Proprietary segment, and panoramas/portraits only work with JPEG. HEIFs use a custom box with the same proprietary data. Add a table comparing approaches for different features. Apple Live Photo, Samsung Motion Photos. Disparity map. Samsung's panoramatic JPEGs have no EOI marker. *WIP*: Mention WWDC talks https://developer.apple.com/videos/play/wwdc2017/507 Apple's depth map is distorted for the lens. Depth map info is in XMP. The map can be 16-bit lossless JPEG. The XMP is attached to that. The HDRGainMap (kCGImageAuxiliaryDataTypeHDRGainMap, kCGImageDestinationPreserveGainMap) is nearly unsearchable--it's not Dolby Vision, because that is for video, and https://jpeg.org/jpegxt/software.html[JPEG-XT]/Dolby JPEG-HDRs is a different thing which has a BSD implementation out there. "Smart HDR" sounds like a close term. But because Apple is so incredibly secretive about it, it might be proprietary. I think this form of HDR is a fairly stupid idea, but I'd still like to know what it is and how _exactly_ to apply it. *WIP*: https://invisibleup.com/articles/34/ *WIP*: https://gitlab.gnome.org/GNOME/gtk/-/issues/402 *WIP*: Only good C alternative would be Hare, once someone creates a second compiler for it, preferrably on top of LLVM. Go creates bloated libraries, and should not be mixed with C. (NOTE, replicating project/fiv notes here.) Pascal has one compiler under GPL and the last standard is from 1990/91. Ada feels like an option, but creates bloated binaries. Zig is unstable. Both Zig and Nim are a mess. Myrddin is awkward but desired but it looks dead. *WIP*: Started with the intention of being fast, ended up with a better way of browsing--thumbnails load fast. *WIP*: A "thanks to" section. And a people to fund section with libjpeg-turbo author and me in it (favoured targets: speed, colour accuracy, format support), let's see if I can find more. Make a note that sponsoring does not seem to be particularly popular. *WIP*: Enlightenment https://lobste.rs/s/qfyebv/enlightened *WIP*: C https://danluu.com/boring-languages/ Disclaimer: I'll annoy you and link you to weird places? *WIP*: Thanks to Bjorne Stahl (fix diacritics) for being a beacon. *WIP*: https://www.daveperrett.com/articles/2012/07/28/exif-orientation-handling-is-a-ghetto/ https://zpl.fi/exif-orientation-in-different-formats/ *WIP*: I'm a shiny light bugs are attracted to. *WIP*: Qt/KDE https://www.kdab.com/fun-and-scary-code-from-qt-and-kde/ *WIP*: A future plan could be making something akin to Preview from macOS. *WIP*: Note that I found ISO BMFF on IPFS. ++++ ++++