Skip to content

Instantly share code, notes, and snippets.

@fischejo
Last active August 17, 2022 23:44
Show Gist options
  • Select an option

  • Save fischejo/796ad514d49e783f6b31db1abf7af714 to your computer and use it in GitHub Desktop.

Select an option

Save fischejo/796ad514d49e783f6b31db1abf7af714 to your computer and use it in GitHub Desktop.
adds selection of firefox profiles to rofi menu
#!/bin/bash
MOZILLA_CONFIG=~/.mozilla
FIREFOX='/usr/bin/firefox'
NAMES=($(awk -F "=" '/Name/ {print $2}' $MOZILLA_CONFIG/firefox/profiles.ini | tr -d ' '))
if [ -z $@ ]
then
echo "Profile Manager"
for name in "${NAMES[@]}"
do
echo $name
done
else
PATHS=($(awk -F "=" '/Path/ {print $2}' $MOZILLA_CONFIG/firefox/profiles.ini | tr -d ' '))
PROFILE=$@
for i in "${!NAMES[@]}"; do
if [[ "${NAMES[$i]}" = "${PROFILE}" ]]; then
$FIREFOX --new-instance --profile "$MOZILLA_CONFIG/firefox/${PATHS[$i]}" >/dev/null &
exit
fi
done
$FIREFOX --new-instance --ProfileManager >/dev/null &
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment