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

@@ -16,8 +16,7 @@ let
pkill = "${pkgs.procps}/bin/pkill";
date = "${pkgs.coreutils}/bin/date";
mkdir = "${pkgs.coreutils}/bin/mkdir";
recDir = "$HOME/Videos/Recordings";
xdgUserDir = "${pkgs.xdg-user-dirs}/bin/xdg-user-dir";
# A single key both starts and stops.
# A running wf-recorder is stopped with SIGINT so it finalises the file.
@@ -32,8 +31,9 @@ let
fi
region=$(${slurp}) || exit 0
${mkdir} -p "${recDir}"
file="${recDir}/recording-$(${date} +%Y%m%d-%H%M%S).mp4"
dir="$(${xdgUserDir} VIDEOS)/Recordings"
${mkdir} -p "$dir"
file="$dir/recording-$(${date} +%Y%m%d-%H%M%S).mp4"
${notify-send} -a "Screen recording" "Recording started" "Region capture, no audio."
${wf-recorder} -g "$region" -f "$file"