szymonkaliski/hhtwm

hs.drawing is deprecated

JoshuaCrewe opened this issue · 2 comments

I blindly updated to the latest hammerspoon, Version 0.9.86 (5890) which gave me a console error :

2021-03-20 15:08:40: *** ERROR: /Users/joshua/.hammerspoon/hhtwm/init.lua:654: attempt to call a nil value (field 'disableScreenUpdates')
stack traceback:
	/Users/joshua/.hammerspoon/hhtwm/init.lua:654: in function 'hhtwm.tile'
	/Users/joshua/.hammerspoon/hhtwm/init.lua:852: in function 'hhtwm.start'
	/Users/joshua/.hammerspoon/wm/init.lua:103: in function 'wm.start'
	/Users/joshua/.hammerspoon/init.lua:20: in local 'fn'
	...on.app/Contents/Resources/extensions/hs/fnutils/init.lua:87: in function 'hs.fnutils.each'
	/Users/joshua/.hammerspoon/init.lua:19: in main chunk
	[C]: in function 'xpcall'
	...app/Contents/Resources/extensions/hs/_coresetup/init.lua:702: in function 'hs._coresetup.setup'
	(...tail calls...)

Which looks like it is due to drawing being deprecated. Commenting out the disableScreenUpdates() as well as enableScreenUpdates() will stop the error and get everything working again. I mean it isn't a fix and there may be issues in the future, just gets things going for the time being.

http://www.hammerspoon.org/docs/hs.drawing.html

hs.drawing.disableScreenUpdates()

and

hs.drawing.enableScreenUpdates()

I don't really use this Mac much any more but will probably come back to it at some point. I couldn't immediately see a replacement in the docs via hs.canvas but the answer is in the somewhere.

Apparently it is fine to just remove it ...

Hammerspoon/hammerspoon#2766

thank you, merged!