<div dir="ltr">I tried to make a quick and dirty cross platform one with zenity that will work OOTB without worrying about the python environment setup. Didn't work as planned as the zenity portable app for windows seems a bit glitchy (there's no way to cancel I could find). Anyway, it should work OOTB on Gnome, and I share because it might be a handy way for someone to pass other parameters to a program.<div><br></div><div>Windows:</div><div>--------------------------------------------------




 <br></div><div>@echo off<br>@setlocal enableextensions<br>@cd /d "%~dp0"<br>@ SETLOCAL EnableDelayedExpansion<br>@ if not DEFINED IS_MINIMIZED set IS_MINIMIZED=1 && start "" /min "%~dpnx0" %* && exit<br><br>REM Get Zenity Portable and add it to your PATH<br>REM or keep it in the batchfile dir <a href="https://github.com/maravento/winzenity">https://github.com/maravento/winzenity</a><br><br>Set "profilesDir=%APPDATA%\QGIS\QGIS3\profiles"<br><br>Set dirs=<br><br>for /f "tokens=* usebackq" %%I in (`dir %profilesDir% /A:D /O:N /B`) do (<br>  Set "dirs=!dirs! %%I"<br>)<br><br>for /f %%X in ('zenity --entry --timeout 10 --ok-label="OK" --cancel-label="OK ANYWAY" --title "User Profile" --text "Select your profile." !dirs!') do (<br>  Set "selectedProfile=%%X"<br>  ECHO %ERRORLEVEL%<br>)<br><br>REM if %ERRORLEVEL% == 1 exit<br><br>if "!selectedProfile!"=="" (<br>for /f "tokens=* usebackq" %%F in (`findstr /L /C:"defaultProfile" %profilesDir%\profiles.ini`) do (<br>  Set defaultProfile=%%F<br>  for /F "tokens=2 delims==" %%A in ("!defaultProfile!") do (<br>    Set selectedProfile=%%A<br>  )<br>))<br><br>%COMSPEC% /C "CALL C:\OSGeo4W64\bin\qgis.bat --profile !selectedProfile!"<br><br>EXIT<br></div><div><br></div><div>------------------------------------------------------------









</div><div><br></div><div><br></div><div>Linux:</div><div>------------------------------------------------------------  <br></div><div>#!/usr/bin/env bash<br><br>qgisBin=$(which qgis)<br><br>profilesDir=~/.local/share/QGIS/QGIS3/profiles<br><br>dirList=$(ls -d $profilesDir/*/)<br><br>dirNames=$(for dir in "${dirList[@]}"; do echo "$(basename --suffix=/ -a $dir)"; done)<br><br>dirs=()<br><br>for dir in ${dirNames[@]}<br>do<br>  dirs=(${dirs[@]} "$dir")<br>done<br><br>selectedProfile=$(zenity --entry

 --timeout 10 

--title "User Profile" --text "Select your profile." "${dirs[@]}")<br><br># If cancelled, then exit<br><br>[[ "$?" != "0" ]] && exit 1<br><br>if [ -z "$selectedProfile" ]<br>then<br>  selectedProfile=$(awk -F "=" '/defaultProfile/ {print $2}' $profilesDir/profiles.ini)<br>fi<br><br>$qgisBin --profile $selectedProfile & disown<br><br>exit<br></div><div>------------------------------------------------------------ <br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 21 Oct 2020 at 17:18, Raymond Nijssen <<a href="mailto:r.nijssen@terglobo.nl">r.nijssen@terglobo.nl</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This script works for me. But I'm not all sure about the way I start a <br>
new process for QGIS and quit the python script. I think ending the <br>
command with an "&" only works on unix kind of systems..<br>
<br>
---<br>
<br>
import sys<br>
import os<br>
from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, <br>
QComboBox, QPushButton<br>
<br>
# adjust these to your setup:<br>
qgis_bin = '/home/raymond/git/QGIS/build-master/output/bin/qgis'<br>
profile_path = '/home/raymond/.local/share/QGIS/QGIS3/profiles'<br>
<br>
<br>
def run_qgis():<br>
     profile_name = cb.currentText()<br>
     cmd = f'{qgis_bin} --profile {profile_name} &'<br>
     #print(cmd)<br>
     w.close()<br>
     os.system(cmd)<br>
