kcrawford / dockutil

command line tool for managing dock items
http://patternbuffer.wordpress.com
Apache License 2.0
1.36k stars 131 forks source link

Inconsistent Adding Items to Dock #147

Closed bsteinbach112 closed 8 months ago

bsteinbach112 commented 1 year ago

I've been using DockUtil in Ventura (13.2.1) and have had inconsistent loading of items to the dock. 50% of the time the items correctly add themselves to the dock, but the other 50% of the time the dock will have no items or only one of the items. Can you see if there is something I might be doing incorrectly? I've had no issues clearing the dock using the following script. This is part of a larger computer reset script that I've created. It probably isn't the most efficient, but all other aspects of the script work correctly so I'd prefer not to change it. Rerunning the whole script 1-2 times seems to end up fixing whatever issue is causing DockUtil to not work.

reset Dock

tell application "Terminal" do script "dockutil --remove all" delay 3 quit end tell

tell application "Terminal" do script "dockutil --add /System/Applications/Launchpad.app --no-restart" do script "dockutil --add /Applications/Google\ Chrome.app --no-restart" in window 1 do script "dockutil --add '~/Downloads' --view grid --display folder --no-restart" in window 1 do script "defaults write com.apple.dock show-recents -bool FALSE" do script "killall Dock" delay 3 quit end tell

kcrawford commented 1 year ago

I’d only restart/kill the dock once after all charges.  You are are restarting it in the remove.KyleSent from MobileOn Mar 10, 2023, at 10:57 AM, bsteinbach112 @.***> wrote: I've been using DockUtil in Ventura (13.2.1) and have had inconsistent loading of items to the dock. 50% of the time the items correctly add themselves to the dock, but the other 50% of the time the dock will have no items or only one of the items. Can you see if there is something I might be doing incorrectly? I've had no issues clearing the dock using the following script. This is part of a larger computer reset script that I've created. It probably isn't the most efficient, but all other aspects of the script work correctly so I'd prefer not to change it. Rerunning the whole script 1-2 times seems to end up fixing whatever issue is causing DockUtil to not work.

reset Dock

tell application "Terminal" do script "dockutil --remove all" delay 3 quit end tell tell application "Terminal" do script "dockutil --add /System/Applications/Launchpad.app --no-restart" do script "dockutil --add /Applications/Google\ Chrome.app --no-restart" in window 1 do script "dockutil --add '~/Downloads' --view grid --display folder --no-restart" in window 1 do script "defaults write com.apple.dock show-recents -bool FALSE" do script "killall Dock" delay 3 quit end tell

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

mvught commented 1 year ago

Do you use outset to run it once after fist reboot? That is the best way to work with your script. Give it try and let us know

bsteinbach112 commented 1 year ago

@mvught I don't use outset because this script is run once per school quarter. Outset doesn't seem like it fits my needs. Maybe I'm wrong?

@kcrawford Thanks. I've updated the script to this. It seemed like I still needed a delay between removing everything from the dock and adding new items back:

#reset Dock tell application "Terminal" do script "dockutil --remove all --no-restart" delay 3 do script "dockutil --add /System/Applications/Launchpad.app --no-restart" in window 1 do script "dockutil --add /Applications/Google\ Chrome.app --no-restart" in window 1 do script "dockutil --add '~/Downloads' --view grid --display folder --no-restart" in window 1 do script "defaults write com.apple.dock show-recents -bool FALSE" do script "killall Dock" delay 3 quit end tell

kcrawford commented 8 months ago

Closing this issue. I am not needing the delay on Sonoma with latest dockutil.