mjolnirapp / mjolnir

Lightweight automation and productivity app for OS X
5.21k stars 128 forks source link

Mjolnir.winow on yosemite #538

Closed joelmccracken closed 9 years ago

joelmccracken commented 9 years ago

I just upgraded to yosemite, and I have been having some trouble with Mjolnir. Allow me to provide my init file and the error message. Thanks for any help in advance.

 application = require "mjolnir.application"
 hotkey = require "mjolnir.hotkey"
 window = require "mjolnir.window"
 fnutils = require "mjolnir.fnutils"
 grid = require "mjolnir.bg.grid"

grid.GRIDHEIGHT = 2
grid.GRIDWIDTH = 2

function explore(it)
   for k, v in pairs(it) do print(k) end
end

hotkey.bind({"cmd", "ctrl"}, "1", function()
   win = window.focusedwindow()
  grid.set(win, {x=0, y=0, w=1, h=1}, win:screen())
end)

hotkey.bind({"cmd", "ctrl"}, "2", function()
   win = window.focusedwindow()
  grid.set(win, {x=1, y=0, w=1, h=1}, win:screen())
end)

hotkey.bind({"cmd", "ctrl"}, "3", function()
   win = window.focusedwindow()
  grid.set(win, {x=0, y=1, w=1, h=1}, win:screen())
end)

hotkey.bind({"cmd", "ctrl"}, "4", function()
   win = window.focusedwindow()
  grid.set(win, {x=1, y=1, w=1, h=1}, win:screen())
end)

hotkey.bind({"cmd", "ctrl"}, "up", function()
  grid.resizewindow_taller()
end)

hotkey.bind({"cmd", "ctrl"}, "left", function()
  grid.resizewindow_thinner()
end)

hotkey.bind({"cmd", "ctrl"}, "right", function()
  grid.resizewindow_wider()
end)

hotkey.bind({"cmd", "ctrl"}, "down", function()
  grid.resizewindow_shorter()
end)

hotkey.bind({"cmd", "ctrl", "shift"}, "up", function()
  grid.pushwindow_up()
end)

hotkey.bind({"cmd", "ctrl", "shift"}, "down", function()
  grid.pushwindow_down()
end)

hotkey.bind({"cmd", "ctrl", "shift"}, "left", function()
  grid.pushwindow_left()
end)

hotkey.bind({"cmd", "ctrl", "shift"}, "right", function()
  grid.pushwindow_right()
end)

hotkey.bind({"cmd", "ctrl"}, "5", function()
   win = window.focusedwindow()
  grid.snap(win)
end)

hotkey.bind({"cmd", "ctrl"}, "E", function()
  os.execute('/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -s server ' .. mjolnir.configdir .. '/init.lua &')
end)

hotkey.bind({"cmd", "ctrl"}, "R", function()
  mjolnir.reload()
end)

hotkey.bind({"cmd", "ctrl"}, "C", function()
  mjolnir.openconsole()
end)

ad the error message:

Welcome to the Mjolnir Console!
You can run any Lua code in here.

-- Loading ~/.mjolnir/init.lua
-- Done.
/Users/joel/.mjolnir/init.lua:26: attempt to index global 'win' (a nil value)
stack traceback:
    /Users/joel/.mjolnir/init.lua:26: in function </Users/joel/.mjolnir/init.lua:24>
    [C]: in function 'xpcall'
    /usr/local/share/lua/5.2/mjolnir/hotkey.lua:23: in function </usr/local/share/lua/5.2/mjolnir/hotkey.lua:21>

It looks like there is a problem within the internals of mjolnir/hotkey. I've tried to upgrade them. Here are the versions of the plugins I have installed:

luarocks list

Installed rocks:
----------------

mjolnir.alert
   0.2-1 (installed) - /usr/local/lib/luarocks/rocks

mjolnir.application
   0.3-1 (installed) - /usr/local/lib/luarocks/rocks

mjolnir.bg.grid
   0.1-2 (installed) - /usr/local/lib/luarocks/rocks

mjolnir.fnutils
   0.1-1 (installed) - /usr/local/lib/luarocks/rocks

mjolnir.geometry
   0.2-1 (installed) - /usr/local/lib/luarocks/rocks

mjolnir.hotkey
   0.3-1 (installed) - /usr/local/lib/luarocks/rocks

mjolnir.keycodes
   0.2-1 (installed) - /usr/local/lib/luarocks/rocks

mjolnir.screen
   0.2-1 (installed) - /usr/local/lib/luarocks/rocks
thesoftwarephilosopher commented 9 years ago

Disable and re-enable Accessibility for Mjolnir.

joelmccracken commented 9 years ago

Perfect, thanks for the prompt reply. Was this in the documentation somewhere that I missed?

On Sat, Dec 13, 2014 at 10:33 PM, Steven Degutis notifications@github.com wrote:

Disable and re-enable Accessibility for Mjolnir.

— Reply to this email directly or view it on GitHub https://github.com/sdegutis/mjolnir/issues/538#issuecomment-66901458.

thesoftwarephilosopher commented 9 years ago

Yep, FAQ # 3 on the readme. I should probably move it to # 1 at this point. :)

joelmccracken commented 9 years ago

Ah yeah thanks. I hate when I fail to RTFM. You might want to add a line about possibly needing to re-enable after upgrading; my first thought was this was from some kind of yosemite compatibility issue.

Thanks again =D

joelmccracken commented 9 years ago

If this is a large problem, it might be worth scripting something to do this: https://raymii.org/s/snippets/OS-X-Enable-Access-for-assistive-devices-via-command-line.html