This morning, I finally got around to rewriting my
update_nvidia helper to unbreak the whole “defer driver updates until reboot to keep the kernel module and libGL in sync” thing I have going and, this afternoon, while working on something else, I realize that anything running in Flatpak was working all along because the Flatpak devs did too good a job of detecting and supplying matching in-runtime libraries for video drivers.
Why is this relevant? Well, because I realized it while fixing something else that had been bugging me: The papercuts in my script for generating flatpak CLI launcher wrappers.
For those who missed my initial announcement, it’s a script you run after installing something through Flatpak and it generates a wrapper so you can type
mpv instead of
flatpak run io.mpv.Mpv in a terminal window, and it’ll even handle
--file-forwarding for you so you get an experience comparable to what the XDG File Chooser portal gives you with Open/Save dialogs.
So, what did I improve? Well, here’s the features list now:
- Run it with no arguments and it’ll set up or update a
~/.local/bin/flatpakyou can add to your
PATH. (not new)
- Add things to the
CMD_REMAPPINGSlist (which comes with entries like
["com.github.tchx84.Flatseal"]='flatseal'pre-populated) to fix stuff it couldn’t quite get right. (NEW)
- Add things to the
EXTRA_CMDSlist (which comes with
["org.atheme.audacious"]='audtool'pre-populated) and you can optionally expose a second command from inside each Flatpak. (NEW)
LD_PRELOADbefore launching the Flatpak application to silence spurious “Can’t find
libgtk3-nocsd.so.0in the Flatpak runtime” errors. (not new)
- If any arguments are valid relative paths, make them absolute to fix an annoying bug with how
--file-forwardingbehaves without breaking non-path arguments. (NEW)
I did have to switch from dash-compatible shell script to bash script to take advantage of proper array support, but, from what I remember, the Linux Standard Base required that
/bin/bash exist, so that shouldn’t be too big a hardship.
It still doesn’t solve the problem of Flatpak’s not coming with man pages, but there’s not a lot I can do when the files just aren’t included. Aside from that, I’m very impressed at how polished this feels when I’m hacking around the Flatpak developers’ putting their foot down and declaring comfortable command-line operation to be out of scope.