Safari Shortcut To Desktop?

betty02
New Contributor II

Hi Chaps,

Trying to create a DMG file to deploy that will install a safari shortcut to everyones desktop. Or possibly in the Applications folder, when I open composer and drag the Icon from my desktop in, it creates the folder

Users>Simon>Desktop>GreyConnect.webloc

Obviously not everyone will have a "Simon" user folder and I want it to go to theres, is there something like $username or something that will work and edit the folder named Simon?

Thanks

11 REPLIES 11

betty02
New Contributor II

Would this work?d7731d4c886644c2837bd32aaea75658

Josh_Smith
Contributor III

If you create a DMG as shown with Users>Simon>Desktop>GreyConnect.webloc and:

Deploy without FEU/FUT checked, you will get this on the target computer:

"/Users/Simon/Desktop/GreyConnect.webloc"

Deploy with FEU (Fill Existing Users) checked, you will get this on the target computer:

"/Users/*/Desktop/GreyConnect.webloc"

(installed in the Desktop folder for every user)

Deploy with FUT (Fill User Templates) checked, you will get this on the target computer:

"/System/Library/User Template/*/Desktop/GreyConnect.webloc"

(installed in all of the User templates, so any new user that logs in to the machine will get it)

So the username in the composer package doesn't really matter, though when I do those packages I like to use a generic "packaging" account. You can use FEU and FUT simultaneously if you want.

There is another option, using a package (PKG) that contains the file and a script to copy the files where they need to go in the user's directories.

mm2270
Legendary Contributor II

There's also going the completely scripted way, though this would only work for the logged in user and not on a global level for any future accounts.

#!/bin/bash

loggedInUser=$(stat -f%Su /dev/console)
loggedInUID=$(id -u "$loggedInUser")

/bin/launchctl asuser "$loggedInUID" sudo -iu "$loggedInUser" "/usr/bin/osascript << EOF
tell application "Finder"
set mySource to POSIX file "/Applications/Safari.app" as alias
make new alias to mySource at desktop
set name of result to "Safari"
end tell
EOF"

bentoms
Honored Contributor III
Honored Contributor III

@betty02 Create the DMG under an account that exists in the Macs, something like ladmin.

Casper will ASR to that location, then copy out to the other users homes.

mvu
Valued Contributor

We chose to put specific school related sites in their Dock instead of the Desktop.

You can use an AppleScript for this, export it as an app, put in your Applications folder, package, then push to users' Dock.

796e8e3da5d44344863a1f6353a2ede7
ae70665b49214b67889510232d154967

pmcgurn
New Contributor III

With FEU/FUT, do you need to run a package at reboot, when including it during imaging? I noticed that with FEU/FUT, it was still putting /user/pmcgurn/Desktop/file in the imaged Mac.

cbrewer
Valued Contributor II

Like @mm2270 I would consider doing this with a script. A script makes it easy to make changes or remove the shortcut in the future.

The following as a login script should accomplish the task.

#!/bin/bash

echo [InternetShortcut] > /Users/$3/Desktop/Test.url
echo URL=http://somewebsite.com >> /Users/$3/Desktop/Test.url
chown $3 /Users/$3/Desktop/Test.url

jon_snell
New Contributor

Hi,
The script works great, I was wondering if there was a way to change the icon as well in the script?
Thanks,
Jon

swallace
Contributor

Just wondering if anyone did figure out how to change the icon on the desktop to a specific image? Trying to get our new 1:1 students set up with a desktop link.

Tried the config profile and with web clips, but they can trash it and be done.

claudiogardini
Contributor

We are using this to adda Icon to URL Files. https://github.com/mklement0/fileicon

tjhall
Contributor III

@swallace We save the applescript as an application and then just swap out the .icns file (located in the resources folder).