koekeishiya / skhd

Simple hotkey daemon for macOS
MIT License
6.05k stars 204 forks source link

Running as a service under Sonoma 14.2.1 doesn't work #339

Closed jjo93sa closed 5 months ago

jjo93sa commented 6 months ago

Skhd installed from Homebrew, version v0.3.9, doesn't work when run as a launchd service. Skhd, however, does work when started from the terminal ether as skhd or skhd -V

I've amended the plist file to add the -V switch, and get logging in the appropriate /tmp/ file, but all key combinations are ignored.

I have tried uninstalling, removing the accessibility privileges, restarting my MacBook and re-installing, enabling the accessibility privileges, but nothing works when skhd is run as a service. As soon as I:

skhd --stop-service
skhd -V

everything works just fine.

jjo93sa commented 6 months ago

I've followed the various suggestions here: https://github.com/koekeishiya/skhd/issues/312 but that hasn't helped.

launchctl print gui/502/com.koekeishiya.skhd

Shows that the environment is correctly set with the path for home-brew's bin folder. Nonetheless, I changed my rc file to include the path to Yabai - no change

tim-hilt commented 6 months ago

Same problem for me. Moreover running skhd manually from the command-line shows the following message:

skhd: could not lock pid-file! abort..

I thought it was a rights-issue, but running as root doesn't seem to be allowed:

skhd: running as root is not allowed! abort..

@koekeishiya any idea what else we could try?

koekeishiya commented 5 months ago

The issue was probably caused by a lack of codesigning. I've added an ad-hoc codesigning step to the brew formula. Stop, and uninstall skhd, remove it from accessbility permisions in macOS settings, reboot. Update the skhd formula using brew update. Install again, start the service and accept accessibility permissions. Start the service again.

jjo93sa commented 5 months ago

Thanks for the help. Unfortunately, I still cannot get skhd to work on this MacBook as a service. This is the procedure I followed:

skhd --stop-service
brew uninstall --force skhd
ls /opt/homebrew/bin/s*  # check there's no skhd binary
rm /Users/james/Library/LaunchAgents/com.koekeishiya.skhd.plist 
rm /Users/james/Library/Caches/Homebrew/downloads/*skhd*.zip

Then I disabled the accessibility setting, deleted the accessibility setting and rebooted. After which I:

brew update
brew install skhd
skhd --start-service

I got the security dialog, navigated to the setting, enabled accessibility then

skhd --start-service

None of the shortcuts work still. I've repeated this process twice now. I have also restarted yabai

If I stop the service, and run it manually in the terminal, then it works just fine:

skhd --stop-service
ps -ef | grep skhd # check skhd isn't running
skhd -V

Throwing the command into the background also works: skhd -V >/dev/null 2>&1 &. The verbose setting makes no difference, i.e. this also works skhd >/dev/null 2>&1 &

Sorry if I'm doing something obviously wrong, but I'd appreciate some more help.

albibenni commented 1 month ago

Is this closed because you found a solution? For me it still doesn't work