Skip to content

Commit

Permalink
Remove separate setup, do it on first run instead
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-pennyworth committed Jun 13, 2021
1 parent 0633cc6 commit 0dd0ad2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 79 deletions.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
- [Alfred 4](https://alfredapp.com/)
- [CleanShot X](https://cleanshot.com/) (version `3.5.1` or above)

### Installation
Before using the workflow, run `.setup-cleanshot` in Alfred.

### Features
- Capture Area
- Capture Area and Pin to the Screen
Expand Down
15 changes: 14 additions & 1 deletion build-scripts/mkworkflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
'B0B38CAD-6949-4F11-9B8E-B53F7538F5EB.png',
'E7E3A0BD-6513-455B-A6B5-0AB88A9C96B1.png',
'desktop-icons-visible',
'firstrun.sh',
'icon.png',
'icons',
'info.plist',
Expand Down Expand Up @@ -49,6 +50,16 @@ def plistWrite(obj, path):
return plistlib.dump(obj, f)


def fileRead(path):
with open(path) as f:
return f.read()


def fileWrite(contents, path):
with open(path, 'w') as f:
f.write(contents)


@contextmanager
def cwd(dir):
old_wd = os.path.abspath(os.curdir)
Expand All @@ -73,7 +84,9 @@ def make_export_ready(plist_path):
if __name__ == '__main__':
subprocess.call(['./build-scripts/mkapps.sh'])
copy(WF_FILES, BUILD_DIR)
wf_name = make_export_ready(f'{BUILD_DIR}/info.plist')
plist_path = f'{BUILD_DIR}/info.plist'
fileWrite(fileRead(plist_path).replace('items.sh', 'firstrun.sh'), plist_path)
wf_name = make_export_ready(plist_path)
with cwd(BUILD_DIR):
subprocess.call(
['zip', '-q', '-r', f'../{wf_name}.alfredworkflow'] + WF_FILES
Expand Down
7 changes: 7 additions & 0 deletions firstrun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

xattr -d com.apple.quarantine ./desktop-icons-visible
xattr -d com.apple.quarantine ./pngpaste

sed -i '' 's/firstrun.sh/items.sh/g' ./info.plist
./items.sh
76 changes: 1 addition & 75 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -173,19 +173,6 @@
<false/>
</dict>
</array>
<key>FB661BF6-615D-4BDB-B079-847ABCABADCE</key>
<array>
<dict>
<key>destinationuid</key>
<string>86932CE5-046C-42DE-A99D-F9C5892BAABE</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
</dict>
<key>createdby</key>
<string>Mr. Pennyworth</string>
Expand Down Expand Up @@ -217,51 +204,6 @@
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>argumenttype</key>
<integer>2</integer>
<key>keyword</key>
<string>.setup-cleanshot</string>
<key>subtext</key>
<string>.setup-cleanshot</string>
<key>text</key>
<string>Setup Cleanshot</string>
<key>withspace</key>
<false/>
</dict>
<key>type</key>
<string>alfred.workflow.input.keyword</string>
<key>uid</key>
<string>FB661BF6-615D-4BDB-B079-847ABCABADCE</string>
<key>version</key>
<integer>1</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>concurrently</key>
<false/>
<key>escaping</key>
<integer>102</integer>
<key>script</key>
<string>xattr -d com.apple.quarantine ./desktop-icons-visible
xattr -d com.apple.quarantine ./pngpaste</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
<string></string>
<key>type</key>
<integer>0</integer>
</dict>
<key>type</key>
<string>alfred.workflow.action.script</string>
<key>uid</key>
<string>86932CE5-046C-42DE-A99D-F9C5892BAABE</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
Expand Down Expand Up @@ -766,15 +708,6 @@ xattr -d com.apple.quarantine ./pngpaste</string>
<key>ypos</key>
<integer>225</integer>
</dict>
<key>86932CE5-046C-42DE-A99D-F9C5892BAABE</key>
<dict>
<key>note</key>
<string>de-quarentine binaries</string>
<key>xpos</key>
<integer>155</integer>
<key>ypos</key>
<integer>10</integer>
</dict>
<key>B0B38CAD-6949-4F11-9B8E-B53F7538F5EB</key>
<dict>
<key>xpos</key>
Expand All @@ -789,18 +722,11 @@ xattr -d com.apple.quarantine ./pngpaste</string>
<key>ypos</key>
<integer>10</integer>
</dict>
<key>FB661BF6-615D-4BDB-B079-847ABCABADCE</key>
<dict>
<key>xpos</key>
<integer>10</integer>
<key>ypos</key>
<integer>10</integer>
</dict>
</dict>
<key>variablesdontexport</key>
<array/>
<key>version</key>
<string>0.1.0</string>
<string>0.1.1</string>
<key>webaddress</key>
<string>https://github.com/mr-pennyworth/alfred-cleanshot</string>
</dict>
Expand Down

0 comments on commit 0dd0ad2

Please sign in to comment.