Deprecated! OS X External Monitor Woes

Deprecated!

What kind of a word is “deprecated”? Has anybody outside the rarified upper realms of Unix actually ever used this word? Has the word ever been said? Or is it just a Unix “man page” word?

It usually refers to an operating system feature that is no longer supported, and supposedly on the way to feature heaven. But the feature still works.

I cringe when I hear “deprecated”. To me it means a really nice and easy to understand feature is being replaced by something impossible to remember and hopelessly complex.

What I’m thinking about in specific is the Unix command “cron”. Cron has been honored with the “deprecated” label in OS X (which is really Unix). It supposedly wasn’t good enough and will eventually disappear, to be replaced with “launchd”.

Cron is used to automatically start tasks at a certain time. The start time can be very precisely controlled by inserting a configuration line in the crontab file.

Cron is elegantly simple. Here is a typical cron entry:

*/5 * * * * ~/documents/brightness -d 1 .75

It’s stored in a file called crontab. Crontab can contain many entries like the one above. The layout of a crontab entry is shown below.

# * * * * * command to execute
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ └───── day of week (0 – 6) (Sunday to Saturday)
# │ │ │ └────────── month (1 – 12)
# │ │ └─────────────── day of month (1 – 31)
# │ └──────────────────── hour (0 – 23)
# └───────────────────────── min (0 – 59)

And that’s all there is! The */5 in my command above means every 5 minutes. By itself, the asterisk would mean every minute. If it were “5”, it would be the fifth minute of every hour of every day of every month and every day of the month. In other words, every 5 minutes. See how simple and concise this is.

Launchd is described in the link below. This must be a joke! I’ll learn it on the day cron is really dead.

http://tinyurl.com/psa9z7g

Cron proved very useful in fixing the problem described below.

OS X Dual Monitor setup

OS X, from Lion on up, has a serious problem with a dual monitor setup. When an external VGA monitor is hooked via Thunderbolt, the laptop display dims incrementally over several hours until it’s completely dark. This happens no matter if the ambient light sensor has been disabled in system preferences. The dimming is aggressive in this dual monitor setup, rendering the laptop display increasingly dim as the hours go on, to the point where the screen is black after about a day. I laughed the first time I saw the display after it had turned completely black. That’s a real bug.

This has happened on two different Macbooks with Lion and Yosemite so it probably afflicts all OS X laptops. The external monitor is VGA via Thunderbolt. Whether this happens with Thunderbolt to HDMI or DVI is beyond my immediate ability or desire to test. It’s irrelevant to my situation as I have no choice.

I have disabled dimming in preferences for both keyboard and screen and permanently turned off BezelServices thru the command line. No joy.

The external monitor is unaffected.

The screen never dims when the screensaver is running. From the moment the screensaver starts until the moment it stops, the screen brightness does not change. It may be dim from the last dimming event, but it does not change. The display dimming becomes apparent only when the screensaver stops (due to mouse or keyboard activity) and then the screen looks much dimmer than the last time you saw it, and the clock screensaver will also be just as dim next time it starts. This is important to remember when you read the fix.

Only Apple knows why this is happening. Apple probably doesn’t care. This happens in Lion and Yosemite so I have to assume it happens with all the OS X versions in-between. It does not happen in Snow Leopard.

So if Apple doesn’t care, the question is what can be done to stop that from happening.

I truly need the laptop display at almost full brightness all the time. It serves as an analog clock day and night, and doubles as a nightlight at night. See picture below.

aCIMG0681

aCIMG0680

The only fix seems to be going back to Snow Leopard. That’s out of the question.

So I have a problem. I have a screen that turns dark and useless in 24 hours. It’s my clock and my nightlight. Apple ain’t gonna fix my problem. So what do I do?

What finally worked was a somewhat complex kludge involving a crontab entry (see above) that runs a command line screen brightness utility every 5 minutes.

A tip of the hat to Jon Stacey (https://github.com/jmstacey). He wrote an efficient and handy utility called “brightness” which is run from the OS X command line. It can be used to find out the monitor identifier, to find out the existing brightness level and to set the brightness level for a particular display (in this case the laptop display).

It is this command I call from cron every 5 minutes to reset the brightness. Since the brightness does not change when the clock screensaver is on, there’s no constant dimming and brightening of the laptop display, which some people would find rather annoying. And the clock screensaver is running 98% of the time. That’s all the laptop display is ever used for. When I’m using the Macbook, it’s always through the external monitor and a KVM (which always works fine).

From terminal, do the following:

Sudo crontab –e

This puts you into vi, which is a powerful unix text editor. If you don’t know how to use it, don’t attempt this.

Insert this crontab entry

*/5 * * * * ~/documents/brightness -d 1 .75

Save it and that’s it. Kludge that it is, it works for me and keeps my clock and nightlight nice and bright. Thanks, Apple.

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s