Start with custom preferences

Hi,
is it possible to start the IDE with custom preferences?

I have a preferences text file for each project (board settings, library folder, ...).

I was able to start the IDE with the arg

--preferences-file preferences.txt

It doesn't work anymore. Is there another way to load or save the current IDE preferences?

Arduino IDE 2.x uses Arduino CLI for all non-GUI related tasks. This means that some aspects of Arduino IDE 2.x can be configured via Arduino CLI's configuration, and of course that is all manageable via the command line.

The bundled copy of Arduino CLI is located in the resources/app/node_modules/arduino-ide-extension/build subfolder of the Arduino IDE 2.x installation folder.

The configuration file for Arduino CLI is located at ~/.arduinoIDE/arduino-cli.yaml.

The configuration of Arduino CLI is managed via the arduino-cli config command, which is documented here:
https://arduino.github.io/arduino-cli/latest/commands/arduino-cli_config/

The configuration is documented here:
https://arduino.github.io/arduino-cli/latest/configuration/

The libraries folder is a subfolder of the sketchbook, and the sketchbook location is set via the directories.user configuration key. So if you want to change the libraries folder then you'll need to change the directories.user configuration. If the sketchbook was at /my/custom/sketchbook, then the command would look something like this:

resources/app/node_modules/arduino-ide-extension/build/arduino-cli --config-file ~/.arduinoIDE/arduino-cli.yaml config set directories.user /my/custom/sketchbook

Then you can just start Arduino IDE 2.x normally.

Thank you for the answer.

I found the files for the settings on Windows:

%APPDATA%/../../.arduinoIDE

arduino-cli.yaml and settings.json

If I understand it, you are changing the main settings and start the IDE, right?

On the old IDE I was able to start it with custom settings, without changing all settings for the other projects.

To be more precise, I had some custom settings (mypreferences.txt) in my project folder and merged them with the current settings (preferences.txt) in a temporary folder (temppreferences.txt) and used that to launch the IDE.

In this way, I was able to set different preferences for each project but leave the default settings when I started the IDE directly (without opening a project).

I assume, this is not possible anymore without modify some files inside the Arduino folders, right?

1 Like

Hi.
Arduino IDE 2.0 looks great. Thank You for this, however missing important fonctionality from standard 1.8.xx versions - possibilty to create separate environments for project groups.

I am using separate preferences filles to have separate environments for different groups of my projects.
I Created separate shortcuts for arduino.exe with command line parameter -preferences-file.
For example: "C:\Program Files (x86)\Arduino\arduino.exe" --preferences-file preferences_zaawansowana_ESP8266.txt
In addition I specified directories separate for each group in shortcuts, so I have quick / easy start of Arduino IDE for separate environments. Different sketchbook locations, different boards sets, different libraries sets, etc.
It was possible up to version 1.8.15, but I see that it is not possible in beta 2.0 is it?

As mentioned by Adrianotiger, there is directory containing setting file.
I suggest to indroduce starting parameter for version 2.0 specifying directoctory of setting files i.e
-settings-dir. Starting command set in shortcut could be for example: Arduino.exe -settings-dir "project group one directory"
Then it will be possible to create shortcuts for each project groups.

Any chance to get such fonctionality in the next beta releases and finally in stable release?

There is a planned "profiles" feature that I believe will provide what you want in a manner that is superior to the approach you found for doing that with the classic Arduino IDE. We are giving the community the opportunity to provide input on the proposal before the development work starts:

So this is definitely something that is being worked on actively, and will be available in one of the future releases of Arduino IDE 2.x, but I can't say exactly when it will be finished.

I think the reason why no effort has been made to provide a command line interface for Arduino IDE 2.x is because we now have a dedicated tool for working with Arduino projects via the command line in Arduino CLI.

Arduino CLI is used by Arduino IDE 2.x for all the non-GUI processes. As mentioned by Adrianotiger, there is a configuration file named arduino-cli.yaml in the Arduino IDE 2.x's ~/.arduinoIDE configuration folder which is the configuration file for Arduino CLI when used by Arduino IDE 2.x.

Arduino CLI does provide an interface for customizing its configuration:
https://arduino.github.io/arduino-cli/latest/commands/arduino-cli_config/

In this case where your existing approach is to have a dedicated configuration file for each "environment", you might prefer to just use a standard shell command to copy the desired configuration file to the active configuration path, then start the IDE.

So you would create a simple, wrapper script (Windows batch file, PowerShell script, Bash script, Python, or whatever you like) only a couple lines long, that places the configuration file specified by the argument passed to the script and then starts the IDE.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.