2020-01-10 20:41:13 -05:00
|
|
|
// Code generated by zenity; DO NOT EDIT.
|
|
|
|
// +build darwin
|
|
|
|
|
2020-01-19 06:57:05 -05:00
|
|
|
package zenutil
|
2020-01-10 20:41:13 -05:00
|
|
|
|
2020-01-21 07:03:58 -05:00
|
|
|
import "encoding/json"
|
|
|
|
import "text/template"
|
2020-01-10 20:41:13 -05:00
|
|
|
|
2020-01-21 07:03:58 -05:00
|
|
|
var scripts = template.Must(template.New("").Funcs(template.FuncMap{"json": func(v interface{}) (string, error) {
|
|
|
|
b, err := json.Marshal(v)
|
|
|
|
return string(b), err
|
|
|
|
}}).Parse(`
|
2020-12-11 12:33:30 -05:00
|
|
|
{{define "color" -}}
|
2021-02-19 12:46:47 -05:00
|
|
|
var app=Application.currentApplication()
|
|
|
|
app.includeStandardAdditions=true
|
2021-02-18 21:20:57 -05:00
|
|
|
app.activate()
|
2021-02-19 12:46:47 -05:00
|
|
|
var res=app.chooseColor({defaultColor:{{json .}}})
|
|
|
|
{"rgb("+res.map(x=>Math.round(x*255))+")"}
|
2020-01-21 07:03:58 -05:00
|
|
|
{{- end}}
|
2020-12-11 12:33:30 -05:00
|
|
|
{{define "file" -}}
|
2021-02-19 12:46:47 -05:00
|
|
|
var app=Application.currentApplication()
|
|
|
|
app.includeStandardAdditions=true
|
2020-01-10 20:41:13 -05:00
|
|
|
app.activate()
|
2021-03-03 11:05:11 -05:00
|
|
|
var res=app.{{.Operation}}({{json .Options}})
|
2021-02-19 12:46:47 -05:00
|
|
|
if(Array.isArray(res)){res.join({{json .Separator}})}else{res.toString()}
|
2020-01-21 07:03:58 -05:00
|
|
|
{{- end}}
|
2020-12-11 12:33:30 -05:00
|
|
|
{{define "msg" -}}
|
2021-02-19 12:46:47 -05:00
|
|
|
var app=Application.currentApplication()
|
|
|
|
app.includeStandardAdditions=true
|
2020-01-10 20:41:13 -05:00
|
|
|
app.activate()
|
2021-03-03 11:05:11 -05:00
|
|
|
var res=app.{{.Operation}}({{json .Text}},{{json .Options}})
|
2021-02-19 12:46:47 -05:00
|
|
|
if(res.gaveUp){ObjC.import("stdlib")
|
|
|
|
$.exit(5)}
|
2021-03-03 06:56:41 -05:00
|
|
|
if(res.buttonReturned==={{json .Extra}}){res.buttonReturned}else{void 0}
|
2020-01-26 11:04:49 -05:00
|
|
|
{{- end}}
|
2020-12-11 12:33:30 -05:00
|
|
|
{{define "notify" -}}
|
2021-02-19 12:46:47 -05:00
|
|
|
var app=Application.currentApplication()
|
|
|
|
app.includeStandardAdditions=true
|
|
|
|
void app.displayNotification({{json .Text}},{{json .Options}})
|
2020-01-21 07:03:58 -05:00
|
|
|
{{- end}}`))
|