Skip to content

Commit b134e0e

Browse files
authored
Merge pull request #848 from Garulf/clipboard-api-function
Add Clipboard copy to jsonRPC API
2 parents 08ad38e + 17bcb27 commit b134e0e

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ public interface IPublicAPI
3737
/// <exception cref="FileNotFoundException">Thrown when unable to find the file specified in the command </exception>
3838
/// <exception cref="Win32Exception">Thrown when error occurs during the execution of the command </exception>
3939
void ShellRun(string cmd, string filename = "cmd.exe");
40+
41+
/// <summary>
42+
/// Copy Text to clipboard
43+
/// </summary>
44+
/// <param name="Text">Text to save on clipboard</param>
45+
public void CopyToClipboard(string text);
4046

4147
/// <summary>
4248
/// Save everything, all of Flow Launcher and plugins' data and settings

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ public void ShellRun(string cmd, string filename = "cmd.exe")
114114
var startInfo = ShellCommand.SetProcessStartInfo(filename, arguments: args, createNoWindow: true);
115115
ShellCommand.Execute(startInfo);
116116
}
117+
118+
public void CopyToClipboard(string text)
119+
{
120+
Clipboard.SetDataObject(text);
121+
}
117122

118123
public void StartLoadingBar() => _mainVM.ProgressBarVisibility = Visibility.Visible;
119124

@@ -222,4 +227,4 @@ private bool KListener_hookedKeyboardCallback(KeyEvent keyevent, int vkcode, Spe
222227

223228
#endregion
224229
}
225-
}
230+
}

0 commit comments

Comments
 (0)