1

What I'd like to achieve

On my Macbook Pro with latest macOS - every X minutes, the screensaver turns on for X seconds, then the screensaver turns off. This application by defaults runs every time the MBP turns on, with the option to disable.

Question

I've started to create this using Automator but I'm stuck at disabling/turning off the screen saver. Is it possible to do this through Automator or is there another way to achieve this?

  • 1
    Can I ask what the purpose of turning the screensaver off and on is? Perhaps there's another method of achieving your end goal. – benwiggy Jan 31 at 18:20
  • Thinking to use the screensaver as an indicator to look away from my screen for a time period, then the screensaver to turn off after that period as an indicator to look back at it again. – John_Henry Jan 31 at 18:43
  • While this could be coded in i.e. an AppleScript app, nonetheless the inherent issue will be that while using the computer and the timeout occurs for the Screen Saver to start, it will only monetarily start because you're using the computer and just end up being a visual distraction. I guess it also be coded to lock the screen too, besides just starting the screen saver. Although this may also depend on other settings within System Preferences for it to work or not. There are apps available to help with taking a break now and again. I'd fix the user and then a software fix is not necessary. ;) – user3439894 Jan 31 at 19:33
1

You can stop screensaver with killall ScreenSaverEngine. In automator you would pick "Run Shell Script" and then enter it there - something like this :

enter image description here

To make it repeat you could add another 'Pause' even at the start and a 'Loop' event at the end so you application runs, for example :

  • 'Pause' 30 minutes
  • 'Start' screen saver
  • 'Pause' 1 minute
  • 'Run Shell Script' - killall ScreenSaverEngine to stop screen saver
  • 'Loop' - automatically 99999999 times. This is the maximum on Lion - your version may be different.

You can then save application somewhere and add it to Login Items. You should set screensaver to 'never' in system preferences also so it doesn't confuse the issue.

  • 1
    I tested your workflow under both macOS High Sierra and macOS Mojave, and wile the workflow does complete, nonetheless, it did not stop the Screen Saver under both tested OSes, I had to move the mouse or type on the keyboard for the Screen Saver to quit. BTW The OP is using macOS Mojave so it probably will not work for him either. – user3439894 Jan 31 at 20:12
  • I'm using Lion, and as you see from log it ends screen saver fine. I don't have Mojave to test with unfortunately. I could try it with El Capitain but that wouldn't help as it is also rather old. – lx07 Jan 31 at 20:25
  • I tested the workflow above on macOS Mojave and it also did not stop the screensaver. The shell command "killall" gets us closer though, seems like we just need to find the activity name for the screensaver in macOS Mojave... – John_Henry Jan 31 at 21:16
  • It should be fairly easy to find the name of activity to kill for a different OS. Run Shell Script ps -Ao command > $HOME/Desktop/Before, start screensaver then run ps -Ao command > $HOME/Desktop/After. Then compare "Before" and "After" files on desktop. For me the only difference is /System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine -psn_0_315469. Unfortunately I can't test on Mojave as officially Lion is the last version my MBP will run (although ElCap sort of works). – lx07 Jan 31 at 21:52
  • @John_Henry, The problem is the ScreenSaverEngine process is being terminated but it is not stoping the Screen Saver! I know how to fix this but frankly IMO this is not the way to get one to take a break because while the screen saver can be triggered by the app, nonetheless, it will immediately stop if one is typing or using the mouse at the time the app triggers the screen saver and why I didn't post an answer to begin with. – user3439894 Feb 1 at 1:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .