profile.d: add xdg screenshots dir setting

This commit is contained in:
Aminda Suomalainen 2024-07-28 10:46:48 +03:00
parent c4b20f481d
commit 81e8ef2754
Signed by: Mikaela
SSH Key Fingerprint: SHA256:CXLULpqNBdUKB6E6fLA1b/4SzG0HvKD19PbIePU175Q

View File

@ -0,0 +1,26 @@
# This script currently sets just the xdg screenshots directory, while I am
# unsure of whether anything else than grimshot utilizes it.
# WARNING: my train of thought got disturbed writing this and I lost the red
# thread of what the fluff was I doing again.
if [ $(hash xdg-user-dir 2> /dev/null) ] && [ $(hash xdg-user-dir-update 2> /dev/null) ]; then
echo "50-xdg-screenshots.sh ok"
fi
if [[ $(xdg-user-dir SCREENSHOTS) != $(xdg-user-dir) ]]; then
echo "50-xdg-screenshots.sh ok"
fi
# Check if the user has a locale preference
XDGLOCALE="$(cat $(xdg-user-dir)/.config/user-dirs.locale)"
# If the user wants Finnish, then let's respect that...
if [[ "$XDGLOCALE" == "fi" || "$XDGLOCALE" == "fi_FI" ]]; then
xdg-user-dirs-update --set SCREENSHOTS $(xdg-user-dir PICTURES)/Kuvakaappaukset
# ...otherwise English it is.
else
xdg-user-dirs-update --set SCREENSHOTS $(xdg-user-dir PICTURES)/Screenshots
fi
mkdir -p "$(xdg-user-dir SCREENSHOTS)"