Skip to content

Pass along to scripts which mode darkman is switching to

It would be nice for darkman to expose, to the executed scripts, the mode it is switching to. Either as an argument or as environment variable.

This feature would make it easier to use the same script for dark and light mode, thus avoiding code deduplication.

My current workaround is to include the following shell snippet in each script. It uses the parent directory name of the script to deduce the mode darkman is switching to.

mode=$(basename --suffix=-mode.d $(dirname $(realpath --no-symlinks $0)))
case $mode in
  light|dark) ;;
  *) echo "error: '$mode' isn't 'dark' nor 'light'" 2>&1
     exit 1 ;;
esac
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information