Closed WardsParadox closed 4 years ago
I am not so sure. The System Preferences UI doesn't expose those options any more. Can you describe your particular use case?
10.15 still shows the ability to set the machine to Stretch to Fill Screen, Center, Tile, Fit to Screen and Fill to Screen. Mostly what the keys in the first link I specified. You can also set the background color for the bars in a non-fitting wallpaper via the same gui.
When our machines are first bootstrapped for new staff, the default dock is set. We also set a default wallpaper, I'm currently doing this via pyobjc, but would love to be able to have a tool we can push down for it or for student machines when we do lab setups (combined with a generated wallpaper per machine). Relevant pyobjc code used:
file_url = NSURL.fileURLWithPath_(picture_path)
# make image options dictionary
NSWorkspaceDesktopImageScalingKey = u'NSWorkspaceDesktopImageScalingKey'
options = {}
options[NSWorkspaceDesktopImageScalingKey] = NSImageScaleAxesIndependently
options[NSWorkspaceDesktopImageAllowClippingKey] = True
# get shared workspace
ws = NSWorkspace.sharedWorkspace()
# iterate over all screens
for screen in NSScreen.screens():
# tell the workspace to set the desktop picture
(result, error) = ws.setDesktopImageURL_forScreen_options_error_(
file_url, screen, options, None)
I have to admit, the main reason I am reluctant is that it would make argument parsing, much harder. But I'd like to have it in there as well. I will think about this.
👍 I might learn me some swift to assist.
implemented in v0.3, please test!
testing today. Color is the hex value only right? No need for a pound/hashtag/number symbol right?
yes, just a six digit hex value
Thought color wasn't working for a bit there, but that was due to the image I was using not working as intended. Seems to work here 👍🏻 Thanks!
I think it would be great if desktoppr could also set the scaling keys when setting the desktop.
NSWorkspace has support for the scaling the images: https://developer.apple.com/documentation/appkit/nsworkspace/1527228-setdesktopimageurl https://developer.apple.com/documentation/appkit/nsworkspace/desktopimageoptionkey https://developer.apple.com/documentation/appkit/nsimagescaling