Finder settings

gadsden_flag
New Contributor III

I try to manage the settings of my clients Finder. I found a way to put a plist into a profile. It looks nice but cannot be modified by the user later on. So I’m looking for a way to set some defaults but let the user modify it if he or she likes.
The same with the dock. I prefer to set up the dock but the user should be able to add new items and get rid of some others.

Every hint I found is with older versions but none of them works on Big Sur.

Please help. I don’t think I’m alone with this issue.

BTW. I’m very new with JAMF, so be kind with a newbie. Thanks.

2 ACCEPTED SOLUTIONS

mm2270
Legendary Contributor III

As I mentioned above, you should consider using Dockutil for managing Dock items as it has much more functionality and flexibility around adding/removing Dock items.

As for adding stuff into the sidebar, good luck to you is all I can say. There's no easy way to do this. You're correct that sfltool doesn't work anymore. The bottom line is, even if they don't publicly admit it, Apple doesn't want us Mac admins messing with peoples Finder sidebars, and a few other hard to manage items. They've made it purposely difficult to control these.

Wish I could offer more, but a lot of us gave up on trying to add/remove items from the Sidebar a while ago because it has become nearly impossible to do, and frankly, isn't worth the time to do now.

View solution in original post

gadsden_flag
New Contributor III

At the end I go with this:

Installing outset and docklib

And then install this script

#!/bin/bash
default_dock_once="/usr/local/outset/login-once/default_dock_once.py"

#rm -rf "${default_dock_once}"

cat >"${default_dock_once}" <<EOF
#!/usr/bin/python

import os
from docklib import Dock

dock_apps = [
	"/System/Applications/System Preferences.app",
	"/Applications/Self Service.app",
	"/Applications/Google Chrome.app",
	"/Applications/MacPass.app",
	"/System/Applications/Notes.app",   
	"/Applications/Microsoft Word.app",
	"/Applications/Microsoft Excel.app",
	"/Applications/pascom Client.app",
	"/Applications/Microsoft Remote Desktop.app",
	"/Applications/HIN Talk.app",
    "/Applications/HIN Talk 2.app",
	"/Applications/HIN Client.app",
]

dock = Dock()

dock.items["persistent-apps"] = []
dock.items["persistent-others"] = []

dock.tilesize = 60

dock.show_recents = False

dock.items["persistent-apps"] = [
	dock.makeDockAppEntry(item) for item in dock_apps if os.path.exists(item)
]

if dock.findExistingLabel("Downloads", section="persistent-others") == -1:
	item = dock.makeDockOtherEntry(
		os.path.expanduser("~/Downloads"), arrangement=2, displayas=1, showas=1
	)
	dock.items["persistent-others"] = [item] + dock.items["persistent-others"]

if dock.findExistingLabel("Dokumente", section="persistent-others") == -1:
	item = dock.makeDockOtherEntry(
		os.path.expanduser("~/Documents"), arrangement=3, displayas=1, showas=2
	)
	dock.items["persistent-others"] = [item] + dock.items["persistent-others"]

dock.save()
EOF

chmod +x "${default_dock_once}"

For Finder settings I use this script

#!/bin/bash

#Finds current username and defines a variable
currentuser=`stat -f "%Su" /dev/console`

#Substituting as user stored in variable to modify plist
#su "$currentuser" -c "<command to run>"

#Turns on show Hard Disks, External disks, CDs, DVDs, and iPads, and Connected Servers

su "$currentuser" -c "defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true;"

su "$currentuser" -c "defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true;"

su "$currentuser" -c "defaults write com.apple.finder ShowMountedServersOnDesktop -bool true;"

su "$currentuser" -c "defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true;"

#Shows Status Bar

su "$currentuser" -c "defaults write com.apple.finder ShowStatusBar -bool true;"

#Shows Tab View

su "$currentuser" -c "defaults write com.apple.finder ShowTabView -bool true;"

#Shows Path Bar

su "$currentuser" -c "defaults write com.apple.finder ShowPathbar -bool true;"

#Changes Finder to List View
#Four-letter codes for the other view modes: 'icnv', 'clmv', 'Flwv'

su "$currentuser" -c "defaults write com.apple.finder FXPreferredViewStyle -string 'clmv'"

#New Finder windows now opens in /Users/<username>

su "$currentuser" -c "defaults write com.apple.finder NewWindowTarget -string 'PfHm'"

#Turns off re-open programs/windows after restart/login/shutdown

su "$currentuser" -c "defaults write com.apple.loginwindow.plist TALLogoutSavesState -bool false"


#Restarts cfprefsd and Finder

killAll cfprefsd
killAll Finder

echo "Finder Preferences set"

exit 0

 

View solution in original post

7 REPLIES 7

jcarr
Release Candidate Programs Tester

I hate to sound preachy, but I think this is a very old-school "IT must manage everything" mentality.  I think the trend recently has to be to NOT manage any user specific settings (e.g. Finder prefs, Dock, general look & feel).  Stick to functional stuff that is usually system wide (e.g. ability to bypass Gatekeeper, network settings, app installs).  Users are generally perfectly able to configure their settings to their own liking.  Additionally, when they can set the look and feel to their liking, they usually have a better sense of ownership and will take better care of the device.

 

Just my $0.02.

mm2270
Legendary Contributor III

