Skip to content
This repository was archived by the owner on Oct 28, 2021. It is now read-only.

Commit 03f1cfe

Browse files
committed
Support clipboard and more script-filter options
1 parent d34057d commit 03f1cfe

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

config/config.go

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,19 @@ type Config struct {
2525

2626
// Object is an object in an Alfred workflow.
2727
type Object struct {
28-
Argument string `yaml:"argument"`
29-
Icon string `yaml:"icon"`
30-
Keyword string `yaml:"keyword"`
31-
Name string `yaml:"-"`
32-
Script *Script `yaml:"script"`
33-
Then []Then `yaml:"then"`
34-
Type string `yaml:"type"`
35-
UID string `yaml:"uid"`
36-
Version int64 `yaml:"version"`
37-
WithSpace bool `yaml:"with-space"`
28+
Argument string `yaml:"argument"`
29+
Icon string `yaml:"icon"`
30+
Keyword string `yaml:"keyword"`
31+
Name string `yaml:"-"`
32+
RunningSubtext string `yaml:"running-subtext"`
33+
Script *Script `yaml:"script"`
34+
Text string `yaml:"text"`
35+
Then []Then `yaml:"then"`
36+
Title string `yaml:"title"`
37+
Type string `yaml:"type"`
38+
UID string `yaml:"uid"`
39+
Version int64 `yaml:"version"`
40+
WithSpace bool `yaml:"with-space"`
3841
}
3942

4043
// ObjectMap is a mapping of object names to objects

workflow/workflow.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ var argumentType = map[string]int64{
1515
}
1616

1717
var objectType = map[string]string{
18+
"clipboard": "alfred.workflow.output.clipboard",
1819
"keyword": "alfred.workflow.input.keyword",
1920
"script": "alfred.workflow.action.script",
2021
"script-filter": "alfred.workflow.input.scriptfilter",
@@ -98,10 +99,20 @@ func NewFromConfig(path string, c config.Config) (*Info, error) {
9899
Config: map[string]interface{}{},
99100
}
100101

102+
obj.Config["title"] = cfgObj.Title
103+
101104
if cfgObj.Script != nil {
102105
if err := obj.Config.addScriptConfig(path, cfgObj.Script); err != nil {
103106
return nil, err
104107
}
108+
109+
obj.Config["keyword"] = cfgObj.Keyword
110+
obj.Config["runningsubtext"] = cfgObj.RunningSubtext
111+
obj.Config["withspace"] = cfgObj.WithSpace
112+
}
113+
114+
if cfgObj.Type == "clipboard" {
115+
obj.Config["clipboardtext"] = cfgObj.Text
105116
}
106117

107118
if cfgObj.Type == "keyword" {

0 commit comments

Comments
 (0)