Skip to content

Commit d41dd78

Browse files
committed
add initial ShellRun support for JsonRPC
1 parent 3baaa2d commit d41dd78

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ public interface IPublicAPI
2929
/// </summary>
3030
void RestartApp();
3131

32+
/// <summary>
33+
/// Run a shell command or external program
34+
/// </summary>
35+
/// <param name="cmd">The command or program to run</param>
36+
void ShellRun(string cmd);
37+
3238
/// <summary>
3339
/// Save everything, all of Flow Launcher and plugins' data and settings
3440
/// </summary>

Flow.Launcher/PublicAPIInstance.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,16 @@ public void OpenSettingDialog()
103103
});
104104
}
105105

106+
public void ShellRun(string cmd)
107+
{
108+
System.Diagnostics.Process process = new();
109+
var startInfo = process.StartInfo;
110+
startInfo.FileName = "cmd.exe";
111+
startInfo.Arguments = $"/C {cmd}";
112+
startInfo.CreateNoWindow = true;
113+
process.Start();
114+
}
115+
106116
public void StartLoadingBar() => _mainVM.ProgressBarVisibility = Visibility.Visible;
107117

108118
public void StopLoadingBar() => _mainVM.ProgressBarVisibility = Visibility.Collapsed;

0 commit comments

Comments
 (0)