generated from nhcarrigan/template
3f30997f0e
## Explanation This PR bundles several user-facing improvements and feature additions for the v0.3.0 release, including quality-of-life improvements to the UI, new slash commands, better state persistence, and auto-update checking. ## Included Changes - **Resizable chat input** with drag handle (#58 partial) - **Arrow key navigation fix** - cursor keys now navigate text when user has typed input (#58) - **Scroll position persistence** per conversation tab - **/skill command** for invoking Claude Code skills (#57) - **Stats persistence fix** - stats now persist across session changes, only reset on disconnect (#59) - **Auto-update checker** on startup (#17) - **Resizable character panel** with full-height sprites (#10) - **Font size and zoom settings** with keyboard shortcuts (Ctrl++/Ctrl+-/Ctrl+0) (#19) ## Closes Closes #10, #17, #19, #57, #58, #59 ## Attestations - [x] I have read and agree to the Code of Conduct - [x] I have read and agree to the Community Guidelines - [x] My contribution complies with the Contributor Covenant - [x] I have run the linter and resolved any errors - [x] My pull request uses an appropriate title, matching the conventional commit standards - [x] My scope of feat/fix/chore/etc. correctly matches the nature of changes in my pull request - [x] All new and existing tests pass locally with my changes - [x] Code coverage remains at or above the configured threshold ## Documentation N/A - Internal app features ## Versioning Minor - My pull request introduces new non-breaking features. --- ✨ This PR was created with help from Hikari~ 🌸 Co-authored-by: Hikari <hikari@nhcarrigan.com> Reviewed-on: #61 Co-authored-by: Naomi Carrigan <commits@nhcarrigan.com> Co-committed-by: Naomi Carrigan <commits@nhcarrigan.com>
102 lines
2.9 KiB
Rust
102 lines
2.9 KiB
Rust
use std::process::Command;
|
|
use tauri::command;
|
|
|
|
#[command]
|
|
pub async fn send_notify_send(title: String, body: String) -> Result<(), String> {
|
|
// Use notify-send for Linux/WSL
|
|
let output = Command::new("notify-send")
|
|
.arg(&title)
|
|
.arg(&body)
|
|
.arg("--urgency=normal")
|
|
.arg("--app-name=Hikari Desktop")
|
|
.output()
|
|
.map_err(|e| {
|
|
format!(
|
|
"Failed to execute notify-send: {}. Make sure libnotify-bin is installed.",
|
|
e
|
|
)
|
|
})?;
|
|
|
|
if !output.status.success() {
|
|
let error = String::from_utf8_lossy(&output.stderr);
|
|
return Err(format!("notify-send failed: {}", error));
|
|
}
|
|
|
|
Ok(())
|
|
}
|
|
|
|
#[command]
|
|
pub async fn send_windows_notification(title: String, body: String) -> Result<(), String> {
|
|
// Create PowerShell script for Windows Toast Notification
|
|
let ps_script = format!(
|
|
r#"
|
|
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null
|
|
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] > $null
|
|
|
|
$APP_ID = 'Hikari Desktop'
|
|
|
|
$template = @"
|
|
<toast>
|
|
<visual>
|
|
<binding template="ToastText02">
|
|
<text id="1">{}</text>
|
|
<text id="2">{}</text>
|
|
</binding>
|
|
</visual>
|
|
<audio src="ms-winsoundevent:Notification.Default" />
|
|
</toast>
|
|
"@
|
|
|
|
$xml = New-Object Windows.Data.Xml.Dom.XmlDocument
|
|
$xml.LoadXml($template)
|
|
|
|
$toast = New-Object Windows.UI.Notifications.ToastNotification $xml
|
|
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($APP_ID).Show($toast)
|
|
"#,
|
|
title.replace("\"", "`\""),
|
|
body.replace("\"", "`\"")
|
|
);
|
|
|
|
// Try PowerShell Core first (pwsh), then fall back to Windows PowerShell
|
|
let output = Command::new("pwsh.exe")
|
|
.arg("-NoProfile")
|
|
.arg("-WindowStyle")
|
|
.arg("Hidden")
|
|
.arg("-Command")
|
|
.arg(&ps_script)
|
|
.output()
|
|
.or_else(|_| {
|
|
Command::new("powershell.exe")
|
|
.arg("-NoProfile")
|
|
.arg("-WindowStyle")
|
|
.arg("Hidden")
|
|
.arg("-Command")
|
|
.arg(&ps_script)
|
|
.output()
|
|
})
|
|
.map_err(|e| format!("Failed to execute PowerShell: {}", e))?;
|
|
|
|
if !output.status.success() {
|
|
let error = String::from_utf8_lossy(&output.stderr);
|
|
return Err(format!("PowerShell script failed: {}", error));
|
|
}
|
|
|
|
Ok(())
|
|
}
|
|
|
|
// Alternative: Use Windows built-in MSG command for simple notifications
|
|
#[command]
|
|
pub async fn send_simple_notification(title: String, body: String) -> Result<(), String> {
|
|
let message = format!("{}\n\n{}", title, body);
|
|
|
|
Command::new("cmd.exe")
|
|
.arg("/c")
|
|
.arg("msg")
|
|
.arg("*")
|
|
.arg(&message)
|
|
.output()
|
|
.map_err(|e| format!("Failed to send message: {}", e))?;
|
|
|
|
Ok(())
|
|
}
|