Custom action on events

Asked by Luca Trombin

Since as you said many times there are some Linux / Desktop env. variations which does not work correctly, I would like to have the possibility to enter a script path to be triggered in case of an event happens (i.e. timekpr triggers my script which lock or do whatever I want to the user).

What do you think about this?

By the way: I have a problem with lock screen not working in Linux Mint (Cinnamon), do you have any suggestion how to investigate and eventually resolve this issue?

By the way, I'm also a Senior Solution Architect with kids ... hence if you want we can collaborate on your project to enhance it, I really like this version you created.

Thanks,

Luca

Question information

Language:
English Edit question
Status:
Answered
For:
Timekpr-nExT Edit question
Assignee:
Eduards Bezverhijs Edit question
Last query:
Last reply:
Revision history for this message
Eduards Bezverhijs (mjasnik) said (last edit ):
#1

Well, the only time timekpr could trigger something currently, is when time is about to end.

That could be doable to configure with not much coding (the user interface part would consume the most of the time), but could be very not friendly to user.
On the other hand, regular users can use pre-defined actions :)

As for Cinamon and lockscreen, well, there are some desktops that do not fully work with providing a status of screen locker or they have their own different implementation.
I could try to check what’s up at some free time, but please provide a link to ISO download for exactly the version you are using.

Revision history for this message
Luca Trombin (lucat78) said :
#2

I have Linux Mint 21.2 "Victoria": https://www.linuxmint.com/edition.php?id=305

thank you

Revision history for this message
Eduards Bezverhijs (mjasnik) said (last edit ):
#3

I am now checking screensaver related issues with timekpr, I will get back on this if I find anything useful about cinnamon. Since You did not write what kind of issues you have, please do so.

Additionally, I am __ just thinking out loud __ about implementing custom actions, there are couple of points, when those can be invoked / executed.

There could be 2 modes:
* normal (user level) - script will be executed with particular user permissions
* the dangerous one (manager level) - script will be executed with root permissions

Final configuration might be like this:
* user level: at final notification time (60s before allowance ends)
* user level: at termination time (15s before allowance ends)
* user level: PlayTime allowance ended (right when allowance ends)
* manager level: at final notification time (60s before allowance ends)
* manager level: at termination time (15s before allowance ends)
* manager level: PlayTime allowance ended (right when allowance ends)

All these could be configurable in admin app and none of these options will be shown to user.

I can see benefits from any of those options.
I am worried about root permissions, if administrator makes a stupid script which deletes everything, that's on him of course, however very dangerous. I am not sure whether to allow it or not.

Your thoughts?

Revision history for this message
Luca Trombin (lucat78) said :
#4

Hi Edwards,

the issue I have with Cinnamon screeensaver / locking system is simple: the lock screen is not triggered once the maximum allowed time is reached.

Regarding the custom actions I think you can let for now run with user's permissions.
Anyway in case the manager wants to execute a task for any user with root permissions he can still create a globally executable script, hence there is no issue. Otherwise you can leave an option to the manager with a big warning message.

The configuration should be visible only to the admin of course with the possibility to configure which custom action to be executed during the different timings you wrote above. Frankly speaking I thought only to execute something when time is elapsed.

Don't give root permissions for now, let it run in the user's permissions, if admin wants he can still perform workarounds.
We can anyway introduce it later (or you can add an option to tick with a big warning disclaimer)

What do you think?

Revision history for this message
Eduards Bezverhijs (mjasnik) said (last edit ):
#5

>> the issue I have with Cinnamon screeensaver / locking system is simple: the lock screen is not triggered once the maximum allowed time is reached.

So, I checked bunch of desktop environments on Manjaro.
Lock screen detection (idle time detection) seems to work on all tested (below) environments, but screen locking - not really.

KDE, Gnome, XFCE, MATE - just works, idle time detection + screen locking works just fine.

