grace/tpb
Tee your Paste Board
git clone https://git.gae.moe/grace/tpb
c228995
0.1.1
1/// ForkOut Clipboard backend 2/// Fulfills `Clip` interface 3pub const ForkOut = @This () ; 4 5const std = @import ( "std" ) ; 6 7extern fn sendPB ( text : [ * : 0 ] const u8 ) void ; 8extern fn initPB () void ; 9 10io : std . Io , 11 12child : std . process . Child , 13 14pub fn init ( io : std . Io , argv : [] const [] const u8 ) ! ForkOut { 15return . { . child = try std . process . spawn ( io , . { . argv = argv , . stdin = . pipe }) , . io = io } ; 16} 17 18pub fn writeCopyBuffer ( self : * ForkOut , buf : [] const u8 ) anyerror ! void { 19try self . child . stdin .? . writeStreamingAll ( self . io , buf ) ; 20} 21 22pub fn writePasteboard ( self : * ForkOut ) anyerror ! void { 23self . child . stdin .? . close ( self . io ) ; 24}