zzamboni / dot-hammerspoon

My personal Hammerspoon configuration - mirrored from GitLab
https://gitlab.com/zzamboni/dot-hammerspoon.git
230 stars 46 forks source link

KSheet has no bind_hotkeys and no toggle #14

Open winmillwill opened 6 years ago

winmillwill commented 6 years ago

I get an error with the KSheet config because that spoon has no bind_hotkeys method and no toggle method. I looked through the git history and it doesn't seem to ever have had those methods. Is the fix to just rewrite the plugin in my spoons repo, or is there something automatic that should be inferring how to toggle and bind?

zzamboni commented 6 years ago

This is really strange. The copy of the spoon that I have (installed some time ago) does have those functions. You can see the full file here: https://gist.github.com/zzamboni/937fbce4c2d1894690604298b2e48a41

Comparing with the file that now comes with the spoon, the only difference is exactly these lines at the end of the module:

function obj:toggle()
  if self.sheetView and self.sheetView:hswindow() and self.sheetView:hswindow():isVisible() then
    self:hide()
  else
    self:show()
  end
end

function obj:bindHotkeys(mapping)
  local actions = {
    toggle = hs.fnutils.partial(self.toggle, self),
    show = hs.fnutils.partial(self.show, self),
    hide = hs.fnutils.partial(self.hide, self)
  }
  hs.spoons.bindHotkeysToSpec(actions, mapping)
end

I have no idea what happened - I installed KSheet some time ago and used it as documented. I also looked at the gist history and don't see those changes taking place. Maybe @ashfinal or @cmsj can clarify? In any case it would be great to restore the full file to the official spoon file.

plygrnd commented 5 years ago

This is still an issue; attempting to install KSheet results in errors, because bindHotKeys is missing.

plygrnd commented 5 years ago

Sent a PR.

zzamboni commented 5 years ago

Thanks! Maybe I made those changes locally and forgot to file a PR myself.