megapixels: place photos in ~/Pictures/Photos instead of directly in ~/Pictures

This commit is contained in:
Colin 2024-04-21 23:13:49 +00:00
parent ef9b0e9309
commit a92960d778
2 changed files with 13 additions and 2 deletions

View File

@ -3,11 +3,15 @@
{
# XDG defines things like ~/Desktop, ~/Downloads, etc.
# these clutter the home, so i mostly don't use them.
# note that several of these are not actually standardized anywhere.
# some are even non-conventional, like:
# - XDG_PHOTOS_DIR: only works because i patch e.g. megapixels
sane.user.fs.".config/user-dirs.dirs".symlink.text = ''
XDG_DESKTOP_DIR="$HOME/.xdg/Desktop"
XDG_DOCUMENTS_DIR="$HOME/dev"
XDG_DOWNLOAD_DIR="$HOME/tmp"
XDG_MUSIC_DIR="$HOME/Music"
XDG_PHOTOS_DIR="$HOME/Pictures/Photos"
XDG_PICTURES_DIR="$HOME/Pictures"
XDG_PUBLICSHARE_DIR="$HOME/.xdg/Public"
XDG_SCREENSHOTS_DIR="$HOME/Pictures/Screenshots"

View File

@ -1,6 +1,13 @@
{ ... }:
{ pkgs, ... }:
{
sane.programs.megapixels = {
packageUnwrapped = pkgs.megapixels.overrideAttrs (upstream: {
postPatch = (upstream.postPatch or "") + ''
# patch it to save photos in a more specific directory
substituteInPlace src/process_pipeline.c \
--replace-fail 'XDG_PICTURES_DIR' 'XDG_PHOTOS_DIR'
'';
});
# megapixels sandboxing is tough:
# if misconfigured, preview will alternately be OK, black, or only 1/4 of it will be rendered -- with no obvious pattern.
# adding all of ~ to the sandbox will sometimes (?) fix the flakiness, even when `strace` doesn't show it accessing any files...
@ -19,7 +26,7 @@
".local/share/applications" #< needed for viewing photos, until i can sort out the portal stuff
".cache/mesa_shader_cache" # loads way faster
"tmp"
"Pictures" #< TODO: make this Pictures/Photos and save photos there
"Pictures/Photos"
# also it addresses a lot via relative path.
];
sandbox.extraPaths = [