diff --git a/hosts/common/home/xdg-dirs.nix b/hosts/common/home/xdg-dirs.nix index f847c436..8ab37f32 100644 --- a/hosts/common/home/xdg-dirs.nix +++ b/hosts/common/home/xdg-dirs.nix @@ -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" diff --git a/hosts/common/programs/megapixels.nix b/hosts/common/programs/megapixels.nix index a9b906bf..7be1d977 100644 --- a/hosts/common/programs/megapixels.nix +++ b/hosts/common/programs/megapixels.nix @@ -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 = [