<br>
<br>
app = QApplication(sys.argv)<br>
<br>
w = QWidget()<br>
w.setWindowTitle('Choose QGIS profile')<br>
<br>
l = QVBoxLayout()<br>
<br>
cb = QComboBox()<br>
for fn in os.scandir(profile_path):<br>
     if fn.is_dir():<br>
         cb.addItem(<a href="http://fn.name" rel="noreferrer" target="_blank">fn.name</a>)<br>
l.addWidget(cb)<br>
<br>
btn = QPushButton('Run QGIS')<br>
btn.clicked.connect(run_qgis)<br>
l.addWidget(btn)<br>
<br>
w.setLayout(l)<br>
<br>
w.show()<br>
<br>
sys.exit(app.exec_())<br>
<br>
---<br>
<br>
On 21-10-2020 14:00, Raymond Nijssen wrote:<br>
> Hi Lars,<br>
> <br>
> I don't think you can. You can make a startup.py script that runs every <br>
> time you start QGIS, but it sits in your profile folder. So when QGIS <br>
> runs it, QGIS must already be aware of the profile that is being used. <br>
> Also, changing the profile needs a QGIS restart, so it seems QGIS cannot <br>
> change profile anymore while running.<br>
> <br>
> Maybe you can make a small python (pyqt?) script that displays a dialog <br>
> with profile name picker and does a "qgis --profile NAME" for you?<br>
> <br>
> Regards,<br>
> Raymond<br>
> <br>
> <br>
> On 21-10-2020 13:21, Lars I. Nielsen, LIFA A/S wrote:<br>
>> Hi list.<br>
>><br>
>> If I have multiple profiles defined, is it possible to have QGIS <br>
>> prompt me everytime for which profile to use ?<br>
>><br>
>> I know that I can add “--profile NAME” to the command line, but is <br>
>> looking for a way to avoid having multiple start icons.<br>
>><br>
>> Med venlig hilsen<br>
>><br>
>> Lars I. Nielsen, LIFA A/S<br>
>> GIS-kons., FME+Python Certified Professional<br>
>> Geoinformatik<br>
>><br>
>> *T*<br>
>><br>
>><br>
>><br>
>> 6313 6800<br>
>><br>
>><br>
>><br>
>> *@*<br>
>><br>
>><br>
>><br>
>> <a href="mailto:lin@lifa.dk" target="_blank">lin@lifa.dk</a><br>
>><br>
>> *D*<br>
>><br>
>><br>
>><br>
>> 6313 6849<br>
>><br>
>><br>
>><br>
>> *W*<br>
>><br>
>><br>
>><br>
>> <a href="http://www.lifa.dk" rel="noreferrer" target="_blank">www.lifa.dk</a> <<a href="http://www.lifa.dk" rel="noreferrer" target="_blank">http://www.lifa.dk</a>><br>
>><br>
>> *M*<br>
>><br>
>><br>
>><br>
>> *CVR*<br>
>><br>
>><br>
>><br>
>> 20937289<br>
>><br>
>><br>
>> <<a href="https://www.linkedin.com/company/lifa-a-s/" rel="noreferrer" target="_blank">https://www.linkedin.com/company/lifa-a-s/</a>><br>
>> Følg os på LinkedIn og læs de seneste nyheder fra LIFA A/S<br>
>><br>
>><br>
>> _______________________________________________<br>
>> Qgis-user mailing list<br>
>> <a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
>> List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
>> Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
>><br>
> _______________________________________________<br>
> Qgis-user mailing list<br>
> <a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
> List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
> Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>
Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a></blockquote></div>