Fixes focus issues, see #40.
This commit is contained in:
parent
ec524fa57e
commit
13c7dd3112
5 changed files with 19 additions and 19 deletions
|
@ -25,9 +25,6 @@ func calendar(text string, opts options) (t time.Time, err error) {
|
||||||
} else {
|
} else {
|
||||||
data.Text = text
|
data.Text = text
|
||||||
}
|
}
|
||||||
if opts.attach != nil {
|
|
||||||
data.Application = opts.attach
|
|
||||||
}
|
|
||||||
if i, ok := opts.windowIcon.(string); ok {
|
if i, ok := opts.windowIcon.(string); ok {
|
||||||
data.WindowIcon = i
|
data.WindowIcon = i
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,23 +23,26 @@ $.exit(-1)}
|
||||||
{'rgb('+res.map(x=>Math.round(x*255))+')'}
|
{'rgb('+res.map(x=>Math.round(x*255))+')'}
|
||||||
{{- end}}
|
{{- end}}
|
||||||
{{define "common" -}}
|
{{define "common" -}}
|
||||||
|
{{if .WindowIcon}}{ObjC.import('Cocoa')
|
||||||
|
let nsapp=$.NSApplication.sharedApplication
|
||||||
|
let nsimg=$.NSImage.alloc.initWithContentsOfFile({{json .WindowIcon}})
|
||||||
|
nsapp.setActivationPolicy($.NSApplicationActivationPolicyRegular)
|
||||||
|
nsapp.setApplicationIconImage(nsimg)}{{end}}
|
||||||
{{- if .Application}}
|
{{- if .Application}}
|
||||||
try{var app=Application({{json .Application}})}catch{var app=Application.currentApplication()}
|
try{var app=Application({{json .Application}})}catch{var app=Application.currentApplication()}
|
||||||
{{- else}}
|
{{- else}}
|
||||||
var app=Application.currentApplication()
|
var app=Application.currentApplication()
|
||||||
{{- end}}
|
{{- end}}
|
||||||
app.includeStandardAdditions=true
|
app.includeStandardAdditions=true
|
||||||
{{if .WindowIcon}}{ObjC.import('Cocoa')
|
app.activate()
|
||||||
let nsapp=$.NSApplication.sharedApplication
|
|
||||||
let nsimg=$.NSImage.alloc.initWithContentsOfFile({{json .WindowIcon}})
|
|
||||||
nsapp.setActivationPolicy($.NSApplicationActivationPolicyRegular)
|
|
||||||
nsapp.setApplicationIconImage(nsimg)}{{end}}
|
|
||||||
{{- end}}
|
{{- end}}
|
||||||
{{define "date" -}}
|
{{define "date" -}}
|
||||||
ObjC.import('Cocoa')
|
ObjC.import('Cocoa')
|
||||||
ObjC.import('stdio')
|
ObjC.import('stdio')
|
||||||
ObjC.import('stdlib')
|
ObjC.import('stdlib')
|
||||||
{{template "common" .}}
|
{{template "common" .}}
|
||||||
|
var nsapp=$.NSApplication.sharedApplication
|
||||||
|
nsapp.setActivationPolicy($.NSApplicationActivationPolicyAccessory)
|
||||||
var date=$.NSDatePicker.alloc.init
|
var date=$.NSDatePicker.alloc.init
|
||||||
date.setDatePickerStyle($.NSDatePickerStyleClockAndCalendar)
|
date.setDatePickerStyle($.NSDatePickerStyleClockAndCalendar)
|
||||||
date.setDatePickerElements($.NSDatePickerElementFlagYearMonthDay)
|
date.setDatePickerElements($.NSDatePickerElementFlagYearMonthDay)
|
||||||
|
|
|
@ -1,3 +1,11 @@
|
||||||
|
{{if .WindowIcon}}{
|
||||||
|
ObjC.import('Cocoa')
|
||||||
|
let nsapp = $.NSApplication.sharedApplication
|
||||||
|
let nsimg = $.NSImage.alloc.initWithContentsOfFile({{json .WindowIcon}})
|
||||||
|
nsapp.setActivationPolicy($.NSApplicationActivationPolicyRegular)
|
||||||
|
nsapp.setApplicationIconImage(nsimg)
|
||||||
|
}{{end}}
|
||||||
|
|
||||||
{{- if .Application}}
|
{{- if .Application}}
|
||||||
try {
|
try {
|
||||||
var app = Application({{json .Application}})
|
var app = Application({{json .Application}})
|
||||||
|
@ -8,11 +16,4 @@
|
||||||
var app = Application.currentApplication()
|
var app = Application.currentApplication()
|
||||||
{{- end}}
|
{{- end}}
|
||||||
app.includeStandardAdditions = true
|
app.includeStandardAdditions = true
|
||||||
|
app.activate()
|
||||||
{{if .WindowIcon}}{
|
|
||||||
ObjC.import('Cocoa')
|
|
||||||
let nsapp = $.NSApplication.sharedApplication
|
|
||||||
let nsimg = $.NSImage.alloc.initWithContentsOfFile({{json .WindowIcon}})
|
|
||||||
nsapp.setActivationPolicy($.NSApplicationActivationPolicyRegular)
|
|
||||||
nsapp.setApplicationIconImage(nsimg)
|
|
||||||
}{{end}}
|
|
|
@ -1,6 +1,8 @@
|
||||||
ObjC.import('Cocoa')
|
ObjC.import('Cocoa')
|
||||||
ObjC.import('stdio')
|
ObjC.import('stdio')
|
||||||
ObjC.import('stdlib')
|
ObjC.import('stdlib')
|
||||||
|
var nsapp = $.NSApplication.sharedApplication
|
||||||
|
nsapp.setActivationPolicy($.NSApplicationActivationPolicyAccessory)
|
||||||
{{template "common" .}}
|
{{template "common" .}}
|
||||||
|
|
||||||
var date = $.NSDatePicker.alloc.init
|
var date = $.NSDatePicker.alloc.init
|
||||||
|
|
|
@ -19,9 +19,6 @@ func progress(opts options) (ProgressDialog, error) {
|
||||||
if opts.maxValue >= 0 {
|
if opts.maxValue >= 0 {
|
||||||
data.Total = &opts.maxValue
|
data.Total = &opts.maxValue
|
||||||
}
|
}
|
||||||
if opts.attach != nil {
|
|
||||||
data.Application = opts.attach
|
|
||||||
}
|
|
||||||
if i, ok := opts.windowIcon.(string); ok {
|
if i, ok := opts.windowIcon.(string); ok {
|
||||||
data.WindowIcon = i
|
data.WindowIcon = i
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue