-
Detecting When You’re “Away” or “Back” in Your Keyboard Maestro Macros
Your Mac knows the last time you moved the mouse or pressed a keyboard key. We can use this information in Keyboard Maestro to perform actions based on whether we’ve “gone away” from or have “come back” to our computer. I’m using this technique to set my status in Slack to “Away” if I step away from my computer for more than 10 minutes, and back to “Active” when I return. Here are a few quick examples that could use this same basic framework:
- Automatically pause music if I step away
- Show me a “Welcome back!” message when I return
- Write the date/time to a log file the when I go away and when I return
Setup your macro with a “Periodically while logged in” trigger. In the example here I’m using 10 seconds because I want no more than 10 seconds to pass before my system detects that I’ve returned to my desk. The macro isn’t very CPU-hungry so 10 seconds shouldn’t be problematic.
-
Disable Drupal’s default “user X has applied for an account” email
By default Drupal sends an email to the site admin; it’s not editable (and you cannot disable it) from the account settings page.
On a recent project I had to use Rules to send some emails when a user registers for an account. Because I was already sending emails via Rules, I needed to disable the stock admin email. Here’s a quick way to do this:
1234567891011/*** Implements hook_mail_alter().*/function mymodule_mail_alter(&$message) {switch ($message['id']) {case 'user_register_pending_approval_admin':// Don't send the default approval email to the admin (we're using Rules for this)$message ['send'] = FALSE;break;}}