Skip to content

Commit

Permalink
add unmount command
Browse files Browse the repository at this point in the history
  • Loading branch information
pstadler committed Mar 24, 2013
1 parent 7be1377 commit cc0506f
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 12 deletions.
Binary file modified Mount Network Share.alfredworkflow
Binary file not shown.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ Available shares will **be automatically discovered** and listed within Alfred.

![Screenshot of "Mount Network Share for Alfred"](screenshot.png)

![Screenshot of "Mount Network Share for Alfred"](screenshot-unmount.png)

[Download](Mount%20Network%20Share.alfredworkflow?raw=true)
Binary file added screenshot-unmount.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/6B492BDF-9554-4B32-9FC7-70299B4F6CF0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/eject.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
103 changes: 91 additions & 12 deletions src/info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@
<dict>
<key>5C4A76F4-0175-48DE-AA23-7F7F70AB8659</key>
<array/>
<key>6B492BDF-9554-4B32-9FC7-70299B4F6CF0</key>
<array>
<dict>
<key>destinationuid</key>
<string>3BABCA7A-880C-45B6-A4CC-03B301CB4991</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
</dict>
</array>
<key>C3BD5BCD-E58A-491B-93B0-951192C4BAC9</key>
<array>
<dict>
Expand All @@ -33,21 +44,45 @@
<dict>
<key>config</key>
<dict>
<key>applescript</key>
<string>on alfred_script(q)
try
mount volume "afp://" &amp; q
on error
mount volume "smb://" &amp; q
end try
end alfred_script</string>
<key>cachescript</key>
<key>argumenttype</key>
<integer>2</integer>
<key>escaping</key>
<integer>63</integer>
<key>keyword</key>
<string>unmount</string>
<key>runningsubtext</key>
<string>Find mounted shares...</string>
<key>script</key>
<string>#!/bin/bash
out=''
while read -r line; do
local_path=$(echo $line | sed 's/^.* on \(.*\) (.*/\1/g')
remote=$(echo $line | sed 's/^.*@\(.*\) on .*/\1/g')
host=$(echo $remote | cut -f1 -d '/')
share=$(echo $remote | cut -f2 -d '/')
out+="&lt;item arg=\"$local_path\" uid=\"$remote\" valid=\"yes\"&gt;\
&lt;title&gt;$share&lt;/title&gt;\
&lt;subtitle&gt;$local_path — on $host&lt;/subtitle&gt;\
&lt;icon&gt;eject.png&lt;/icon&gt;\
&lt;/item&gt;"
done &lt; &lt;(mount | grep '^//')
echo "&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;&lt;items&gt;$out&lt;/items&gt;"</string>
<key>subtext</key>
<string>Disconnect a network share</string>
<key>title</key>
<string>Unmount Network Share</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
<false/>
</dict>
<key>type</key>
<string>alfred.workflow.action.applescript</string>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>5C4A76F4-0175-48DE-AA23-7F7F70AB8659</string>
<string>6B492BDF-9554-4B32-9FC7-70299B4F6CF0</string>
</dict>
<dict>
<key>config</key>
Expand Down Expand Up @@ -123,7 +158,7 @@ done &lt; &lt;((sleep 0.5; kill -13 0) &amp; # kill quickly if trapped
kill -13 0
exit 0</string>
<key>subtext</key>
<string>Connect to a network share</string>
<string>Connect a network share</string>
<key>title</key>
<string>Mount Network Share</string>
<key>type</key>
Expand All @@ -136,16 +171,60 @@ exit 0</string>
<key>uid</key>
<string>C3BD5BCD-E58A-491B-93B0-951192C4BAC9</string>
</dict>
<dict>
<key>config</key>
<dict>
<key>applescript</key>
<string>on alfred_script(q)
try
mount volume "afp://" &amp; q
on error
mount volume "smb://" &amp; q
end try
end alfred_script</string>
<key>cachescript</key>
<false/>
</dict>
<key>type</key>
<string>alfred.workflow.action.applescript</string>
<key>uid</key>
<string>5C4A76F4-0175-48DE-AA23-7F7F70AB8659</string>
</dict>
<dict>
<key>config</key>
<dict>
<key>applescript</key>
<string>on alfred_script(q)
do shell script "umount " &amp; q
end alfred_script</string>
<key>cachescript</key>
<false/>
</dict>
<key>type</key>
<string>alfred.workflow.action.applescript</string>
<key>uid</key>
<string>3BABCA7A-880C-45B6-A4CC-03B301CB4991</string>
</dict>
</array>
<key>readme</key>
<string></string>
<key>uidata</key>
<dict>
<key>3BABCA7A-880C-45B6-A4CC-03B301CB4991</key>
<dict>
<key>ypos</key>
<real>130</real>
</dict>
<key>5C4A76F4-0175-48DE-AA23-7F7F70AB8659</key>
<dict>
<key>ypos</key>
<real>10</real>
</dict>
<key>6B492BDF-9554-4B32-9FC7-70299B4F6CF0</key>
<dict>
<key>ypos</key>
<real>130</real>
</dict>
<key>C3BD5BCD-E58A-491B-93B0-951192C4BAC9</key>
<dict>
<key>ypos</key>
Expand Down

0 comments on commit cc0506f

Please sign in to comment.