Improvement for portable ide (linux)
- Dominant language
- Java
- Stars
- 14.6k
- Forks
- 7k
- PR merge metrics
- No merged PRs in 30d
Description
I had already reported my idea for an improvement on the arduino forum.
see: [https://forum.arduino.cc/t/improvement-for-portable-ide-linux/875534](url)
Even if the part with "icon-copying' (see below) was something that may be 'bad' for some users, the rest should be helpful for all users of a portable installation for Linux.
**Prerequisites:**
- I use the arduino ide version 1.8.15.
- I had extracted the tar onto an USB-Stick and added the "portable" folder.
That works (in principle) as expected.
**What was not so good is:**
1. If the IDE was started by double clicking the (shell script) "arduino" there will be an open terminal window, which is (most of the time) useless.
2. When I had used the IDE at one PC, then move to another one (with a different mount point for the stick), my setting get's lost. I found that this is, because the file "preferences.txt" uses absolute path's, if the IDE was started from a different mount point all entries pointing to the previous path will be deleted :frowning: That includes the board & board-settings, the recently used sketches and so on..
**Here is what I have done to improve my portable installation:**
To overcome these "problems", I had added 3 files to the root of the portable installation (beside the arduino file).
1. To avoid the terminal, I start the IDE via a ".desktop" file.
2. To have an Icon for that ".desktop" file the script ArduinoStart.sh will copy an icon onto the PC, which I had added to the root of the portable installation. So when You use this installation the first time on a PC, there might by no icon for this file, but as soon as you have started it once, the "starter" will be decorated by the arduino icon.
3. The adjustment of the (mount-)path inside "preferences.txt" was although done by the script ArduinoStart.sh.
This modification works for me on 3 different PCs with 3 different Linux-Installations (Ubuntu 14.04 LTS - 20.04 LTS)
I hope that was interesting for other users.
Here are the contents of the files "ArduinoStart.desktop" & "ArduinoStart.sh", the 3. file "arduino.png" should be any icon (of size 48) that You want to be shown.
ArduinoStart.desktop:
```
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon=arduino
Exec=bash -c "cd \"$(dirname "\"%k\"")\"; bash "./ArduinoStart.sh
Name=ArduinoStart'
```
ArduinoStart.sh:
```
#!/usr/bin/env bash
APPDIR="$(dirname -- "$(readlink -f -- "${0}")" )"
cd ${APPDIR}
###############################################################
# Install Icon if not already installed
###############################################################
if [ ! -f ~/.local/share/icons/hicolor/48x48/apps/arduino.png ]; then
xdg-icon-resource install --novendor --context apps --size 48 arduino.png
fi
###############################################################
# Adjust path inside "preferences.txt" to current mount path
###############################################################
# Escape '/' and '.' inside ${1} into '\/' and '\.'
Escape()
{
RES=${1//\//\\\/};
RES=${RES//\./\\\.};
echo ${RES};
}
LAST_MOUNT_PATH=$(sed -e '/^last.ide.1.8.15.hardwarepath=/!d;s/last\.ide\.1\.8\.15\.hardwarepath\=//g;s/\/hardware//g' portable/preferences.txt)
LAST_MOUNT_PATH=$(Escape $LAST_MOUNT_PATH)
CURRENT_MOUNT_PATH=$(Escape $APPDIR)
sed -i -e "s/${LAST_MOUNT_PATH}/${CURRENT_MOUNT_PATH}/g" portable/preferences.txt
###############################################################
# Start Arduiino
###############################################################
./arduino &
```
Contributor guide
Research direction
Start by reviewing the Linux launcher named `arduino` and the portable `preferences.txt` path handling described in the issue, then compare them with the proposed `ArduinoStart.desktop` and `ArduinoStart.sh` files. Clarify the supported portable-installation behavior and how terminal suppression and mount-path changes should be handled before defining completion criteria.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash, linux
- Domain
- desktop, operating-systems
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100