How to keep Linux Appimages from spewing garbage files into your documents directory

A Dumpster Fire.
Garbage Files.

I made a shell script to fix this. Now, I can put the appimages into ~/opt and their files stay there.

#!/bin/bash
set -euo pipefail

# From: https://docs.appimage.org/user-guide/portable-mode.html
# If there is a directory with the same name as the AppImage plus
# .home, then $HOME will automatically be set to it before executing
# the payload application
#
# If there is a directory with the same name as the AppImage plus
# .config, then $XDG_CONFIG_HOME will automatically be set to it before
# executing the payload application

if [[ "-h" = "$1"  ||  "--help" = "$1" ]]
then
  echo "Usage: make-appimage-portable.sh APPIMAGE

  Keep an appimage from spewing garbage files into your home dir."
  exit 0
fi

# So this should do it:
# Require an appimage as first arg.
:\
&& APP="$1" \
&& mkdir "$APP".home \
&& mkdir "$APP".config \
&& chmod +x "$APP" \
;

## This is another way, but I can no longer find the documentation.
## Require an appimage as first arg.
# : \
# && "$1" --appimage-portable-config \
# && "$1" --appimage-portable-home   \
# ;

So, yeah, I did this and it changed my life.