ttscoff / bunch

Documentation repository for Bunch.app
https://bunchapp.co
116 stars 5 forks source link

Using Dock Hide/Show throws an error #217

Closed jemaleddin closed 2 years ago

jemaleddin commented 2 years ago

I use Bunch primarily to turn on and off the apps I use on Zoom calls, and as part of that hide my desktop, set a focus mode and hide my Dock. Not every time, but frequently, it fails to show the Dock when disabling the Bunch and I get an error that says:

There was an error running an AppleScript, it's possible the target application does not respond to the requested command: "tell app "System Events" to set autohide of dock preferences to false"

The dialog offers to show me the error log, which includes this entry:

2022-05-24 12:02:00: 🔴{ NSAppleScriptErrorBriefMessage = "Application isn\U2019t running."; NSAppleScriptErrorMessage = "Application isn\U2019t running."; NSAppleScriptErrorNumber = "-600"; NSAppleScriptErrorRange = "NSRange: {28, 41}"; }

I am triggering this with:

(hide dock)

Thanks for making such a cool app!

ttscoff commented 2 years ago

Something is convincing the system that System Events (which Marked uses to show/hide the Dock, among other things) isn't active (it should always be active). It might somehow be busy fulfilling another request at the time the command is sent, unsure. I wonder if I should have it retry at least once in case of error...

On 24 May 2022, at 11:08, Jemaleddin Cole wrote:

I use Bunch primarily to turn on and off the apps I use on Zoom calls, and as part of that hide my desktop, set a focus mode and hide my Dock. Not every time, but frequently, it fails to show the Dock when disabling the Bunch and I get an error that says:

There was an error running an AppleScript, it's possible the target application does not respond to the requested command: "tell app "System Events" to set autohide of dock preferences to false"

The dialog offers to show me the error log, which includes this entry:

2022-05-24 12:02:00: 🔴{ NSAppleScriptErrorBriefMessage = "Application isn\U2019t running."; NSAppleScriptErrorMessage = "Application isn\U2019t running."; NSAppleScriptErrorNumber = "-600"; NSAppleScriptErrorRange = "NSRange: {28, 41}"; }

I am triggering this with:

(hide dock)

Thanks for making such a cool app!

-- Reply to this email directly or view it on GitHub: https://github.com/ttscoff/bunch/issues/217 You are receiving this because you are subscribed to this thread.

Message ID: @.***>

jemaleddin commented 2 years ago

My whole bunch looks like:

---
shortcut: z
---

# Network Stuff
$ osascript ~/bin/disconnect_vpn.scpt

# Audio Stuff
Audio Hijack
Farrago

# Video Stuff
Zoom.us

$/usr/bin/shortcuts run DNDOn
!$/usr/bin/shortcuts run DNDOff
(hide dock)
(hide desktop)

So it might be busy dealing with the desktop when it tries to deal with the dock? (Simple-minded web dev here.) Thanks for taking a look!

ttscoff commented 2 years ago

Interestingly (maybe), when I test with both the hide dock and hide desktop commands, it's quitting or hanging Finder every time I open the Bunch. I think that may be where the conflict is coming from. Could you try removing the hide desktop and running a few times to see if the Dock hides and shows properly and consistently? This may be a false flag, so no guarantees, but worth narrowing down if it's related.

Thanks, Brett

On 26 May 2022, at 7:58, Jemaleddin Cole wrote:

My whole bunch looks like:

`--- shortcut: z

Network Stuff

$ osascript ~/bin/disconnect_vpn.scpt

Audio Stuff

Audio Hijack Farrago

Video Stuff

Zoom.us

$/usr/bin/shortcuts run DNDOn !$/usr/bin/shortcuts run DNDOff (hide dock) (hide desktop)`

So it might be busy dealing with the desktop when it tries to deal with the dock? (Simple-minded web dev here.) Thanks for taking a look!

-- Reply to this email directly or view it on GitHub: https://github.com/ttscoff/bunch/issues/217#issuecomment-1138549084 You are receiving this because you commented.

Message ID: @.***>

ttscoff commented 2 years ago

Ok, in the beta release (142) I've added two things:

  1. Allow up to 2 retries if an Apple Events script command fails, so if there's a conflict running once, it will attempt it again in 1 second.
  2. To hide Desktop icons, Finder has to be relaunched. Previously when hiding desktop icons, Finder would wait 2 seconds after quitting before relaunching. This seemed to be occasionally causing Finder not to relaunch at all, so I have removed that delay.

If you could, please download the beta release and help me test.

jemaleddin commented 2 years ago

Hey Brett,

Two meetings concluded and it seems to be working great! I think this fixed the situation - feels like a bit of a whack-a-mole situation, so I really appreciate you looking into it!

Jemal

ttscoff commented 2 years ago

Awesome, closing this for now. The bugfixes should come out in the stable release in the next week.