I am looking for a solution on how to start or restart a service or execute a shell script whenever user switches from one user to another in a gnome environment. A case where a linux system has multiple users configured. I can start the service / execute the shell script when the user login for the first time. But unable to find a solution when user swithces to other user. For eg. if there are 2 users - User1 and User2. When User1 logins first time my service / shell scripts starts and switches to User2 login for the first time, then also my service / shell scripts restarts. But when User2 switches back to User1, my services does not restart.
For first time login, I added in xdg/autostart. But unable to find config when there is an user switch over.