node.jselectronappkiticns

Render NSImageNameComputer in Electron


According to this Apple documentation, you can use NSImageNameComputer in Swift to get an icon showing the current Mac. Is there any way to use this icon in my Electron app front end?


Solution

  • The solution is to import nativeImage from Electron, then you can do:

    nativeImage.createFromNamedImage("NSComputer")
    

    Then you can use other nativeImage methods to get the picture into a format you can use.

    The issue with this, however, is that it's really low-res (32x32) which I haven't been able to fix.