Cinnamon - does not, idle time detection works, but screen locking do not.
Why? No idea, except there is a bug somewhere in Cinnamon & Budgie.
One interesting thing - in Cinnamon, if I press lock screen from the menu, the screen locking starts to work in timekpr too, but it stops again after some time.

There is a very simple way to check this, install "D-Feet" application (a dbus browsing app) and follow instructions as in this picture: https://ibb.co/V90Dzwc .
If you're pressing the "Execute" and nothing happens, timepkr will not work, because it uses the same interfaces.

What to do? Well, you can try to file a bug against Cinnamon.

----------------------

About custom actions, well, I think I can leave out the root option. Let's see when I will have time and the right mood to start this :)

Revision history for this message
Eduards Bezverhijs (mjasnik) said (last edit ):
#6

Additional tests for screen idle detection as well as screen lock enforcement on Ubuntu flavors.
If you are not familiar with screen idle detection, it is the functionality which does not count the time when computer is locked, so user effectively should not log out all the time if he wants to save some time while eating dinner with family (for example).

Fully working
---------------------
* KDE: idle detection and lock screen works
* Gnome: idle detection and lock screen works
* Mate: idle detection and lock screen works
* Unity: idle detection and lock screen works
* Budgie: idle detection and lock screen works
* Studio: idle detection and lock screen works
* Edubuntu: idle detection and lock screen works
* Not really an Ubuntu, but Zorin: idle detection and lock screen works

Partially working
---------------------
* Kylin: idle detection works and lock screen does NOT work (maybe it works on normal installation, but I can't navigate in Chinese language)
* Cinnamon: idle detection works and lock screen does NOT work (works after manual lock for unknown amount of time, there seems to be a WORKAROUND, see my post below)

Not working
---------------------
* Lubuntu: idle detection does NOT work and lock screen does NOT work (no compatible DBUS screensaver APIs)

Revision history for this message
Luca Trombin (lucat78) said :
#7

Hi Eduards,

thank you for the insights and all the tests made.

I'll try to file a bug to Cinnamon, in the meantime I'll try to use also one of the other environments you tested.

Is there somewhere a list of the tested envs. that you are keeping so also others can be aware?

Revision history for this message
Eduards Bezverhijs (mjasnik) said :
#8

>> Is there somewhere a list of the tested envs. that you are keeping so also others can be aware?

No I do not keep a list. There are a couple of reasons for that.
One is, I do not use timekpr in my household for years and personally I do not need this.
Second is that the list will become out-of-date quite fast as distros will release a new version in half a year or year, not all of them at the same time, etc. There are a lot of them, I can not and don't want to test them all, which leads to 3rd reason.
The third one is that it _should_ work the same for every distro and DE. There should be no need to test them all.
The fourth one, lock screen does not seem to be very popular, so it gets tested less by people or the majority uses DE that just work.

However in practice it's a little different, as you already see. So, once in a while, as in this case, I download 100G of ISOs and try them because I had an itch to fix or test stuff :)

Somewhat good news for Cinnamon
-------------------------------------------------------
I have found out, experimentally, that if I run this: "cinnamon-screensaver-command -d" (the command unlocks the screen), screen locking magically starts to work! :)

So you may try to add that in startup when Cinnamon starts and that might work, I do not know for how long though, most likely for that session.
Check this how to do that: https://ibb.co/ZHsHH0s .

You may want to adjust delay if your computer is slower, but do not overshoot, find the value which works for you :)
Hope this helps.

Revision history for this message
Luca Trombin (lucat78) said :
#9

Hi Eduards,

thanks a lot for all your time in this, I really appreciate!

Regarding the custom actions I proposed, do you think you will implement it?

Thanks,

Luca

Revision history for this message
Eduards Bezverhijs (mjasnik) said :
#10

Probably yes, some day when I feel that itch to spend some days on this… No eta :)

Revision history for this message
Luca Trombin (lucat78) said :
#11

Sure, thanks a lot Eduards.
Let me know if you need any help

Can you help with this problem?

Provide an answer of your own, or ask Luca Trombin for more information if necessary.

To post a message you must log in.