dockutil on 10.14

KyleEricson
Valued Contributor II

Maybe this isn't fully supported, but the icon for the user's downloads doesn't seem to work with dockutil on macOS 10.14. It's just showing as a question mark. If I right click this icon and change it to a Stack then back to Folder the icon then works.

Full script:

#!/bin/bash

echo "running dockutil"
DOCKUTIL=/usr/local/bin/dockutil
loggedInUser=$(python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "
");')

echo "remove default apps"
# remove default apps 
$DOCKUTIL --remove all --no-restart --allhomes
echo "adding to dock"
# add items to dock
$DOCKUTIL --add /Applications/Google Chrome.app --position 1 --no-restart --allhomes
$DOCKUTIL --add /Applications/zoom.us.app --after "Google Chrome" --no-restart --allhomes
$DOCKUTIL --add /Applications/Slack.app --after zoom.us --no-restart --allhomes
$DOCKUTIL --add /Applications/Self Service.app --after Slack --no-restart --allhomes
$DOCKUTIL --add '/Applications/System Preferences.app' --after "Slack" --no-restart --allhomes

$DOCKUTIL --add '/Applications' --view grid --display folder --sort name  --section others --position 1 --allhomes
$DOCKUTIL --add '~/Downloads' --view list --display folder --sort dateadded --section others --position end --allhomes

exit 0
Read My Blog: https://www.ericsontech.com
7 REPLIES 7

gregdeichler
New Contributor II

Are you missing a --no-restart on the Applications folder?

donmontalvo
Esteemed Contributor III

Might want to post here...https://github.com/kcrawford/dockutil/issues

--
https://donmontalvo.com

KyleEricson
Valued Contributor II

@gregdeichler That folder seems to be working fine. The downloads is the issue.

Read My Blog: https://www.ericsontech.com

KyleEricson
Valued Contributor II

I opened an issue on the github page.

Read My Blog: https://www.ericsontech.com

ryan_ball
Valued Contributor

Maybe the downloads folder is not working because that command is occurring as the dock is being restarted, due to the dock being restarted immediately after the /Applications folder is set (missing --no-restart in that line). Maybe you can do a --no-restart at the end of all of the dockutil lines and just do a killall Dock at the end.

claudiogardini
Contributor

I guess the issue is due you trying to apply to all Homes. Here is what we are using.

#!/bin/bash

    currentuser=$(python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "
");')
    dockutil="/usr/local/bin/dockutil"


        # Remove all
        su -l "${currentuser}" -c "${dockutil} --remove all --no-restart"


        # Add applications
        su -l "${currentuser}" -c "${dockutil} --add '/Applications/Safari.app' --no-restart"
        su -l "${currentuser}" -c "${dockutil} --add '/Applications/Firefox.app' --no-restart"


        # Add folders
        su -l "${currentuser}" -c "${dockutil} --add '/Applications/Lernprogramme/ Lernprogramme starten' --view grid --display folder --no-restart"
        su -l "${currentuser}" -c "${dockutil} --add '/Applications' --view grid --display folder --no-restart"
        su -l "${currentuser}" -c "${dockutil} --add '~/Downloads' --view grid --display folder --no-restart"

        # Kill dock
        su -l "${currentuser}" -c "killall Dock"


exit 0

KyleEricson
Valued Contributor II

@claudiogardini I tried your script and it didn't do anything. I did change mine with the --no-restart option and that seemed to fix my issue.

Read My Blog: https://www.ericsontech.com