{
+ return invoke(generateJarvisPluginCommand("get_selected_text"))
+}
+
export const rawSystemCommands = [
{
name: "Open Trash",
diff --git a/packages/tauri-plugins/jarvis/Cargo.toml b/packages/tauri-plugins/jarvis/Cargo.toml
index 27f37d6..abc0e16 100644
--- a/packages/tauri-plugins/jarvis/Cargo.toml
+++ b/packages/tauri-plugins/jarvis/Cargo.toml
@@ -56,7 +56,7 @@ grpc = { workspace = true }
futures-util = "0.3.31"
rayon = { workspace = true }
local-ip-address = "0.6.3"
-
+get-selected-text = "0.1.6"
[target.'cfg(target_os = "macos")'.dependencies]
tauri-icns = "0.1.0"
diff --git a/packages/tauri-plugins/jarvis/build.rs b/packages/tauri-plugins/jarvis/build.rs
index 2b29e07..e00642a 100644
--- a/packages/tauri-plugins/jarvis/build.rs
+++ b/packages/tauri-plugins/jarvis/build.rs
@@ -28,6 +28,7 @@ const COMMANDS: &[&str] = &[
"unmute",
"hide_all_apps_except_frontmost",
"get_selected_files_in_file_explorer",
+ "get_selected_text",
"run_apple_script",
"run_powershell",
"get_applications",
diff --git a/packages/tauri-plugins/jarvis/permissions/all.toml b/packages/tauri-plugins/jarvis/permissions/all.toml
index 011b085..c860b6d 100644
--- a/packages/tauri-plugins/jarvis/permissions/all.toml
+++ b/packages/tauri-plugins/jarvis/permissions/all.toml
@@ -31,6 +31,7 @@ commands.allow = [
"unmute",
"hide_all_apps_except_frontmost",
"get_selected_files_in_file_explorer",
+ "get_selected_text",
"run_apple_script",
"run_powershell",
"get_applications",
diff --git a/packages/tauri-plugins/jarvis/permissions/autogenerated/commands/get_selected_text.toml b/packages/tauri-plugins/jarvis/permissions/autogenerated/commands/get_selected_text.toml
new file mode 100644
index 0000000..0fcbf8a
--- /dev/null
+++ b/packages/tauri-plugins/jarvis/permissions/autogenerated/commands/get_selected_text.toml
@@ -0,0 +1,13 @@
+# Automatically generated - DO NOT EDIT!
+
+"$schema" = "../../schemas/schema.json"
+
+[[permission]]
+identifier = "allow-get-selected-text"
+description = "Enables the get_selected_text command without any pre-configured scope."
+commands.allow = ["get_selected_text"]
+
+[[permission]]
+identifier = "deny-get-selected-text"
+description = "Denies the get_selected_text command without any pre-configured scope."
+commands.deny = ["get_selected_text"]
diff --git a/packages/tauri-plugins/jarvis/permissions/autogenerated/reference.md b/packages/tauri-plugins/jarvis/permissions/autogenerated/reference.md
index 19f9805..b77ba59 100644
--- a/packages/tauri-plugins/jarvis/permissions/autogenerated/reference.md
+++ b/packages/tauri-plugins/jarvis/permissions/autogenerated/reference.md
@@ -960,6 +960,32 @@ Denies the get_selected_files_in_file_explorer command without any pre-configure
+`jarvis:allow-get-selected-text`
+
+ |
+
+
+Enables the get_selected_text command without any pre-configured scope.
+
+ |
+
+
+
+
+
+`jarvis:deny-get-selected-text`
+
+ |
+
+
+Denies the get_selected_text command without any pre-configured scope.
+
+ |
+
+
+
+
+
`jarvis:allow-get-server-port`
|
diff --git a/packages/tauri-plugins/jarvis/permissions/schemas/schema.json b/packages/tauri-plugins/jarvis/permissions/schemas/schema.json
index 49bd95c..a38a59c 100644
--- a/packages/tauri-plugins/jarvis/permissions/schemas/schema.json
+++ b/packages/tauri-plugins/jarvis/permissions/schemas/schema.json
@@ -659,6 +659,16 @@
"type": "string",
"const": "deny-get-selected-files-in-file-explorer"
},
+ {
+ "description": "Enables the get_selected_text command without any pre-configured scope.",
+ "type": "string",
+ "const": "allow-get-selected-text"
+ },
+ {
+ "description": "Denies the get_selected_text command without any pre-configured scope.",
+ "type": "string",
+ "const": "deny-get-selected-text"
+ },
{
"description": "Enables the get_server_port command without any pre-configured scope.",
"type": "string",
diff --git a/packages/tauri-plugins/jarvis/src/commands/system.rs b/packages/tauri-plugins/jarvis/src/commands/system.rs
index 9c2e386..cc7609b 100644
--- a/packages/tauri-plugins/jarvis/src/commands/system.rs
+++ b/packages/tauri-plugins/jarvis/src/commands/system.rs
@@ -1,6 +1,7 @@
use crate::syscmds::{CommonSystemCmds, SystemCmds};
use crate::utils::script::run_apple_script;
use applications::AppInfo;
+use get_selected_text::get_selected_text as get_selected_text_impl;
#[tauri::command]
pub async fn open_trash() -> Result<(), String> {
@@ -156,3 +157,8 @@ pub async fn hide_all_apps_except_frontmost() -> Result<(), String> {
pub async fn get_selected_files_in_file_explorer() -> Result, String> {
SystemCmds::get_selected_files().map_err(|err| err.to_string())
}
+
+#[tauri::command]
+pub async fn get_selected_text() -> Result {
+ get_selected_text_impl().map_err(|err| err.to_string())
+}
diff --git a/packages/tauri-plugins/jarvis/src/lib.rs b/packages/tauri-plugins/jarvis/src/lib.rs
index 16aabde..e4cf748 100644
--- a/packages/tauri-plugins/jarvis/src/lib.rs
+++ b/packages/tauri-plugins/jarvis/src/lib.rs
@@ -89,6 +89,7 @@ pub fn init() -> TauriPlugin {
commands::system::hide_all_apps_except_frontmost,
commands::system::get_frontmost_app,
commands::system::get_selected_files_in_file_explorer,
+ commands::system::get_selected_text,
/* ------------------------------ applications ------------------------------ */
commands::apps::get_applications,
commands::apps::refresh_applications_list,