In general I would agree with @jcarr Unless there is some actual need to do this for a compliance reason or the like, I would just leave Finder settings alone.

If you really must modify them, I'd recommend trying to script it and have the script run as the logged in user via policy or a LaunchAgent or something like that. Trying to manage it in a profile, as you've already discovered, is not going to pan out well since it forces the setting into a locked state.

By scripting it it essentially makes it into an "apply once" type setting that the user can then modify to their own liking.

As for the Dock, do some searches here for "dockutil". You should find discussions here on how to deploy and use that utility to set up the Dock one time and not make it immutable.

gadsden_flag
New Contributor III

Yes, I would agree with @jcarr also, but I have to accomplish the company’s compliance. 
The idea is actually “apply once”. I found a script to manage some finder settings but unfortunately the sfltool doesn’t work as expected, the favorites in the sidebar stay untouched. I also have no luck to add some favorites to the “Go to Server” section.

I think for configuring the dock, the built-in feature is good enough but it’s not possible to add folders (i.e. Documents and Downloads); no relative paths nor absolute paths work.

Any help here? Thanks.

mm2270
Legendary Contributor III

As I mentioned above, you should consider using Dockutil for managing Dock items as it has much more functionality and flexibility around adding/removing Dock items.

As for adding stuff into the sidebar, good luck to you is all I can say. There's no easy way to do this. You're correct that sfltool doesn't work anymore. The bottom line is, even if they don't publicly admit it, Apple doesn't want us Mac admins messing with peoples Finder sidebars, and a few other hard to manage items. They've made it purposely difficult to control these.

Wish I could offer more, but a lot of us gave up on trying to add/remove items from the Sidebar a while ago because it has become nearly impossible to do, and frankly, isn't worth the time to do now.

gadsden_flag
New Contributor III

I found another “solution”: I created a profile with Finder and Dock settings, apply it manually to the Mac and remove the profile right after the right settings are applied. 😉

Would you mind sharing the profile for finder or point us in the right direction please? 

gadsden_flag
New Contributor III

At the end I go with this:

Installing outset and docklib

And then install this script

#!/bin/bash
default_dock_once="/usr/local/outset/login-once/default_dock_once.py"

#rm -rf "${default_dock_once}"

cat >"${default_dock_once}" <<EOF
#!/usr/bin/python

import os
from docklib import Dock

dock_apps = [
	"/System/Applications/System Preferences.app",
	"/Applications/Self Service.app",
	"/Applications/Google Chrome.app",
	"/Applications/MacPass.app",
	"/System/Applications/Notes.app",   
	"/Applications/Microsoft Word.app",
	"/Applications/Microsoft Excel.app",
	"/Applications/pascom Client.app",
	"/Applications/Microsoft Remote Desktop.app",
	"/Applications/HIN Talk.app",
    "/Applications/HIN Talk 2.app",
	"/Applications/HIN Client.app",
]

dock = Dock()

dock.items["persistent-apps"] = []
dock.items["persistent-others"] = []

dock.tilesize = 60

dock.show_recents = False

dock.items["persistent-apps"] = [
	dock.makeDockAppEntry(item) for item in dock_apps if os.path.exists(item)
]

if dock.findExistingLabel("Downloads", section="persistent-others") == -1:
	item = dock.makeDockOtherEntry(
		os.path.expanduser("~/Downloads"), arrangement=2, displayas=1, showas=1
	)
	dock.items["persistent-others"] = [item] + dock.items["persistent-others"]

if dock.findExistingLabel("Dokumente", section="persistent-others") == -1:
	item = dock.makeDockOtherEntry(
		os.path.expanduser("~/Documents"), arrangement=3, displayas=1, showas=2
	)
	dock.items["persistent-others"] = [item] + dock.items["persistent-others"]

dock.save()
EOF

chmod +x "${default_dock_once}"

For Finder settings I use this script

#!/bin/bash

#Finds current username and defines a variable
currentuser=`stat -f "%Su" /dev/console`

#Substituting as user stored in variable to modify plist
#su "$currentuser" -c "<command to run>"

#Turns on show Hard Disks, External disks, CDs, DVDs, and iPads, and Connected Servers

su "$currentuser" -c "defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true;"

su "$currentuser" -c "defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true;"

su "$currentuser" -c "defaults write com.apple.finder ShowMountedServersOnDesktop -bool true;"

su "$currentuser" -c "defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true;"

#Shows Status Bar

su "$currentuser" -c "defaults write com.apple.finder ShowStatusBar -bool true;"

#Shows Tab View

su "$currentuser" -c "defaults write com.apple.finder ShowTabView -bool true;"

#Shows Path Bar

su "$currentuser" -c "defaults write com.apple.finder ShowPathbar -bool true;"

#Changes Finder to List View
#Four-letter codes for the other view modes: 'icnv', 'clmv', 'Flwv'

su "$currentuser" -c "defaults write com.apple.finder FXPreferredViewStyle -string 'clmv'"

#New Finder windows now opens in /Users/<username>

su "$currentuser" -c "defaults write com.apple.finder NewWindowTarget -string 'PfHm'"

#Turns off re-open programs/windows after restart/login/shutdown

su "$currentuser" -c "defaults write com.apple.loginwindow.plist TALLogoutSavesState -bool false"


#Restarts cfprefsd and Finder

killAll cfprefsd
killAll Finder

echo "Finder Preferences set"

exit 0