darkman-setup.bash: symlink scripts instead of directories for customizing options

This commit is contained in:
Aminda Suomalainen 2024-07-17 10:23:51 +03:00
parent f5e14af247
commit 5dc91eb4ba
Signed by: Mikaela
SSH Key Fingerprint: SHA256:CXLULpqNBdUKB6E6fLA1b/4SzG0HvKD19PbIePU175Q

View File

@ -1,25 +1,34 @@
#!/usr/bin/env bash
set -x
if ! hash darkman 2> /dev/null; then
echo "You don't seem to have darkman installed." 1>&2
exit 1
fi
mkdir -vp ~/.local/share/
if [ ! -d ~/.local/share/dark-mode.d ]; then
rm ~/.local/share/{dark,light}-mode.d
mkdir -vp ~/.local/share/{dark,light}-mode.d
echo "Ensure ~/.local/share/ has directories {dark,light}-mode.d/"
fi
if [ -d /usr/share/doc/darkman/examples ]; then
ln -nsfv /usr/share/doc/darkman/examples/{dark,light}-mode.d ~/.local/share/
export EXAMPLESDIR="/usr/share/doc/darkman/examples"
elif [ -d /usr/local/share/doc/darkman/examples ]; then
ln -nsfv /usr/local/share/doc/darkman/examples/{dark,light}-mode.d ~/.local/share/
export EXAMPLESDIR="/usr/local/share/doc/darkman/examples"
elif [ -d ~/.local/share/doc/darkman/examples ]; then
ln -nsfv ~/.local/share/doc/darkman/examples/{dark,light}-mode.d ~/.local/share/
elif [ -d ~/src/gitlab.com/WhyNotHugo/darkman ]; then
ln -nsfv ~/src/gitlab.com/WhyNotHugo/darkman/examples/{dark,light}-mode.d ~/.local/share/
export EXAMPLESDIR="/.local/share/doc/darkman/examples"
elif [ -d ~/src/gitlab.com/WhyNotHugo/darkman/examples ]; then
export EXAMPLESDIR="~/src/gitlab.com/WhyNotHugo/darkman/examples"
else
echo "Darkman examples not found in expected locations."
exit 1
fi
ln -nsfv $EXAMPLESDIR/dark-mode.d/* ~/.local/share/dark-mode.d/
ln -nsfv $EXAMPLESDIR/light-mode.d/* ~/.local/share/light-mode.d/
unset $EXAMPLESDIR
systemctl --user disable --now darkman.service
systemctl --user mask darkman.service
echo "Creating an autostart seems to work better than the systemd service."
set +x