LionyxML / auto-dark-emacs

Auto-Dark-Emacs is an auto changer between 2 themes, dark/light, following MacOS, Linux or Windows Dark Mode settings
GNU General Public License v2.0
140 stars 34 forks source link

Failing with "AppleScript error 1" #13

Closed lukehoersten closed 1 year ago

lukehoersten commented 1 year ago

After installation, failing with the error: Error running timer ‘auto-dark--check-and-set-dark-mode’: (error "AppleScript error 1")

Please let me know if there's anything else I can do to help investigate the issue.

marcosbodio commented 1 year ago

I have the exact same problem:

LionyxML commented 1 year ago

Hello there! Thanks for your reports.

I just re-downloaded auto-dark from MELPA, put (require 'auto-dark) inside my ~/.emacs and everything seems to be working fine.

Maybe it is something with the compiled version you guys might be using? Have you tried different emacs distributions, like the emacs from brew, https://emacsformacosx.com, or this very very cool repo (https://github.com/d12frosted/homebrew-emacs-plus) ?

Two things to keep note. 1.) If you M-x customize-group RET auto-dark RET and toggle Auto Dark Allow Osascript to on, like here:

image

Then close and open emacs again. Does it change anything?

2.) On MacOS settings -> security and privacy -> privacy , check each item where emacs appears if full access is granted. Example:

image

Here I have Emacs allowed (checked) on:

Also for reference I am using:

Please let me now if any of my guesses fixes anything :)

LionyxML commented 1 year ago

PR #15 just implemented a new behavior and it is already on MELPA.

If you guys use the emacs-plus brew formulae. auto-dark-emacs will use it's plugin to detect changes instead of the old method.

Let me now if it works for you.

marcosbodio commented 1 year ago

@LionyxML Thank you for your suggestions. I have re-installed auto-dark and I have tried both (1) and (2) in your comment, and it made no difference. Unfortunately I still get the same error.

I forgot to mention. I installed emacs using brew: https://formulae.brew.sh/formula/emacs

marcosbodio commented 1 year ago

@LionyxML I have update my mac to Mac OS Ventura 13.0.1 (22A400), and I still have the same problem.

Tyruiop commented 1 year ago

Hi, jumping in this issue because I have the same issue after doing brew install --cask emacs. However, if I run emacs from alacritty, then it works perfectly, if I run it from the launcher then I have this issue. I can't seem to give permissions to emacs. Hope this can help a bit!

guobingyi commented 1 year ago

I have same problem,I use emacs shell-command execute command:

osascript -e 'tell application "System Events" to tell appearance preferences to return dark mode'

then allow emacs privacy.restart emasc,it be working fine.Hope this can help a bit too!Thanks LionyxML let me know osascript 😊

marcosbodio commented 1 year ago

Hi, jumping in this issue because I have the same issue after doing brew install --cask emacs. However, if I run emacs from alacritty, then it works perfectly, if I run it from the launcher then I have this issue. I can't seem to give permissions to emacs. Hope this can help a bit!

Thank you @Tyruiop! I have tried to start emacs from the terminal (I use iTerm2) with nohup emacs &, and now auto-dark works :)

LionyxML commented 1 year ago

Yey! Closing it. If any trouble happens in the future we may open it again.

gopar commented 8 months ago

I have same problem,I use emacs shell-command execute command:

osascript -e 'tell application "System Events" to tell appearance preferences to return dark mode'

then allow emacs privacy.restart emasc,it be working fine.Hope this can help a bit too!Thanks LionyxML let me know osascript 😊

For whatever reason I needed to run this first, a dialog pops up asking for permission, click yes. I was unable to find it via settings. Perhaps this is something worth putting in readme? The optional dark-mode-allow-osascript did not help

Thanks for the work on package!