Run a script at session Restore (unlock)

Forum rules
Before you post please read how to get help
Post Reply
RicoFr91
Level 1
Level 1
Posts: 1
Joined: Fri Feb 08, 2019 7:11 pm

Run a script at session Restore (unlock)

Post by RicoFr91 » Fri Feb 08, 2019 7:54 pm

Hi there.

Running Mint 19.1 mate.
I don't find the way to run a script each time a User RE-ENTERs (unlocks) its session.

That's pretty easy to run a script when a user logs to its desktop session from a closed session
: by just placing the script in /etc/profile.d/

But when the User RE-ENTERs (unlocks) its session, /etc/profile.d/ scripts are not launched...

By RE-ENTER, I mean the following scenario :

1) USER-1 logs to its desktop session using its credentials (User-1 session was closed before)
-> profile.d scripts run
2) USER-1 locks its session (but does NOT close it)
3) By choosing "change user" ANOTHER USER can log to a new session
4) USER-2 logs to its desktop session using its credentials (User-2 session was closed before)
-> profile.d scripts run
5) USER-2 locks its session (or close it.)
6) USER-1 then Re-ENTERs (Unlocks) its desktop session using its credential (User-1 session have not been closed before but only LOCKED)
-> At this stage, profile.d scripts are NOT launched...

Does anyone have a clue on how to achieve that ?
(preferably the same script for both for the first loging and for restore)

Thanks in advance.

donalduck
Level 3
Level 3
Posts: 124
Joined: Mon Oct 07, 2013 1:43 pm
Location: there

Re: Run a script at session Restore (unlock)

Post by donalduck » Sat Feb 09, 2019 3:47 pm

Interesting challenge :)

possible clue: use polkit api to monitor these events ...

https://www.freedesktop.org/software/p ... it.8.html

at first look no low-level programming is required.

edit: hum...sorry not sure it is a good lead, better be looking for which processes are triggered with the actions you described (in system logs) :?

Post Reply

Return to “Scripts & Bash”