Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
This question already has an answer here:
I want to run a script as root after a login as a regular user in GDM.
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
I added command into ~/.xprofile, because it had to be run after the login and it uses X11.
Now, it works.