From 81e8ef2754ad5275a98d9c314e485a57a04d4fa7 Mon Sep 17 00:00:00 2001 From: Aminda Suomalainen Date: Sun, 28 Jul 2024 10:46:48 +0300 Subject: [PATCH] profile.d: add xdg screenshots dir setting --- etc/profile.d/50-xdg-screenshots.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 etc/profile.d/50-xdg-screenshots.sh diff --git a/etc/profile.d/50-xdg-screenshots.sh b/etc/profile.d/50-xdg-screenshots.sh new file mode 100644 index 00000000..4d0ff60e --- /dev/null +++ b/etc/profile.d/50-xdg-screenshots.sh @@ -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)"