ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How to do so? For starters, I'm not sure there is such an event. Maybe it has something to do with the OS moving through certain run-levels? A nudge in the right direction would be appreciated.
I'm not sure there's such an user-switch event since linux is a multi-users system (many users can be logged in the same system at a while), but for sure you've got a log-off and a log-on event, and you can add actions by editing .bashrc and .bash_logout file in your home directory...
I'm not sure there's such an user-switch event since linux is a multi-users system (many users can be logged in the same system at a while), but for sure you've got a log-off and a log-on event, and you can add actions by editing .bashrc and .bash_logout file in your home directory...
Thanks for the suggestion. Working off of login/logout was my next option. What about Gnome, does it have some kind of hook I can use when switch user occurs? I'll start looking into it, but maybe someone out there knows already...
...
What about Gnome, does it have some kind of hook I can use when switch user occurs? I'll start looking into it, but maybe someone out there knows already...
I don't think you've clearly explained what you really need.
For example, under your desktop environment of choice (say, Gnome) in a terminal window you type
I don't think you've clearly explained what you really need.
For example, under your desktop environment of choice (say, Gnome) in a terminal window you type
Code:
su UserOtherThanYou
and then the password.
Do you consider this to be switching users ?
When I use Gnome to switch users, which will bring up a new desktop, I want to have a script automatically run at that point. To be even more explicit, in ubuntu there is a default applet in the upper-right hand corner of the screen which which has a drop down menu that says "Switch User..." When I (or anyone else) clicks on that option and uses it to switch users, I want to automatically run a script. I'm sure there are a sequence of events that occur when the user chooses this option, and there is probably some way to hook my script into this process...So the question is how to do so?
Attached is a screenshot...when I click on this menu option, I want my own script to be automatically run at some point (I don't think at the moment it matters exactly when).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.