diff --git a/ff-profsel/cb-profsel-install.sh b/ff-profsel/cb-profsel-install.sh new file mode 100755 index 0000000..e9a5b7c --- /dev/null +++ b/ff-profsel/cb-profsel-install.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Creating directories if missing +mkdir -p ~/.local/bin ~/.local/share/applications + +# Copying the good stuff +cp -pv cb-profsel.sh ~/.local/bin/ +cp -pv cb-profsel.desktop ~/.local/share/applications/ + +echo -e "\nCachy Browser Profile Selector is installed. You can use it from your applications list or menu, and use it as the main navigator for a one clic profil selection.\nTo uninstall, simply remove the installed files." + diff --git a/ff-profsel/cb-profsel.desktop b/ff-profsel/cb-profsel.desktop new file mode 100755 index 0000000..1d3835c --- /dev/null +++ b/ff-profsel/cb-profsel.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Version=1.0 +Name=Cachy Browser Profile Selector +Exec=$HOME/.local/bin/cb-profsel.sh %u +Icon=cachy-browser +Terminal=false +Type=Application +MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;application/x-xpinstall;application/pdf;application/json; +Categories=Network;WebBrowser; +StartupWMClass=cachybrowser diff --git a/ff-profsel/cb-profsel.sh b/ff-profsel/cb-profsel.sh new file mode 100755 index 0000000..0c98a53 --- /dev/null +++ b/ff-profsel/cb-profsel.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +# Chemin du fichier profiles.ini +PROFILES_INI="$HOME/.cachy/profiles.ini" + +# Vérifier si le fichier profiles.ini existe +if [ ! -f "$PROFILES_INI" ]; then + yad --error --text="Le fichier profiles.ini n'existe pas : $PROFILES_INI" + exit 1 +fi + +# Extraire les noms des profils depuis le fichier profiles.ini +PROFILS=() +while IFS= read -r line; do + if [[ "$line" =~ ^Name= ]]; then + PROFILS+=("${line#Name=}") + fi +done <<< "$(grep "^Name=" "$PROFILES_INI")" + +# Si aucun profil n'a été trouvé +if [ ${#PROFILS[@]} -eq 0 ]; then + yad --error --text="Aucun profil trouvé dans le fichier profiles.ini." + exit 1 +fi + +# DEBUG +#for profil in "${PROFILS[@]}"; do +# echo "DEBUG Profil trouvé : $profil" +#done + +# Générer les boutons pour Yad +BUTTONS="" +for i in "${!PROFILS[@]}"; do + BUTTONS+="--button=${PROFILS[i]}:$((i+1)) " +done + +# Exécuter Yad avec les boutons générés +yad --form --title="Choisissez un profil" --text="Sélectionnez un profil pour démarrer Cachy Browser :" --buttons-layout=center $BUTTONS + +CHOIX=$? + +# DEBUG +#echo "DEBUG liste boutons = $BUTTONS" +#echo "DEBUG CHOIX brut = $CHOIX" +#echo "DEBUG Index utilisé pour PROFILS = $((CHOIX-1))" +#echo "DEBUG Profil sélectionné = ${PROFILS[$((CHOIX-1))]}" + +# Quitter si fermeture fenêtre +if [ $CHOIX = 252 ]; then exit; fi + +# Vérifier si un bouton a été cliqué +if [ $CHOIX != 0 ]; then + # Récupérer le profil correspondant au bouton cliqué + SELECTION="${PROFILS[$((CHOIX-1))]}" + # Ouvrir le navigateur avec le profil sélectionné + cachy-browser -P "$SELECTION" $1 & +else + yad --error --text="Aucun profil sélectionné." + exit 1 +fi + +# DEBUG +#echo "DEBUG Profil sélectionné : $SELECTION" diff --git a/ff-profsel/ff-profsel-install.sh b/ff-profsel/ff-profsel-install.sh new file mode 100755 index 0000000..4ea224a --- /dev/null +++ b/ff-profsel/ff-profsel-install.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Creating directories if missing +mkdir -p ~/.local/bin ~/.local/share/applications + +# Copying the good stuff +cp -pv ff-profsel.sh ~/.local/bin/ +cp -pv ff-profsel.desktop ~/.local/share/applications/ + +echo -e "\nFirefox Profile Selector is installed. You can use it from your applications list or menu, and use it as the main navigator for a one clic profil selection.\nTo uninstall, simply remove the installed files." + diff --git a/ff-profsel/ff-profsel.desktop b/ff-profsel/ff-profsel.desktop new file mode 100755 index 0000000..1785183 --- /dev/null +++ b/ff-profsel/ff-profsel.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Version=1.0 +Name=Firefox Profile Selector +Exec=$HOME/.local/bin/ff-profsel.sh %u +Icon=firefox +Terminal=false +Type=Application +Categories=Network;WebBrowser; +StartupWMClass=firefox +MimeType=text/html;text/xml;application/xhtml+xml;application/xml; +Actions= diff --git a/ff-profsel/ff-profsel.sh b/ff-profsel/ff-profsel.sh new file mode 100755 index 0000000..6dda647 --- /dev/null +++ b/ff-profsel/ff-profsel.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +# Chemin du fichier profiles.ini +PROFILES_INI="$HOME/.mozilla/firefox/profiles.ini" + +# Vérifier si le fichier profiles.ini existe +if [ ! -f "$PROFILES_INI" ]; then + yad --error --text="Le fichier profiles.ini n'existe pas : $PROFILES_INI" + exit 1 +fi + +# Extraire les noms des profils depuis le fichier profiles.ini +PROFILS=() +while IFS= read -r line; do + if [[ "$line" =~ ^Name= ]]; then + PROFILS+=("${line#Name=}") + fi +done <<< "$(grep "^Name=" "$PROFILES_INI")" + +# Si aucun profil n'a été trouvé +if [ ${#PROFILS[@]} -eq 0 ]; then + yad --error --text="Aucun profil trouvé dans le fichier profiles.ini." + exit 1 +fi + +# DEBUG +#for profil in "${PROFILS[@]}"; do +# echo "DEBUG Profil trouvé : $profil" +#done + +# Générer les boutons pour Yad +BUTTONS="" +for i in "${!PROFILS[@]}"; do + BUTTONS+="--button=${PROFILS[i]}:$((i+1)) " +done + +# Exécuter Yad avec les boutons générés +yad --form --title="Choisissez un profil" --text="Sélectionnez un profil pour démarrer Firefox :" --buttons-layout=center $BUTTONS + +CHOIX=$? + +# DEBUG +#echo "DEBUG liste boutons = $BUTTONS" +#echo "DEBUG CHOIX brut = $CHOIX" +#echo "DEBUG Index utilisé pour PROFILS = $((CHOIX-1))" +#echo "DEBUG Profil sélectionné = ${PROFILS[$((CHOIX-1))]}" + +# Quitter si fermeture fenêtre +if [ $CHOIX = 252 ]; then exit; fi + +# Vérifier si un bouton a été cliqué +if [ $CHOIX != 0 ]; then + # Récupérer le profil correspondant au bouton cliqué + SELECTION="${PROFILS[$((CHOIX-1))]}" + # Ouvrir le navigateur avec le profil sélectionné + firefox -P "$SELECTION" $1 & +else + yad --error --text="Aucun profil sélectionné." + exit 1 +fi + +# DEBUG +#echo "DEBUG Profil sélectionné : $SELECTION" diff --git a/ff-profsel/wf-profsel-install.sh b/ff-profsel/wf-profsel-install.sh new file mode 100755 index 0000000..52cf83e --- /dev/null +++ b/ff-profsel/wf-profsel-install.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# Creating directories if missing +mkdir -p ~/.local/bin ~/.local/share/applications + +# Copying the good stuff +cp -pv wf-profsel.sh ~/.local/bin/ +cp -pv wf-profsel.desktop ~/.local/share/applications/ + +echo -e "\nWaterfox Profile Selector is installed. You can use it from your applications list or menu, and use it as the main navigator for a one clic profil selection.\n" + diff --git a/ff-profsel/wf-profsel.desktop b/ff-profsel/wf-profsel.desktop new file mode 100755 index 0000000..7ed1448 --- /dev/null +++ b/ff-profsel/wf-profsel.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Version=1.0 +Name=Waterfox Profile Selector +Exec=$HOME/.local/bin/wf-profsel.sh %u +Icon=waterfox +Terminal=false +Type=Application +Categories=Network;WebBrowser; +StartupWMClass=waterfox +MimeType=text/html;text/xml;application/xhtml+xml;application/vnd.mozilla.xul+xml;text/mml;x-scheme-handler/http;x-scheme-handler/https;application/x-xpinstall;application/pdf;application/json; diff --git a/ff-profsel/wf-profsel.sh b/ff-profsel/wf-profsel.sh new file mode 100755 index 0000000..a75ca41 --- /dev/null +++ b/ff-profsel/wf-profsel.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +# Chemin du fichier profiles.ini +PROFILES_INI="$HOME/.waterfox/profiles.ini" + +# Vérifier si le fichier profiles.ini existe +if [ ! -f "$PROFILES_INI" ]; then + yad --error --text="Le fichier profiles.ini n'existe pas : $PROFILES_INI" + exit 1 +fi + +# Extraire les noms des profils depuis le fichier profiles.ini +PROFILS=() +while IFS= read -r line; do + if [[ "$line" =~ ^Name= ]]; then + PROFILS+=("${line#Name=}") + fi +done <<< "$(grep "^Name=" "$PROFILES_INI")" + +# Si aucun profil n'a été trouvé +if [ ${#PROFILS[@]} -eq 0 ]; then + yad --error --text="Aucun profil trouvé dans le fichier profiles.ini." + exit 1 +fi + +# DEBUG +#for profil in "${PROFILS[@]}"; do +# echo "DEBUG Profil trouvé : $profil" +#done + +# Générer les boutons pour Yad +BUTTONS="" +for i in "${!PROFILS[@]}"; do + BUTTONS+="--button=${PROFILS[i]}:$((i+1)) " +done + +# Exécuter Yad avec les boutons générés +yad --form --title="Choisissez un profil" --text="Sélectionnez un profil pour démarrer Waterfox :" --buttons-layout=center $BUTTONS + +CHOIX=$? + +# DEBUG +#echo "DEBUG liste boutons = $BUTTONS" +#echo "DEBUG CHOIX brut = $CHOIX" +#echo "DEBUG Index utilisé pour PROFILS = $((CHOIX-1))" +#echo "DEBUG Profil sélectionné = ${PROFILS[$((CHOIX-1))]}" + +# Quitter si fermeture fenêtre +if [ $CHOIX = 252 ]; then exit; fi + +# Vérifier si un bouton a été cliqué +if [ $CHOIX != 0 ]; then + # Récupérer le profil correspondant au bouton cliqué + SELECTION="${PROFILS[$((CHOIX-1))]}" + # Ouvrir le navigateur avec le profil sélectionné + waterfox -P "$SELECTION" $1 & +else + yad --error --text="Aucun profil sélectionné." + exit 1 +fi + +# DEBUG +#echo "DEBUG Profil sélectionné : $SELECTION"