Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

attempt to index a nil value #16

Open
L33t-HAXXOR opened this issue Sep 7, 2021 · 5 comments
Open

attempt to index a nil value #16

L33t-HAXXOR opened this issue Sep 7, 2021 · 5 comments

Comments

@L33t-HAXXOR
Copy link

Please Wait!

Hear me out.

Before you respond with, "this already has a solution, read the docs" and close the issue, I did do that and am still having an issue with the setup:

Captura de Pantalla 2021-09-06 a la(s) 22 23 47

Running this config:
System - Mac Config 2020-12-01

I'm moving on to try the Spooninstall method. Is there a debug log I can send?
Is it already posted above?

Thanks for hearing me out!

@L33t-HAXXOR
Copy link
Author

Also for the Spooninstall method, will I need to delete the first script I pasted in?
Thank you!

@peterklijn
Copy link
Owner

Hi,

Thanks for taking the time to submit an issue. From looking at the print screens, I think there's something wrong with your general Hammerspoon configuration.

Hammerspoon is configured with a init.lua script file that is located in the hidden .hammerspoon directory in your user home folder (~/.hammerspoon/init.lua / /users/YOURUSERNAME/.hammerspoon/init.lua). You can also open it by clicking on the Hammerspoon icon in your menu bar and selecting 'Open Config' in the dropdown.

This file is there you load and start the Hammerspoon ShiftIt plugin. I think there's something wrong with that file.

In my case, my file looks like this:

hs.loadSpoon("ShiftIt")
spoon.ShiftIt:bindHotkeys({})

In addition, I have the following folder structure in the .hammerspoon directory: ~/.hammerspoon/Spoons/ShiftIt.spoon/init.lua.

It's important that the string "ShiftIt" matches with the folder name ending with .spoon, as otherwise it does not load the Hammerspoon ShiftIt plugin and the next line (spoon.ShiftIt:bindHotkeys({})) fails.

Could you please share the content of the ~/.hammerspoon/init.lua file on your machine?
As well as run the command ls -la ~/.hammerspoon/Spoons on your machine and copy/paste the results of that command in the comment?

@ideadapt
Copy link

ideadapt commented Sep 22, 2021

I have the same issue. Here is my log output (I think I setup everything according to your readme):

2021-09-22 21:26:21: -- Lazy extension loading enabled
2021-09-22 21:26:21: -- Loading ~/.hammerspoon/init.lua
2021-09-22 21:26:21: -- Loading Spoon: ShiftIt
2021-09-22 21:26:21: -- Loading extension: hotkey
2021-09-22 21:26:21: 21:26:21     hotkey: Enabled hotkey ⌘⌃⌥LEFT
2021-09-22 21:26:21:              hotkey: Enabled hotkey ⌘⌃⌥RIGHT
2021-09-22 21:26:21:              hotkey: Enabled hotkey ⌘⌃⌥UP
2021-09-22 21:26:21:              hotkey: Enabled hotkey ⌘⌃⌥DOWN
2021-09-22 21:26:21:              hotkey: Enabled hotkey ⌘⌃⌥1
2021-09-22 21:26:21:              hotkey: Enabled hotkey ⌘⌃⌥2
2021-09-22 21:26:21:              hotkey: Enabled hotkey ⌘⌃⌥3
2021-09-22 21:26:21:              hotkey: Enabled hotkey ⌘⌃⌥4
2021-09-22 21:26:21:              hotkey: Enabled hotkey ⌘⌃⌥M
2021-09-22 21:26:21:              hotkey: Enabled hotkey ⌘⌃⌥F
2021-09-22 21:26:21:              hotkey: Enabled hotkey ⌘⌃⌥Z
2021-09-22 21:26:21:              hotkey: Enabled hotkey ⌘⌃⌥C
2021-09-22 21:26:21:              hotkey: Enabled hotkey ⌘⌃⌥N
2021-09-22 21:26:21:              hotkey: Enabled hotkey ⌘⌃⌥P
2021-09-22 21:26:21: 21:26:21 ** Warning:hs.keycode: key '=' not found in active keymap; using ANSI-standard US keyboard layout as fallback, returning '24'
2021-09-22 21:26:21:              hotkey: Enabled hotkey ⌘⌃⌥^
2021-09-22 21:26:21:              hotkey: Enabled hotkey ⌘⌃⌥-
2021-09-22 21:26:21: -- Done.
2021-09-22 21:26:35: -- Loading extension: window
2021-09-22 21:26:35: 21:26:35 ERROR:   LuaSkin: hs.hotkey callback: /Users/kue/.hammerspoon/Spoons/ShiftIt.spoon/init.lua:51: attempt to index a nil value
stack traceback:
	/Users/kue/.hammerspoon/Spoons/ShiftIt.spoon/init.lua:51: in function 'move'
	/Users/kue/.hammerspoon/Spoons/ShiftIt.spoon/init.lua:113: in function 'ShiftIt.left'
	/Users/kue/.hammerspoon/Spoons/ShiftIt.spoon/init.lua:161: in function </Users/kue/.hammerspoon/Spoons/ShiftIt.spoon/init.lua:161>

line 161 is:
hs.hotkey.bind(self.mapping.left[1], self.mapping.left[2], function() self:left() end)

line 51 is:
function move(unit) hs.window.focusedWindow():move(unit, nil, true, 0) end

Running MacOS Big Sur 11.5.2 (20G95)

Update

I enabled Hammerspoon in Privacy > Accessibility Settings of MacOS, and now it works :) (I have not seen this step in the readme).

@peterklijn
Copy link
Owner

Thanks for updating the message @ideadapt, I think you have a good point to put it as a step in the installation section.
It's mentioned in the Known issue section, but it might be overlooked.

@zc-alexfan
Copy link

I think you need to download the unzipped file in here into the Spoons (.hammerspoon/Spoons) directory. It works for me after the copying. My Spoons directory was empty.

@fchimpan fchimpan mentioned this issue Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants