feat(desktop): resolve media output paths through XDG user-dirs

Add a modules.desktop.userdirs module that declares the XDG user directories,
and route the recorder and screenshot tools through xdg-user-dir so their
output folders (Videos/Recordings, Pictures/Screenshots) follow one relocatable
source instead of a hardcoded $HOME path.
This commit was merged in pull request #21.
This commit is contained in:
2026-07-22 23:11:16 -04:00
parent 0e92de7eea
commit ab89ba8391
5 changed files with 28 additions and 9 deletions

View File

@@ -13,8 +13,7 @@ let
grimblast = "${pkgs.grimblast}/bin/grimblast";
satty = "${pkgs.satty}/bin/satty";
wl-copy = "${pkgs.wl-clipboard}/bin/wl-copy";
shotDir = "$HOME/Pictures/Screenshots";
xdgUserDir = "${pkgs.xdg-user-dirs}/bin/xdg-user-dir";
# satty is the annotation step, and its copy action is set to save as well,
# so a single keystroke through it lands the shot in both the clipboard and a
@@ -22,10 +21,11 @@ let
capture =
target:
pkgs.writeShellScript "screenshot-${target}" ''
mkdir -p ${shotDir}
dir="$(${xdgUserDir} PICTURES)/Screenshots"
mkdir -p "$dir"
${grimblast} save ${target} - \
| ${satty} --filename - \
--output-filename "${shotDir}/screenshot-%Y%m%d-%H%M%S.png" \
--output-filename "$dir/screenshot-%Y%m%d-%H%M%S.png" \
--copy-command ${wl-copy} \
--save-after-copy \
--early-exit \