szymonkaliski / hhtwm

hackable tiling window manager for macOS and Hammerspoon
MIT License
237 stars 11 forks source link

hs.drawing is deprecated #10

Closed JoshuaCrewe closed 3 years ago

JoshuaCrewe commented 3 years ago

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

https://github.com/szymonkaliski/hhtwm/blob/fa42bb65a61e5edac8006422b3f368aa18285e95/hhtwm/init.lua#L654

and

https://github.com/szymonkaliski/hhtwm/blob/fa42bb65a61e5edac8006422b3f368aa18285e95/hhtwm/init.lua#L687

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.

JoshuaCrewe commented 3 years ago

Apparently it is fine to just remove it ...

https://github.com/Hammerspoon/hammerspoon/issues/2766

szymonkaliski commented 3 years ago

thank you, merged!