What is really annoying in Ubuntu is that when some apps which don't need multiple instances such as 'appearance settings', a web browser, terminal window are loaded again when they are aready launched. For a browser or terminal I can still understand, although such apps have a 'new window' option. But for settings apps, multiple instances of e.g. 'Appearence' or 'Keyboard settings' are completely useless.
How do I prevent that the launcher launches an app (e.g. Firefox) again when it is already launched ?
I tried a shellscript called launch.sh:
#!/bin/sh
if ! pgrep $1 >/dev/null; then
"$2" &
fi
In the xfce launcher for Firefox I set
launch.sh firefox /usr/bin/firefox
which does work (firefox is not launched when it is areay open), but for xfce4-appearance-settings it does not work, because pgrep xfce4-appearance-settings returns nothing while xfce4-appearance-settings is opened.
In macOS it works properly: such apps are launched only once and when clicking again on the app icon, it moves to the foreground rather than starting a new obsolete instance.
How can this be realized in Ubuntu ?