Skip to content

Instantly share code, notes, and snippets.

@jimmac
Created September 15, 2021 16:07
Show Gist options
  • Save jimmac/1da07cb2ddf309d918a37b6b6a5bf3ac to your computer and use it in GitHub Desktop.
Save jimmac/1da07cb2ddf309d918a37b6b6a5bf3ac to your computer and use it in GitHub Desktop.
#access my extra partitions in toolbox
if [ -f /run/.toolboxenv ]; then
sudo mount --rbind /run/host/var/homedata /var/homedata
sudo mount --rbind /run/host/var/work /var/work
fi
#ad hoc aliases
alias www='python -m http.server'
#flatpak apps
if command -v flatpak > /dev/null
then
# Get a list of flatpak applications in the reverse domain name format
readarray -t ids < <(flatpak list --app --columns=application)
for id in "${ids[@]}"
do
# Take everything past the last dot (the name)
name="${id##*.}"
# Make it lowercase to approximate binary name
binary="${name,,}"
# If there is not already a command at that name
if ! command -v "${binary}" > /dev/null
then
# Create an alias that runs the flatpak
alias "$binary=flatpak run \"$id\""
fi
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment