Skip to content

Conversation

@naveenrajm7
Copy link
Contributor

@naveenrajm7 naveenrajm7 commented Dec 23, 2024

Fixes #6914

  • Allows to get/set built-in icons
    iconURL is URL in UTMConfig, but stored as string in config.plist, same is done for scripting interface.

Usage:

tell application "UTM"
  set vm to virtual machine named "OpenBSD"
  set config to configuration of vm
  set icon of config to "openbsd"
  update configuration of vm with config
end tell

Say hi to puffy!

For reference :
All available icons are in https://github.com/utmapp/UTM/tree/main/Icons
corresponding icon keys in

private let ICON_TITLE_MAP: [String: LocalizedStringKey] = [

* Allows to get/set built-in icons
iconURL is URL in UTMConfig, but stored as string in config.plist, same is done for scripting interface.
@naveenrajm7
Copy link
Contributor Author

naveenrajm7 commented Dec 23, 2024

For future :
If you want to allow custom icons through scripting,

  • Take icon as URL from scripting,
  • Expose isIconCustom field in config
  • Take care of sandbox permissions of the given icon file
  • Copy icon file to VM bundle, set URL in config accordingly
    ...

not worth the changes , to just update an icon to custom icon via script

@osy osy force-pushed the main branch 7 times, most recently from cde503b to c3e08c3 Compare February 21, 2025 06:28
@osy osy merged commit 51bc96d into utmapp:main Apr 7, 2025
27 checks passed
@naveenrajm7 naveenrajm7 deleted the icon branch April 13, 2025 21:51
@NothinRandom
Copy link

Hello,

What is the correct syntax to use a custom icon for scripting? I tried getting the icon file as POSIX file with this isIconCustom (assuming bool), but UTM throws error on invalid config

Thanks

@naveenrajm7
Copy link
Contributor Author

@NothinRandom as noted in the previous comment, I have NOT added support for using custom icon through scripting interface.
In order use an icon file outside UTM app sandbox you'd need to do complicated sandbox dance in the code to get that file inside the sandbox.

@NothinRandom
Copy link

@ naveenrajm7 Sorry, totally misinterpreted your message. Looking forward for this feature when it's available!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

scripting: add icon to config

3 participants