Handle invalid window ids (macOS).
This commit is contained in:
parent
c1b80b310e
commit
1c43756a6c
4 changed files with 12 additions and 11 deletions
2
go.mod
2
go.mod
|
@ -9,7 +9,7 @@ require (
|
|||
github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844
|
||||
go.uber.org/goleak v1.1.12 // test
|
||||
golang.org/x/image v0.0.0-20220617043117-41969df76e82
|
||||
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c
|
||||
golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b
|
||||
)
|
||||
|
||||
require (
|
||||
|
|
4
go.sum
4
go.sum
|
@ -42,8 +42,8 @@ golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7w
|
|||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c h1:aFV+BgZ4svzjfabn8ERpuB4JI4N6/rdy1iusx77G3oU=
|
||||
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b h1:2n253B2r0pYSmEV+UNCQoPfU/FiaizQEK5Gu4Bq4JE8=
|
||||
golang.org/x/sys v0.0.0-20220627191245-f75cf1eec38b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
|
|
|
@ -24,17 +24,16 @@ $.exit(-1)}
|
|||
{{- end}}
|
||||
{{define "common" -}}
|
||||
{{- if .Application}}
|
||||
var app=Application({{json .Application}})
|
||||
try{var app=Application({{json .Application}})}catch{var app=Application.currentApplication()}
|
||||
{{- else}}
|
||||
var app=Application.currentApplication()
|
||||
{{- end}}
|
||||
app.includeStandardAdditions=true
|
||||
{{if .WindowIcon}}{ObjC.import('Cocoa')
|
||||
let nsapp=$.NSApplication.sharedApplication
|
||||
let nsimg=$.NSImage.alloc.initWithContentsOfFile({{json .WindowIcon}})
|
||||
nsapp.setActivationPolicy($.NSApplicationActivationPolicyRegular)
|
||||
nsapp.setApplicationIconImage(nsimg)}{{end}}
|
||||
app.includeStandardAdditions=true
|
||||
app.activate()
|
||||
{{- end}}
|
||||
{{define "date" -}}
|
||||
ObjC.import('Cocoa')
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
{{- if .Application}}
|
||||
var app = Application({{json .Application}})
|
||||
try {
|
||||
var app = Application({{json .Application}})
|
||||
} catch {
|
||||
var app = Application.currentApplication()
|
||||
}
|
||||
{{- else}}
|
||||
var app = Application.currentApplication()
|
||||
{{- end}}
|
||||
app.includeStandardAdditions = true
|
||||
|
||||
{{if .WindowIcon}}{
|
||||
ObjC.import('Cocoa')
|
||||
|
@ -10,7 +15,4 @@
|
|||
let nsimg = $.NSImage.alloc.initWithContentsOfFile({{json .WindowIcon}})
|
||||
nsapp.setActivationPolicy($.NSApplicationActivationPolicyRegular)
|
||||
nsapp.setApplicationIconImage(nsimg)
|
||||
}{{end}}
|
||||
|
||||
app.includeStandardAdditions = true
|
||||
app.activate()
|
||||
}{{end}}
|
Loading…
Reference in a new issue