-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* - feature: added poc for shinkai spotlight * - improve: prevent app closing * - refactor: windows management * - fix: command to find shinkai * wip * wip * feat: quick ask base version * add hide spotlight command * feat: shortcuts * improvements * more improvements * - fix: added target-os to reopen event --------- Co-authored-by: Alfredo Gallardo <[email protected]>
- Loading branch information
1 parent
b750090
commit 52782c1
Showing
41 changed files
with
1,367 additions
and
249 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
fn main() { | ||
// fix for crashing bundle dmg/app on MACOS | ||
println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET=10.13"); | ||
// fix for crashing bundle dmg/app on MACOS | ||
println!("cargo:rustc-env=MACOSX_DEPLOYMENT_TARGET=10.13"); | ||
|
||
// triggers tauri build | ||
tauri_build::build() | ||
// triggers tauri build | ||
tauri_build::build() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
pub mod transcribe; | ||
pub mod transcribe; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
use crate::galxe; | ||
|
||
#[tauri::command] | ||
pub fn galxe_generate_proof(node_signature: &str, payload: &str) -> Result<(String, String), String> { | ||
pub fn galxe_generate_proof( | ||
node_signature: &str, | ||
payload: &str, | ||
) -> Result<(String, String), String> { | ||
galxe::generate_proof(node_signature.to_string(), payload.to_string()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub mod shinkai_node_manager_commands; | ||
pub mod galxe; | ||
pub mod hardware; | ||
pub mod galxe; | ||
pub mod shinkai_node_manager_commands; | ||
pub mod spotlight_commands; |
6 changes: 6 additions & 0 deletions
6
apps/shinkai-desktop/src-tauri/src/commands/shinkai_node_manager_commands.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
apps/shinkai-desktop/src-tauri/src/commands/spotlight_commands.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
use crate::windows::hide_spotlight_window; | ||
|
||
#[tauri::command] | ||
pub async fn hide_spotlight_window_app(app_handle: tauri::AppHandle) { | ||
hide_spotlight_window(app_handle) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
apps/shinkai-desktop/src-tauri/src/global_shortcuts/create_chat.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use tauri::{Emitter, Manager}; | ||
use tauri_plugin_global_shortcut::{Shortcut, ShortcutEvent}; | ||
|
||
use crate::windows::{show_or_recreate_window, Window}; | ||
|
||
pub fn create_chat(app: &tauri::AppHandle, _: Shortcut, _: ShortcutEvent) { | ||
show_or_recreate_window(app.clone(), Window::Main); | ||
if let Some(window) = app.get_webview_window("main") { | ||
if let Err(e) = app.emit("create-chat", ()) { | ||
log::error!("failed to emit 'create-chat': {}", e); | ||
} | ||
if let Err(e) = window.set_focus() { | ||
log::error!("failed to set focus: {}", e); | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
apps/shinkai-desktop/src-tauri/src/global_shortcuts/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use tauri_plugin_global_shortcut::{Code, Modifiers, Shortcut, ShortcutEvent, ShortcutState}; | ||
|
||
mod create_chat; | ||
mod toggle_spotlight; | ||
|
||
pub fn global_shortcut_handler(app: &tauri::AppHandle, shortcut: Shortcut, event: ShortcutEvent) { | ||
if event.state != ShortcutState::Pressed { | ||
return; | ||
} | ||
match shortcut { | ||
s if s.matches(Modifiers::SUPER | Modifiers::SHIFT, Code::KeyI) => { | ||
create_chat::create_chat(app, shortcut, event); | ||
} | ||
s if s.matches(Modifiers::SUPER | Modifiers::SHIFT, Code::KeyJ) => { | ||
toggle_spotlight::toggle_spotlight(app, shortcut, event); | ||
} | ||
_ => { | ||
log::warn!("unhandled shortcut: {:?}", shortcut); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
apps/shinkai-desktop/src-tauri/src/global_shortcuts/toggle_spotlight.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use tauri::Manager; | ||
use tauri_plugin_global_shortcut::{Shortcut, ShortcutEvent}; | ||
|
||
use crate::windows::{show_or_recreate_window, Window}; | ||
|
||
pub fn toggle_spotlight(app: &tauri::AppHandle, _: Shortcut, _: ShortcutEvent) { | ||
if let Some(spotlight_window) = app.get_webview_window(Window::Spotlight.as_str()) { | ||
if spotlight_window.is_visible().unwrap_or(false) && spotlight_window.is_focused().unwrap_or(false) { | ||
let _ = spotlight_window.hide(); | ||
return; | ||
} | ||
} | ||
show_or_recreate_window(app.clone(), Window::Spotlight) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
pub mod ollama_api; | ||
pub mod process_handlers; | ||
pub mod shinkai_node_manager; | ||
pub mod shinkai_node_options; | ||
pub mod ollama_api; |
2 changes: 1 addition & 1 deletion
2
apps/shinkai-desktop/src-tauri/src/local_shinkai_node/ollama_api/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
pub mod ollama_api_types; | ||
pub mod ollama_api_client; | ||
pub mod ollama_api_types; |
Oops, something went wrong.