Run a script at session Restore (unlock)

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
RicoFr91

Run a script at session Restore (unlock)

Post by RicoFr91 »

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.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
donalduck
Level 4
Level 4
Posts: 236
Joined: Mon Oct 07, 2013 1:43 pm
Location: there

Re: Run a script at session Restore (unlock)

Post by donalduck »

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) :?
Locked

Return to “Scripts & Bash”