-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinfo.plist
179 lines (169 loc) · 4.92 KB
/
info.plist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>bundleid</key>
<string>com.madsendev.openapp</string>
<key>category</key>
<string>Tools</string>
<key>connections</key>
<dict>
<key>783193FF-5157-433A-BF2A-FD187439327B</key>
<array>
<dict>
<key>destinationuid</key>
<string>16039760-F173-4AB8-9C73-DA7401D5DE23</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
</dict>
<key>createdby</key>
<string>@RussellMadsen</string>
<key>description</key>
<string>Open an application that can access the user logged in user's envionment / paths.</string>
<key>disabled</key>
<false/>
<key>name</key>
<string>Open App</string>
<key>objects</key>
<array>
<dict>
<key>config</key>
<dict>
<key>alfredfiltersresults</key>
<false/>
<key>argumenttype</key>
<integer>0</integer>
<key>escaping</key>
<integer>102</integer>
<key>keyword</key>
<string>openapp</string>
<key>queuedelaycustom</key>
<integer>3</integer>
<key>queuedelayimmediatelyinitially</key>
<true/>
<key>queuedelaymode</key>
<integer>1</integer>
<key>queuemode</key>
<integer>2</integer>
<key>runningsubtext</key>
<string>Finding Apps...</string>
<key>script</key>
<string>RESOURCES="/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources"
function createXMLItem {
# APPNAME="$(tr -d '.app' <<< "$1")"
APPNAME="$(sed -e 's/\.app$//' <<< "$1")"
APP_PATH="/Applications/$APPNAME"
ICON_PATH="$(getIconPath "$1")"
ITEMARG="$(getItemArg "$1")"
TITLE="<title>$APPNAME</title>"
SUBTITLE="<subtitle>$APP_PATH</subtitle>"
ICON="<icon>$ICON_PATH</icon>"
echo "<item uid=\"$APPNAME\" arg=\"$ITEMARG\">$TITLE$SUBTITLE$ICON</item>"
}
function getItemArg {
APPNAME="$1"
EXECUTEABLE=`defaults read "/Applications/$APPNAME/Contents/Info" CFBundleExecutable`
echo "/Applications/$APPNAME/Contents/MacOS/$EXECUTEABLE"
}
function getIconPath {
APPNAME="$1"
ICON_NAME=`defaults read "/Applications/$APPNAME/Contents/Info" CFBundleIconFile|sed -e 's/\.icns$//'`
ICON_PATH="/Applications/$APPNAME/Contents/Resources/$ICON_NAME.icns"
if [[ -e "ICON_PATH" ]]; then
ICON_PATH="$RESOURCES/ApplicationsFolderIcon.icns"
fi
echo "$ICON_PATH"
}
# TODO: remove if not needed
function escapeSpaces {
echo "$(printf "%q\n" "$1")"
}
ITEMS=""
# find apps
while read -r line ; do
item=$(createXMLItem "$line")
ITEMS+="${item}"
#echo "ItemCreated! $item"
done <<< "$(ls /Applications | grep -i "{query}")"
RESULT=$(echo "<?xml version=\"1.0\"?><items>$ITEMS</items>")
cat <<< "$RESULT"
</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
<string></string>
<key>subtext</key>
<string>Open an application via shell inorder to share enviornment / path</string>
<key>title</key>
<string>Open Application...</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>783193FF-5157-433A-BF2A-FD187439327B</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>103</integer>
<key>script</key>
<string>nohup /bin/zsh -l -c "{query}" &</string>
<key>scriptargtype</key>
<integer>0</integer>
<key>scriptfile</key>
<string></string>
<key>type</key>
<integer>5</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>16039760-F173-4AB8-9C73-DA7401D5DE23</string>
<key>version</key>
<integer>2</integer>
</dict>
</array>
<key>readme</key>
<string>This script uses zsh because it’s my preferred shell, but the open app workflow will launch an application from shell in order to share environment variables and paths.
The script filter will auto suggest apps based on your installed apps. After choosing an app, a simple one line is used to launch the app in the background without a terminal window:
```
nohup /bin/zsh -l -c "{query}" &
```</string>
<key>uidata</key>
<dict>
<key>16039760-F173-4AB8-9C73-DA7401D5DE23</key>
<dict>
<key>xpos</key>
<integer>500</integer>
<key>ypos</key>
<real>80</real>
</dict>
<key>783193FF-5157-433A-BF2A-FD187439327B</key>
<dict>
<key>xpos</key>
<integer>300</integer>
<key>ypos</key>
<real>80</real>
</dict>
</dict>
<key>version</key>
<string>1.1</string>
<key>webaddress</key>
<string>http://madsendev.com</string>
</dict>
</plist>