asmagill / hammerspoon_asm

Hammerspoon modules in progress...
MIT License
52 stars 12 forks source link

Touch Bar - Error Message Always Displayed #8

Closed latenitefilms closed 7 years ago

latenitefilms commented 7 years ago

@asmagill - I haven't had a chance to test first hand as my laptop is running 10.12.1, but I'm told that if you don't have macOS 10.12.1 build 16B2657 or greater, as soon as you "require" hs._asm.touchbar, it will display the built-in error message. I believe the intention was to have the error message off by default (hence the reason for touchbar.supported())?

asmagill commented 7 years ago

I've been going back and forth about whether it should prompt immediately if you try to load the module as a way to minimize questions along the lines of "why doesn't it work for me?" when we move it into core...

I'll take this as a vote against? What about prompting if you attempt to run the new function when it's not supported with the current os? That way the module would load, but it would prompt the user if you actually tried to create a touchbar on an unsupported machine? Currently it will just return nil in that situation.

For now, if you want to suppress it, remove the "true" argument in line 12 of hs/_asm/touchbar/init.lua.

randomeizer commented 7 years ago

Personally, I would much rather it happened in the new function, and threw an error. Right now, if I'm on El Capitan, I get an ugly dialog box every time the 'require' happens, and there's no way to avoid it in code.

If the check is moved there, then we can code around the dialog box by checking 'touchbar.supported()' first. Currently, there's nothing we can do.

asmagill commented 7 years ago

The latest version no longer prompts if you do not have the necessary support for the Touch Bar. If your code goes ahead and calls the new function anyways, that will prompt, so... make sure you check supported first and then provide your own fallback/message to the user as appropriate.

For the record, the difference between v0.6 and v0.6.1 is primarily in documentation and won't affect your current use of the module.

randomeizer commented 7 years ago

Perfect, thanks.

latenitefilms commented 7 years ago

Legend, thanks heaps @asmagill! Very much appreciated!