Skip to content

Commit f98b1aa

Browse files
committed
Remove need for RCDefaultApp
Now, running the application on its own checks whether it's the default app for magnet URIs and prompts to associate itself if it isn't. Readme updated accordingly.
1 parent 343ac6f commit f98b1aa

File tree

6 files changed

+25
-7
lines changed

6 files changed

+25
-7
lines changed

Applescript_Code.txt

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
--THIS IS THE APPLESCRIPT CODE
2-
31
on quit
42
try
53
tell application "System Events" to tell process "Deluge"
@@ -27,4 +25,25 @@ on open location this_URL
2725
do shell script (quoted form of (delugePath & "/Contents/MacOS/Deluge") & " add " & delugeArgument & "; return;")
2826
quit
2927
end open location
28+
tell application "Finder" to set thisPath to (POSIX path of (application file id "org.deluge.MagnetURIHandler" as string))
29+
log thisPath
30+
set check_default to do shell script "MAGNET_DEFAULT_APP=`VERSIONER_PERL_PREFER_32_BIT=1 perl -MMac::InternetConfig -le \"print +(GetICHelper 'magnet')[1]\"`; if [[ $MAGNET_DEFAULT_APP = 'Magnet Handler' ]]; then echo TRUE; else echo FALSE; fi"
31+
if (check_default = "TRUE") then
32+
display dialog "Magnet Handler is already the default application to handle magnet URIs" buttons {"OK"} with title "Notification" with icon POSIX file (thisPath & "/Contents/Resources/deluge_magnet.icns")
33+
else
34+
try
35+
set dialogResult to display dialog "Magnet Handler has not been configured to handle magnet URIs.
36+
37+
Would you like to do this now?" buttons {"Yes", "No"} default button "Yes" cancel button "No" with title "Notification" with icon POSIX file (thisPath & "/Contents/Resources/deluge_magnet.icns")
38+
on error number -128
39+
end try
40+
try
41+
if button returned of dialogResult is "Yes" then
42+
set dutiPath to quoted form of (thisPath & "/Contents/Resources/duti") & " -s org.deluge.MagnetURIHandler magnet all && /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user"
43+
log dutiPath
44+
do shell script dutiPath
45+
46+
end if
47+
end try
48+
end if
3049
quit

Magnet Handler.app/Contents/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<key>positionOfDivider</key>
5656
<real>421</real>
5757
<key>savedFrame</key>
58-
<string>777 375 700 672 0 0 1920 1177 </string>
58+
<string>777 288 700 672 0 0 1920 1057 </string>
5959
<key>selectedTab</key>
6060
<string>log</string>
6161
</dict>
5.19 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{\rtf1\ansi\ansicpg1252\cocoartf1348\cocoasubrtf170
1+
{\rtf1\ansi\ansicpg1252\cocoartf1404\cocoasubrtf340
22
{\fonttbl}
33
{\colortbl;\red255\green255\blue255;}
44
}
29.3 KB
Binary file not shown.

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,5 @@
33

44
# Instructions
55
1. ) Install to "Applications" folder.
6-
2. ) Run The application once.
7-
3. ) Install RCDefaultApp (http://www.rubicode.com/Software/RCDefaultApp/) if you don't have it already, it's fantastical and incredibly useful anyway, and use it to associate Magnet URIs to the Magnet Handler app.
8-
4. ) Go to a browser and click on a magnet to test it.
6+
2. ) Run The application once by double-clicking it on the Finder, it should ask you to associate itself to magnet URIs; this will take a a couple minutes while Launch Services are rebuilt; wait until application exits on its own. Running the application again should tell you it's already associated to magnet URIs.
7+
3. ) Go to a browser and click on a magnet to test it.

0 commit comments

Comments
 (0)