Open maciel310 opened 10 years ago
Thanks!
You're right that it's not very portable. For example, I don't use gnome-screensaver.
I think the right way to do this is to make the notify
bit of the script more parametrizable, so that you can drop in your own script / function. That way, this specific logic (how to notify) can be separated from the bulk of the script, which can stay focused on when to notify.
Agreed, that would probably be the best approach. To make that work, though, one of the parameters to the script will need to indicate if the current window has changed or not. In the case of gnome-screensaver at least, the current window doesn't change, so in order to have the notification email fire if the screen is locked it has to ignore that condition.
In all honesty I probably won't have a chance to implement the parameterization since my current approach suits my needs, but if you implement that let me know and I'd gladly submit an implementation of the email function with the new approach to my repo at least. You can either merge it in as a configurable notify function or just point people to my repo if they want an example.
Hi, first of all great script, it has been very convenient.
I made a fairly simple modification to allow sending a notification email if the screen is locked. Not sure if you'll want to pull it in since the way of detecting if the screen is locked isn't very portable across Linux distributions, but I figured I'd send the Pull Request anyway. Maybe you'll be able to come up with a more universal way of detecting this.