go-toast

Send toast notifications in Windows
Log | Files | Refs | README | LICENSE

tmpl.go (946B)


      1 // Package tmpl wraps several templates that are used to generate notifications.
      2 //
      3 // The primary template describes the XML structure that the Windows Runtime expects
      4 // to consume. The powershell template describes a script that we can use to execute
      5 // the notification if the Windows Runtime is unavailable.
      6 //
      7 // For more information about the xml schema:
      8 // https://learn.microsoft.com/en-us/uwp/schemas/tiles/toastschema/schema-root
      9 package tmpl
     10 
     11 import (
     12 	_ "embed"
     13 	"text/template"
     14 )
     15 
     16 //go:embed xml.go.tmpl
     17 var xml string
     18 
     19 //go:embed powershell.go.tmpl
     20 var powershell string
     21 
     22 // XMLTemplate describes the XML content that the Windows Runtime uses to build
     23 // toast notifications.
     24 var XMLTemplate = template.Must(template.New("toast-xml").Parse(xml))
     25 
     26 // ScriptTemplate describes the Powershell script that will invoke a toast notification
     27 // given some XML.
     28 var ScriptTemplate = template.Must(template.New("script").Parse(powershell))