Skip to content

Commit afca8f5

Browse files
committed
Initial commit
0 parents  commit afca8f5

File tree

6 files changed

+211
-0
lines changed

6 files changed

+211
-0
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.plist filter=plutil linguist-language=YAML
2+
*.gif filter=lfs diff=lfs merge=lfs -text

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.DS_Store
2+
*.alfredworkflow
3+
icon.png

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
=====================
3+
Copyright © 2018 [Daniel Bayley](https://github.com/danielbayley) <daniel.bayley@me.com>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
_[Alfred]_ Terminal
2+
===================
3+
Run `commands` in Alfred or [Terminal].
4+
5+
Alfred [workflows] require the paid _[Powerpack]_ upgrade.
6+
7+
Install
8+
-------
9+
easily with _[homebrew-alfred]_:
10+
~~~ sh
11+
brew tap danielbayley/alfred
12+
brew alfred install terminal
13+
~~~
14+
or then with _[awm]_ to contribute:
15+
~~~ sh
16+
brew install awm
17+
awm develop terminal
18+
~~~
19+
20+
License
21+
-------
22+
[MIT] © [Daniel Bayley]
23+
24+
[MIT]: LICENSE.md
25+
[Daniel Bayley]: https://github.com/danielbayley
26+
27+
[alfred]: http://alfredapp.com
28+
[powerpack]: https://alfredapp.com/powerpack
29+
[workflows]: http://alfredapp.com/workflows
30+
31+
[homebrew-alfred]: https://github.com/danielbayley/homebrew-alfred
32+
[awm]: https://github.com/danielbayley/awm
33+
34+
[terminal]: https://support.apple.com/guide/terminal

info.plist

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
name: Terminal
3+
version: 0.1.0
4+
description: Run commands in Alfred or Terminal.
5+
category: Development
6+
bundleid: com.apple.Terminal
7+
createdby: Daniel Bayley
8+
webaddress: https://github.com/danielbayley/alfred-terminal#readme
9+
objects:
10+
- config:
11+
argument: "-i -- {query}"
12+
uid: 10B1246F-E4B9-4742-8B20-2A15B73D722D
13+
version: 1
14+
type: alfred.workflow.utility.argument
15+
- config:
16+
hotkey: 47
17+
hotmod: 1048576
18+
relatedApps:
19+
- com.github.atom
20+
relatedAppsMode: 2
21+
focusedappvariable: false
22+
hotstring: "."
23+
leftcursor: false
24+
modsmode: 2
25+
uid: 67D3B628-43A1-4872-A673-40A352915DA1
26+
version: 2
27+
type: alfred.workflow.trigger.hotkey
28+
- config:
29+
largetypetext: "{query}"
30+
uid: '048A0C27-BFA6-44B4-9064-0C0E1A1EE542'
31+
version: 2
32+
type: alfred.workflow.output.largetype
33+
- config:
34+
withspace: true
35+
keyword: ">"
36+
text: Terminal
37+
uid: C2C63A7B-9622-4746-8FAB-0E4C900F1675
38+
version: 1
39+
type: alfred.workflow.input.keyword
40+
- config:
41+
cachescript: true
42+
uid: 1E30C5FC-F37B-4638-B2D4-0CD10F8F26CB
43+
version: 1
44+
type: alfred.workflow.action.applescript
45+
- config:
46+
hotkey: 47
47+
hotmod: 1310720
48+
relatedApps:
49+
- com.github.atom
50+
relatedAppsMode: 2
51+
focusedappvariable: false
52+
hotstring: "."
53+
leftcursor: false
54+
modsmode: 1
55+
uid: C2E6058D-11FC-4BC9-9220-D5B92ADC1C85
56+
version: 2
57+
type: alfred.workflow.trigger.hotkey
58+
- config:
59+
argument: "-il -- {query}"
60+
uid: A2E500FA-9511-4E19-9B06-4707CC404A4E
61+
version: 1
62+
type: alfred.workflow.utility.argument
63+
connections:
64+
A2E500FA-9511-4E19-9B06-4707CC404A4E:
65+
- vitoclose: false
66+
destinationuid: 1E30C5FC-F37B-4638-B2D4-0CD10F8F26CB
67+
67D3B628-43A1-4872-A673-40A352915DA1:
68+
- vitoclose: false
69+
destinationuid: C2C63A7B-9622-4746-8FAB-0E4C900F1675
70+
10B1246F-E4B9-4742-8B20-2A15B73D722D:
71+
- vitoclose: false
72+
destinationuid: 1E30C5FC-F37B-4638-B2D4-0CD10F8F26CB
73+
C2E6058D-11FC-4BC9-9220-D5B92ADC1C85:
74+
- vitoclose: false
75+
destinationuid: A2E500FA-9511-4E19-9B06-4707CC404A4E
76+
C2C63A7B-9622-4746-8FAB-0E4C900F1675:
77+
- modifiersubtext: source .rc
78+
modifiers: 1048576
79+
destinationuid: 10B1246F-E4B9-4742-8B20-2A15B73D722D
80+
vitoclose: false
81+
- vitoclose: false
82+
destinationuid: 1E30C5FC-F37B-4638-B2D4-0CD10F8F26CB
83+
- modifiersubtext: Run in Terminal
84+
modifiers: 524288
85+
destinationuid: A2E500FA-9511-4E19-9B06-4707CC404A4E
86+
vitoclose: false
87+
1E30C5FC-F37B-4638-B2D4-0CD10F8F26CB:
88+
- vitoclose: false
89+
destinationuid: '048A0C27-BFA6-44B4-9064-0C0E1A1EE542'
90+
uidata:
91+
A2E500FA-9511-4E19-9B06-4707CC404A4E:
92+
ypos: 170
93+
xpos: 370
94+
67D3B628-43A1-4872-A673-40A352915DA1:
95+
ypos: 20
96+
xpos: 20
97+
10B1246F-E4B9-4742-8B20-2A15B73D722D:
98+
ypos: 10
99+
xpos: 370
100+
C2E6058D-11FC-4BC9-9220-D5B92ADC1C85:
101+
ypos: 140
102+
xpos: 20
103+
'048A0C27-BFA6-44B4-9064-0C0E1A1EE542':
104+
ypos: 20
105+
xpos: 640
106+
C2C63A7B-9622-4746-8FAB-0E4C900F1675:
107+
ypos: 20
108+
xpos: 170
109+
1E30C5FC-F37B-4638-B2D4-0CD10F8F26CB:
110+
ypos: 20
111+
xpos: 490
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#! /usr/bin/osascript
2+
property text item delimiters: " -- "
3+
4+
on alfred_script(input)
5+
6+
set {flags, command} to {text item 1, last text item} of input
7+
8+
tell app "Finder" to ¬
9+
set PFD to posix path of (target of window 1 as alias)
10+
set SHELL to system attribute "SHELL"
11+
12+
if flags is "-il"
13+
tell app "Terminal"
14+
if running
15+
activate
16+
delay .4
17+
tell app "System Events" to keystroke "t" using command down
18+
19+
do script "cd '" & PFD & "'; clear;" & command in window 1
20+
return
21+
end if
22+
end tell
23+
24+
do shell script "open --fresh -b com.apple.terminal '" & PFD & "'"
25+
delay .1
26+
tell app "Terminal" to do script command in window 1
27+
return
28+
29+
else if flags is not "-i"
30+
set flags to "-"
31+
end if
32+
33+
try
34+
do shell script ¬
35+
"cd '" & PFD & "';" & SHELL & space & flags & "c '" & command & "'"
36+
on error stderr
37+
return stderr
38+
end try
39+
40+
end alfred_script

0 commit comments

Comments
 (0)