• Stars
    star
    285
  • Rank 145,115 (Top 3 %)
  • Language
    Swift
  • License
    Apache License 2.0
  • Created about 6 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Simple command line tool to set the desktop picture on macOS

Here comes the desktoppr!

Β Β Β 

I wrote a simple command line tool which can read and set the desktop picture. Neil Martin had the brilliant idea to call it desktoppr.

You can read the current desktop picture with:

$ desktoppr
/Library/Desktop Pictures/Sierra.jpg

and set the desktop picture with

$ desktoppr "/Library/Desktop Pictures/BoringBlueDesktop.png"

When you have multiple displays, desktoppr will list all desktop pictures:

$ desktoppr
/Library/Desktop Pictures/HotStepper.jpg
/Library/Desktop Pictures/LyricalGangster.jpg
/Library/Desktop Pictures/MrOfficer.jpg

When you pass a file desktoppr will set it as the desktop picture for all screens:

$ desktoppr /Library/Desktop Pictures/NaahNananah.jpg
$ desktoppr
/Library/Desktop Pictures/NaahNananah.jpg
/Library/Desktop Pictures/NaahNananah.jpg
/Library/Desktop Pictures/NaahNananah.jpg

You can also set the desktop for a specific screen: (index starts at zero)

$ desktoppr 0 /Library/Desktop Pictures/HotStepper.jpg
$ desktoppr 1 /Library/Desktop Pictures/LyricalGangster.jpg
$ desktoppr 2 /Library/Desktop Pictures/MrOfficer.jpg

You can get the code for desktoppr on my Github page and an installer here. The installer pkg will install the tool in /usr/local/bin. Alternatively, a brew casks exists, so you could install it using brew cask install desktoppr if you have Homebrew installed.

When you want to run it from a management script it is safest to include the entire path:

/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 is a good choice to manage this. Alternatively, you can run the command as the current user from a root script.

The tool requires the Swift 5 Runtime support for command line tools 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:

More Repositories

1

DownloadFullInstaller

macOS application written in SwiftUI that downloads installer pkgs for the Install macOS Big Sur application.
Swift
789
star
2

quickpkg

wrapper for pkgbuild to quickly build simple packages from an installed app, a dmg or zip archive.
Shell
253
star
3

mac-zsh-completions

macOS specific additional completion definitions for Zsh.
Shell
183
star
4

fetch-installer-pkg

A tool to download the a pkg installer for the Install macOS Big Sur app from Apple's softwareupdate servers
Python
166
star
5

diskspace

macOS command line tool to return the available disk space on APFS volumes
Swift
158
star
6

pkgcheck

Script to check installer pkgs for deprecated runtime calls
Shell
97
star
7

PrefsTool

Python
66
star
8

ScriptPackages

Sample scripts to build some simple macOS installer pkgs
Shell
31
star
9

PackagesForAppleAdministrators

Resources and Scripts for the iBook: Packages for Apple Administrators
Shell
31
star
10

swift-prefs

Some tools to work with macOS preferences/defaults/settings
Swift
31
star
11

profiletool

A tool to help manipulate macOS configuration profiles
Python
27
star
12

PR3ForAppleAdmins

Resources and example files for the Book "Property Lists, Preferences and Profiles for Apple Administrators"
Python
24
star
13

GNU-bash-mac-installer

Downloads and builds a Mac package installer for GNU bash 5
Shell
23
star
14

dotfiles

repository for my profile files
Shell
23
star
15

AutomationForAdmins

Python
16
star
16

RemindersCLITool

A command line tool to access OS X's Reminders application.
AppleScript
13
star
17

ThingsCLITool

Command line tool for Things GTD app
AppleScript
13
star
18

BuildShellcheckPkg

Script to build the shellcheck binary and a macOS installer pkg
Shell
11
star
19

terminalAndShellBookResources

Resources for the Book "macOS Terminal and shell"
10
star
20

SwiftAPITutorial

Sample code for my Swift Jamf API tutorial
Swift
10
star
21

CustomToolPathInstaller

Shell
10
star
22

SayThis-SwiftUI

Sample Code for my "Build a macOS Application to Run a Shell Command with Xcode and SwiftUI)"
Swift
9
star
23

ManageMacs

A wiki for Mac Sysadmins
8
star
24

AlphabetUserPicture

Shell
7
star
25

colortool

Swift
6
star
26

recipeutil

a tool to help manipulate recipes for autopkg
Python
6
star
27

SayThis-AppKit

Sample for my Xcode for Apple Admins articles here: http://scriptingosx.com/2016/04/build-an-application-to-run-a-shell-command-in-xcode-and-swift-part-1/ and here: http://scriptingosx.com/2016/05/build-an-application-to-run-a-shell-command-in-xcode-and-swift-part-2/
Swift
6
star
28

InstallerPATH

Shell
5
star
29

plaid

Swift
3
star
30

MunkiScripts

A collection of useful scripts for Munki.
3
star
31

swift-prf

Sample code for "Build a notarized package with a Swift Package Manager executable"
Shell
2
star
32

MSA-Demo-Chooser

This is the source code for my sample project in my MacSysAdmin Conference 2021 presentation.
Swift
2
star
33

PackagesForAppleAdmins

2
star
34

autopkg_recipes

Please note this repository has moved! go to autopkg/scriptingosx instead!
Python
2
star
35

autopkg_processors

Python
1
star