-
Notifications
You must be signed in to change notification settings - Fork 632
Description
1. Environment (環境)
- OS: macOS Sonoma (M3 Chip)
- Hammerspoon Version: Latest (Reinstalled from Homebrew on Aug 19, 2025)
- Alacritty Version: Latest (from Homebrew)
2. Problem Description (問題の概要)
On a clean installation of Hammerspoon and Alacritty on an Apple Silicon (M3) Mac, several core Hammerspoon APIs fail to function correctly, making process and window management impossible. The issue persists even after a complete reinstallation and clearing of all related cache and preference files.
Specifically:
hs.task.new()
returnsnil
when trying to launch Alacritty.hs.window.filter.new()
returns a non-nil object that does not have a.start()
method, causing a crash.hs.window.setFrame()
fails to move the target window, even when the window object is successfully found byhs.window.find()
.
The core of the issue appears to be a discrepancy between the permissions displayed in macOS System Settings and the actual permissions granted to the Hammerspoon process. Although Accessibility and Automation are enabled in the UI, the application behaves as if it has no permissions, causing core API calls that depend on them to fail. This issue persists even after full permission resets via tccutil
.
3. Steps to Reproduce (再現手順)
The following configuration reliably reproduces the error.
~/.config/alacritty/vime.toml
:
# Import the main configuration file to inherit its settings (theme, opacity, etc.)
import = ["~/.config/alacritty/alacritty.toml"]
# VIME-specific settings below will override the imported ones.
[window]
dimensions = { columns = 80, lines = 20 }
decorations = "none"
padding = { x = 10, y = 10 }
title = "VIME_TERMINAL_INSTANCE"
[font]
size = 14.0
[terminal]
shell = { program = "nvim", args = ["-u", "~/.config/nvim/vime_init.lua"] }
~/.hammerspoon/init.lua
:
-- Full-featured version (for bug report)
-- --- Configuration ---
local ALACRITTY_PATH = "/opt/homebrew/bin/alacritty"
local VIME_CONFIG_PATH = os.getenv("HOME") .. "/.config/alacritty/vime.toml"
local VIME_WINDOW_TITLE = "VIME_TERMINAL_INSTANCE"
local VIME_HOTKEY_MOD = {"cmd", "ctrl"}
local VIME_HOTKEY_KEY = "i"
-- --- End of Configuration ---
function launchVIME()
local vimeFilter = hs.window.filter.new(VIME_WINDOW_TITLE)
if not vimeFilter then
hs.notify.new({title="VIME FATAL ERROR", informativeText="hs.window.filter.new() failed."})
return
end
vimeFilter:subscribe({
[hs.window.filter.windowCreated] = function(win, appName, event)
if win and win:title() == VIME_WINDOW_TITLE then
win:setAlwaysOnTop(true)
local screen = hs.screen.mainScreen()
local frame = win:frame()
local screen_geom = screen:geometry()
frame.x = (screen_geom.w - frame.w) / 2
frame.y = (screen_geom.h - frame.h) / 2
win:setFrame(frame)
end
end,
[hs.window.filter.windowDestroyed] = function(win, appName, event)
if win and win:title() == VIME_WINDOW_TITLE then
hs.eventtap.keyStroke({"cmd"}, "v")
vimeFilter:stop()
vimeFilter = nil
end
end
})
vimeFilter:start()
local command = string.format(
'"%s" --config-file "%s"',
ALACRITTY_PATH,
VIME_CONFIG_PATH
)
hs.execute(command, true)
end
hs.hotkey.bind(VIME_HOTKEY_MOD, VIME_HOTKEY_KEY, launchVIME)
4. Troubleshooting Steps Taken (試したこと)
This is not a simple configuration error. We have exhaustively tried:
- Verifying all file paths are absolute and correct.
- Confirming that Alacritty launches correctly from the terminal using the exact same command.
- Using
hs.execute
as a workaround, which successfully launches the app but provides no process/window monitoring. - Verifying and re-granting Accessibility and Automation permissions in System Settings.
- Resetting all permissions for Hammerspoon using
tccutil reset All org.hammerspoon.Hammerspoon
. - A "scorched earth" reinstall: manually deleting
/Applications/Hammerspoon.app
,~/Library/Caches/org.hammerspoon.Hammerspoon
, and~/Library/Preferences/org.hammerspoon.Hammerspoon.plist
before reinstalling.
The issue persists through all of these steps, strongly suggesting a deep incompatibility within the Hammerspoon runtime on this specific hardware/OS combination.