Skip to content

Commit

Permalink
Close #53 Add custom URL scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
kaphacius committed Jun 21, 2024
1 parent fde6c62 commit 25514bc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
11 changes: 11 additions & 0 deletions JustTags/JustTagsApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ internal struct JustTagsApp: App {
}
}
.environmentObject(appVM)
.onOpenURL(perform: { url in
let abs = url.absoluteString
guard let markerIdx = abs.ranges(of: /\/main\//).first else {
return
}
let last = String(url.absoluteString.suffix(from: markerIdx.upperBound))
NSPasteboard.copyString(last)
Task {
appVM.pasteIntoCurrentTab()
}
})
} defaultValue: {
// WWDC 2024
// Why is this called when id passed in?
Expand Down
13 changes: 13 additions & 0 deletions JustTags/Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,18 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>com.github.kaphacius.JustTags</string>
<key>CFBundleURLSchemes</key>
<array>
<string>justtags</string>
</array>
</dict>
</array>
</dict>
</plist>

0 comments on commit 25514bc

Please sign in to comment.