Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
scriptingosx committed Jul 5, 2024
1 parent 3ffd164 commit 9c2851c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 35 deletions.
32 changes: 24 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ A simple command line tool which can read and set the desktop picture/wallpaper.

Note: Apple used to call the macOS background image 'desktop picture' until macOS 13 Ventura, when they changed to be the same as in iOS: 'wallpaper'. This documentation might use either term.

## Getting the current desktop picture/wallpaper
I have written a few blog posts that describe different use strategies for setting a desktop picture:

- [Using desktoppr in a managed environment](https://scriptingosx.com/2024/01/using-desktoppr-in-a-managed-environment/)
- [Strategies to using desktoppr](https://scriptingosx.com/2020/03/strategies-to-using-desktoppr/)
- [Random Desktop Background with desktoppr](https://scriptingosx.com/2020/04/random-desktop-background-color-with-desktoppr/)

## Getting and setting the current desktop picture/wallpaper

You can read the current desktop picture/wallpaper with:

Expand Down Expand Up @@ -66,8 +72,22 @@ $ desktoppr color FFFFFF # white background
$ desktoppr color FF0000 # red background
```

Setting the wallpaper, scale and/or color are separate commands.

Note: setting the background color does not work in macOS 14.x. See [issue #22](https://github.com/scriptingosx/desktoppr/issues/22).

## Downloading the wallpaper image file

When you give a URL to an image file as the argument, `desktoppr` will download the file from the URL and set it as the wallpaper.

```
$ desktoppr https://raw.githubusercontent.com/scriptingosx/desktoppr/profile/examples/BoringBlueDesktop.png
```

The downloaded file will be stored in `~/Lubrary/Application Support/desktoppr/`.

When the download fails, the wallpaper will not be changed. If the downloaded file is not an image file, the wallpaper will revert to the system default.

## desktoppr in scripts

When you want to run it from a script it is safest to include the entire path to the binary:
Expand All @@ -76,15 +96,15 @@ When you want to run it from a script it is safest to include the entire path to
/usr/local/bin/desktoppr "/Library/Desktop Pictures/BoringBlueDesktop.png"
```

Since the `desktoppr` tool also sets user preferences, you still need to pay attention that it runs as the user. A LaunchAgent or a solution like [`outset`](https://github.com/macadmins/outset) is a good choice to manage this. Alternatively, you can [run the command as the current user from a root script](https://scriptingosx.com/2020/08/running-a-command-as-another-user/).
Since the `desktoppr` tool sets user preferences, you still need to pay attention that it runs as the user. A LaunchAgent or a solution like [`outset`](https://github.com/macadmins/outset) is a good choice to manage this. Alternatively, you can [run the command as the current user from a root script](https://scriptingosx.com/2020/08/running-a-command-as-another-user/).

## Managing the desktop picture/wallpaper with desktoppr
## Managing the desktop picture/wallpaper with a profile

When you run `desktoppr` with the `manage` verb, it will read the settings from the `com.scriptingosx.desktoppr` preference domain. You can set these settings with the `defaults` command or, preferably, by pushing a configuration profile from an MDM server.

The idea is to run `desktoppr manage` with a LaunchAgent plist at login and/or at regular intervals. You can find [a sample LaunchAgent plist here](examples/com.scriptingosx.desktopprmanage.plist). The sample LaunchAgent will run `desktoppr manage` at login and every three hours (10800 sec). You can build a pkg that installs the desktoppr binary, the LaunchAgent plist and an image file very early in the deployment workflow and then desktoppr sets the desktop background when the user reaches the desktop for the first time.

For Ventura and higher, binaries and applications run by LaunchAgents need to be approved with a `com.apple.servicemanagement` profile so they appear as managed in the login items section in Settings.app. The above sample configuration profile contains those settings, as well.
For Ventura and higher, binaries and applications run by LaunchAgents need to be approved with a `com.apple.servicemanagement` profile so they appear as managed in the login items section in Settings.app. The [sample configuration profile](examples/desktoppr-profile.mobileconfig) contains those settings, as well.


desktoppr uses the following keys:
Expand Down Expand Up @@ -123,7 +143,3 @@ You can get the code for `desktoppr` on my Github page and an installer in the [

The tool requires the [Swift 5 Runtime support for command line tools](https://support.apple.com/kb/DL1998) when you install it on versions of macOS older than 10.14.4.

I have written a few blog posts that describe different use strategies for setting a desktop picture:

- [Strategies to using desktoppr](https://scriptingosx.com/2020/03/strategies-to-using-desktoppr/)
- [Random Desktop Background with desktoppr](https://scriptingosx.com/2020/04/random-desktop-background-color-with-desktoppr/)
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "345"
endingLineNumber = "345"
offsetFromSymbolStart = "232">
endingLineNumber = "345">
</Location>
<Location
uuid = "74C037D7-5214-4A62-9249-8729604D9C18 - 455c40f3868536c"
Expand All @@ -55,8 +54,7 @@
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "349"
endingLineNumber = "349"
offsetFromSymbolStart = "220">
endingLineNumber = "349">
</Location>
<Location
uuid = "74C037D7-5214-4A62-9249-8729604D9C18 - 455c40f38685cc1"
Expand All @@ -70,8 +68,7 @@
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "352"
endingLineNumber = "352"
offsetFromSymbolStart = "144">
endingLineNumber = "352">
</Location>
<Location
uuid = "74C037D7-5214-4A62-9249-8729604D9C18 - 455c40f38685abc"
Expand All @@ -85,8 +82,7 @@
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "397"
endingLineNumber = "397"
offsetFromSymbolStart = "144">
endingLineNumber = "397">
</Location>
</Locations>
</BreakpointContent>
Expand Down Expand Up @@ -127,8 +123,7 @@
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "422"
endingLineNumber = "422"
offsetFromSymbolStart = "2192">
endingLineNumber = "422">
</Location>
<Location
uuid = "00F01AF3-67C9-4A47-95C5-27F8E0A28975 - 2435d98e164b72bf"
Expand All @@ -142,8 +137,7 @@
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "434"
endingLineNumber = "434"
offsetFromSymbolStart = "3232">
endingLineNumber = "434">
</Location>
<Location
uuid = "00F01AF3-67C9-4A47-95C5-27F8E0A28975 - 2435d98e164b72fd"
Expand All @@ -157,8 +151,7 @@
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "432"
endingLineNumber = "432"
offsetFromSymbolStart = "3232">
endingLineNumber = "432">
</Location>
<Location
uuid = "00F01AF3-67C9-4A47-95C5-27F8E0A28975 - 2435d98e164b74c2"
Expand All @@ -172,8 +165,7 @@
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "447"
endingLineNumber = "447"
offsetFromSymbolStart = "3232">
endingLineNumber = "447">
</Location>
<Location
uuid = "00F01AF3-67C9-4A47-95C5-27F8E0A28975 - 2435d98e164b74ed"
Expand All @@ -187,8 +179,7 @@
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "448"
endingLineNumber = "448"
offsetFromSymbolStart = "3232">
endingLineNumber = "448">
</Location>
<Location
uuid = "00F01AF3-67C9-4A47-95C5-27F8E0A28975 - 2435d98e164b74ed"
Expand All @@ -202,8 +193,7 @@
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "448"
endingLineNumber = "448"
offsetFromSymbolStart = "3604">
endingLineNumber = "448">
</Location>
</Locations>
</BreakpointContent>
Expand Down Expand Up @@ -244,8 +234,7 @@
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "252"
endingLineNumber = "252"
offsetFromSymbolStart = "348">
endingLineNumber = "252">
</Location>
<Location
uuid = "4A7655CB-6B39-4D7C-BD1B-01A35BE6DAD7 - dda99766c886326e"
Expand All @@ -259,8 +248,7 @@
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "267"
endingLineNumber = "267"
offsetFromSymbolStart = "348">
endingLineNumber = "267">
</Location>
<Location
uuid = "4A7655CB-6B39-4D7C-BD1B-01A35BE6DAD7 - dda99766c8863289"
Expand All @@ -274,8 +262,7 @@
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "268"
endingLineNumber = "268"
offsetFromSymbolStart = "348">
endingLineNumber = "268">
</Location>
</Locations>
</BreakpointContent>
Expand Down
2 changes: 1 addition & 1 deletion examples/desktoppr-profile.mobileconfig
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<string>3333FF</string>
<key>scale</key>
<string>stretch</string>
<key>sha1</key>
<key>sha256</key>
<string>e2ce5c6be03aff820b36ba1be5dde785d0dbffb188685aae99e0b3d680c56df4</string>
</dict>
</dict>
Expand Down

0 comments on commit 9c2851c

Please sign in to comment.