Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Commit

Permalink
Copy GIF only when active
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-pennyworth committed Dec 13, 2020
1 parent 8c3f9d7 commit e36cc19
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
4 changes: 2 additions & 2 deletions alfred-gif-browser/AlfredGifBrowser.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 0.0.3;
MARKETING_VERSION = 0.0.5;
OTHER_CODE_SIGN_FLAGS = "--deep";
PRODUCT_BUNDLE_IDENTIFIER = mr.pennyworth.AlfredGifBrowser;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -338,7 +338,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.13;
MARKETING_VERSION = 0.0.3;
MARKETING_VERSION = 0.0.5;
ONLY_ACTIVE_ARCH = YES;
OTHER_CODE_SIGN_FLAGS = "--deep";
PRODUCT_BUNDLE_IDENTIFIER = mr.pennyworth.AlfredGifBrowser;
Expand Down
28 changes: 15 additions & 13 deletions alfred-gif-browser/AlfredGifBrowser/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -155,20 +155,22 @@ class AppDelegate: NSObject, NSApplicationDelegate {
window.contentView?.addSubview(webview)
alfredWatcher.start(
onAlfredWindowDestroy: {
self.urls = [nil]
let modifiers = self.alfredWatcher.mods
if (modifiers.contains(.command)) {
let pb = NSPasteboard.general
pb.clearContents()
pb.declareTypes([.fileContents], owner: nil)
pb.writeObjects([self.selectedGif as NSURL])
} else if (modifiers.contains(.option)) {
log(self.selectedGifWebUrl)
let pb = NSPasteboard.general
pb.clearContents()
pb.setString(self.selectedGifWebUrl, forType: .string)
if (self.window.isVisible) {
self.urls = [nil]
let modifiers = self.alfredWatcher.mods
if (modifiers.contains(.command)) {
let pb = NSPasteboard.general
pb.clearContents()
pb.declareTypes([.fileContents], owner: nil)
pb.writeObjects([self.selectedGif as NSURL])
} else if (modifiers.contains(.option)) {
log(self.selectedGifWebUrl)
let pb = NSPasteboard.general
pb.clearContents()
pb.setString(self.selectedGifWebUrl, forType: .string)
}
self.window.orderOut(self)
}
self.window.orderOut(self)
},
onDownArrowPressed: self.makeBrowseFunction("down"),
onUpArrowPressed: self.makeBrowseFunction("up"),
Expand Down
2 changes: 1 addition & 1 deletion info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ rm *.gif</string>
</dict>
</dict>
<key>version</key>
<string>0.0.4</string>
<string>0.0.5</string>
<key>webaddress</key>
<string>https://github.com/mr-pennyworth/alfred-gif</string>
</dict>
Expand Down

0 comments on commit e36cc19

Please sign in to comment.