Skip to content

Commit

Permalink
Launches UnderPillow from Finder toolbar item
Browse files Browse the repository at this point in the history
  • Loading branch information
anastasiuspernat committed Nov 28, 2022
1 parent f026b63 commit 32052b3
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ A macOS Finder right-click menu extension that displays diffusion metadata (usua

# TODO
- Refresh folder in the app when added folders via Finder toolbar item
- Make "Launch UnderPillow" item work
- Don't display errors on the menu
- Add option to remove folders
- Support more PNG data formats
Expand Down
10 changes: 2 additions & 8 deletions UnderPillow Finder/FinderSync.swift
Original file line number Diff line number Diff line change
Expand Up @@ -211,15 +211,9 @@ class FinderSync: FIFinderSync {
}

@IBAction func launchUnderPillow(_ sender: AnyObject?) {
let target = FIFinderSyncController.default().targetedURL()
let items = FIFinderSyncController.default().selectedItemURLs()

let item = sender as! NSMenuItem

NSLog("### launchUnderPillow: menu item: %@, target = %@, items = ", item.title as NSString, target!.path as NSString)
for obj in items! {
NSLog(" %@", obj.path as NSString)
}
NSWorkspace.shared.open(URL(string:"underpillow://")!)

}

@IBAction func copyMenuToClipboard(_ sender: AnyObject?) {
Expand Down
4 changes: 4 additions & 0 deletions UnderPillow.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
DD180E38291AD38500E23D59 /* UnderPillowXPCDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnderPillowXPCDelegate.swift; sourceTree = "<group>"; };
DD180E3A291AD38500E23D59 /* main.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = main.swift; sourceTree = "<group>"; };
DD180E3C291AD38500E23D59 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
DD428DD829355C4300743250 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
DDF189FE2919D4A700BC2201 /* UnderPillow.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UnderPillow.app; sourceTree = BUILT_PRODUCTS_DIR; };
DDF18A012919D4A700BC2201 /* UnderPillowApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnderPillowApp.swift; sourceTree = "<group>"; };
DDF18A032919D4A700BC2201 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -165,6 +166,7 @@
DDF18A002919D4A700BC2201 /* UnderPillow */ = {
isa = PBXGroup;
children = (
DD428DD829355C4300743250 /* Info.plist */,
DDF18A012919D4A700BC2201 /* UnderPillowApp.swift */,
DDF18A032919D4A700BC2201 /* ContentView.swift */,
DDF18A052919D4AA00BC2201 /* Assets.xcassets */,
Expand Down Expand Up @@ -569,6 +571,7 @@
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = UnderPillow/Info.plist;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand Down Expand Up @@ -600,6 +603,7 @@
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = UnderPillow/Info.plist;
INFOPLIST_KEY_NSHumanReadableCopyright = "";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
Expand Down
19 changes: 19 additions & 0 deletions UnderPillow/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!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>Crispy-Driven-Pixels.UnderPillow</string>
<key>CFBundleURLSchemes</key>
<array>
<string>underpillow</string>
</array>
</dict>
</array>
</dict>
</plist>

0 comments on commit 32052b3

Please sign in to comment.