Why, when an app is open, you can open the window from that a few more times
for software like Spotify
Welcome to the forum!
Because it’s a computer, not a phone.
Not all applications are aware when you already have a session open. Furthermore, Spotify is a third-party application.
Thank you
but there is no way to prevent this ??
a structural change
You find lots of suggestions in the web:
https://stackoverflow.com/questions/220525/ensure-a-single-instance-of-an-application-in-linux
https://unix.stackexchange.com/questions/48505/how-to-make-sure-only-one-instance-of-a-bash-script-runs
https://superuser.com/questions/170937/limit-a-gui-program-in-linux-to-only-one-instance
It’s entirely up to the app developer to implement a “single instance” feature.
Some programs (like vlc
media player) have options to set the desired behaviour, most do not.
Most browsers open a new window but can be set to open a new tab instead if a new instance is started.
For Spotify I use a script that checks if Spotify is already started. You need to use the script in your shortcuts instead of pointing directly to spotify (and maybe adapt the script to have proper paths or startup options).
Here is the one I specifically use:
#!/bin/bash
# https://github.com/dahlo/spotify_instance_checker
# check if spotify is already running
if pgrep -x "spotify" > /dev/null
then
# if it is, switch focus to it (changed path to /opt/spotify/spotify)
wmctrl -ia $(wmctrl -lp | awk -vpid=$(ps ax | grep "/opt/spotify/spotify$" | grep -v grep | awk '{print $1}') '$3==pid {print $1; exit}')
else
# if not, start it (changed to start spotify adblock)
LD_PRELOAD=/usr/lib/spotify-adblock.so spotify &
fi
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.