Created
January 30, 2021 00:37
-
-
Save pudquick/62b9cf82175b80ae5ee8b8fb8ad892ea to your computer and use it in GitHub Desktop.
Get / Set shared Find Pasteboard state on macOS via pyobjc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from AppKit import NSPasteboard, NSFindPboard, NSStringPboardType, NSString | |
def get_fboard(): | |
fboard = NSPasteboard.pasteboardWithName_(NSFindPboard) | |
if NSStringPboardType in fboard.types(): | |
return fboard.stringForType_(NSStringPboardType) | |
def set_fboard(findstr): | |
fboard = NSPasteboard.pasteboardWithName_(NSFindPboard) | |
fboard.declareTypes_owner([NSStringPboardType], None) | |
fboard.setString_forType_(NSString.stringWithString_(findstr), NSStringPboardType) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment