this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add pbcopy & pbpaste commands

This is a very basic implementation that takes no options and simply
calls into NSPasteboard.

+89
+1
src/CMakeLists.txt
··· 448 448 add_subdirectory(external/cocotron/CoreData) 449 449 add_subdirectory(external/cocotron/Cocoa) 450 450 add_subdirectory(external/cocotron/QuartzCore) 451 + add_subdirectory(pboard) 451 452 452 453 if(FULL_BUILD) 453 454 add_subdirectory(external/JavaScriptCore)
+13
src/pboard/CMakeLists.txt
··· 1 + project(pboard) 2 + 3 + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -nostdinc") 4 + 5 + include(darling_exe) 6 + 7 + add_darling_executable(pbcopy pbcopy.m) 8 + target_link_libraries(pbcopy AppKit Foundation objc) 9 + 10 + add_darling_executable(pbpaste pbpaste.m) 11 + target_link_libraries(pbpaste AppKit Foundation objc) 12 + 13 + install(TARGETS pbcopy pbpaste DESTINATION libexec/darling/usr/bin)
+43
src/pboard/pbcopy.m
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2019 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + 21 + #import <Foundation/Foundation.h> 22 + #import <AppKit/NSPasteboard.h> 23 + #import <AppKit/NSDisplay.h> 24 + 25 + int main(int argc, const char *argv[]) { 26 + [NSAutoreleasePool new]; 27 + 28 + NSFileHandle *handle = [NSFileHandle fileHandleWithStandardInput]; 29 + NSData *data = [handle readDataToEndOfFile]; 30 + 31 + NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; 32 + [pasteboard setData: data forType: NSStringPboardType]; 33 + 34 + // While we're the clipboard owner, make sure to process incoming requests. 35 + NSInteger changeCount = [pasteboard changeCount]; 36 + NSDisplay *display = [NSDisplay currentDisplay]; 37 + while (changeCount == [pasteboard changeCount]) { 38 + [display nextEventMatchingMask: NSAnyEventMask 39 + untilDate: [NSDate distantFuture] 40 + inMode: NSDefaultRunLoopMode 41 + dequeue: YES]; 42 + } 43 + }
+32
src/pboard/pbpaste.m
··· 1 + /* 2 + This file is part of Darling. 3 + 4 + Copyright (C) 2016-2017 Lubos Dolezel 5 + 6 + Darling is free software: you can redistribute it and/or modify 7 + it under the terms of the GNU General Public License as published by 8 + the Free Software Foundation, either version 3 of the License, or 9 + (at your option) any later version. 10 + 11 + Darling is distributed in the hope that it will be useful, 12 + but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + GNU General Public License for more details. 15 + 16 + You should have received a copy of the GNU General Public License 17 + along with Darling. If not, see <http://www.gnu.org/licenses/>. 18 + */ 19 + 20 + 21 + #import <Foundation/Foundation.h> 22 + #import <AppKit/NSPasteboard.h> 23 + 24 + int main(int argc, const char *argv[]) { 25 + [NSAutoreleasePool new]; 26 + 27 + NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; 28 + NSData *data = [pasteboard dataForType: NSStringPboardType]; 29 + 30 + NSFileHandle *handle = [NSFileHandle fileHandleWithStandardOutput]; 31 + [handle writeData: data]; 32 + }