icon update + color tray when recording
2
.gitignore
vendored
|
|
@ -23,4 +23,4 @@ dist-ssr
|
|||
*.sln
|
||||
*.sw?
|
||||
|
||||
src-tauri/resources
|
||||
src-tauri/resources/models
|
||||
1
src-tauri/Cargo.lock
generated
|
|
@ -4779,6 +4779,7 @@ dependencies = [
|
|||
"gtk",
|
||||
"heck 0.5.0",
|
||||
"http",
|
||||
"image",
|
||||
"jni",
|
||||
"libc",
|
||||
"log",
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ crate-type = ["staticlib", "cdylib", "rlib"]
|
|||
tauri-build = { version = "2", features = [] }
|
||||
|
||||
[dependencies]
|
||||
tauri = { version = "2", features = ["tray-icon"] }
|
||||
tauri = { version = "2", features = ["tray-icon", 'image-png'] }
|
||||
tauri-plugin-opener = "2"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 2.3 KiB |
BIN
src-tauri/icons/64x64.png
Normal file
|
After Width: | Height: | Size: 5.6 KiB |
BIN
src-tauri/icons/Square107x107Logo.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
src-tauri/icons/Square142x142Logo.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
src-tauri/icons/Square150x150Logo.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
src-tauri/icons/Square284x284Logo.png
Normal file
|
After Width: | Height: | Size: 34 KiB |
BIN
src-tauri/icons/Square30x30Logo.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
src-tauri/icons/Square310x310Logo.png
Normal file
|
After Width: | Height: | Size: 38 KiB |
BIN
src-tauri/icons/Square44x44Logo.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
src-tauri/icons/Square71x71Logo.png
Normal file
|
After Width: | Height: | Size: 6.4 KiB |
BIN
src-tauri/icons/Square89x89Logo.png
Normal file
|
After Width: | Height: | Size: 8.5 KiB |
BIN
src-tauri/icons/StoreLogo.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
src-tauri/icons/android/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 4 KiB |
BIN
src-tauri/icons/android/mipmap-hdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
src-tauri/icons/android/mipmap-hdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 4 KiB |
BIN
src-tauri/icons/android/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
src-tauri/icons/android/mipmap-mdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
src-tauri/icons/android/mipmap-mdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
BIN
src-tauri/icons/android/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
BIN
src-tauri/icons/android/mipmap-xhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 24 KiB |
BIN
src-tauri/icons/android/mipmap-xhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 9.3 KiB |
BIN
src-tauri/icons/android/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_foreground.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 55 KiB |
BIN
src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 46 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 67 KiB |
BIN
src-tauri/icons/ios/AppIcon-20x20@1x.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
src-tauri/icons/ios/AppIcon-20x20@2x-1.png
Normal file
|
After Width: | Height: | Size: 3 KiB |
BIN
src-tauri/icons/ios/AppIcon-20x20@2x.png
Normal file
|
After Width: | Height: | Size: 3 KiB |
BIN
src-tauri/icons/ios/AppIcon-20x20@3x.png
Normal file
|
After Width: | Height: | Size: 5.1 KiB |
BIN
src-tauri/icons/ios/AppIcon-29x29@1x.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
src-tauri/icons/ios/AppIcon-29x29@2x-1.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
src-tauri/icons/ios/AppIcon-29x29@2x.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
src-tauri/icons/ios/AppIcon-29x29@3x.png
Normal file
|
After Width: | Height: | Size: 8 KiB |
BIN
src-tauri/icons/ios/AppIcon-40x40@1x.png
Normal file
|
After Width: | Height: | Size: 3 KiB |
BIN
src-tauri/icons/ios/AppIcon-40x40@2x-1.png
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
BIN
src-tauri/icons/ios/AppIcon-40x40@2x.png
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
BIN
src-tauri/icons/ios/AppIcon-40x40@3x.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
src-tauri/icons/ios/AppIcon-512@2x.png
Normal file
|
After Width: | Height: | Size: 63 KiB |
BIN
src-tauri/icons/ios/AppIcon-60x60@2x.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
src-tauri/icons/ios/AppIcon-60x60@3x.png
Normal file
|
After Width: | Height: | Size: 19 KiB |
BIN
src-tauri/icons/ios/AppIcon-76x76@1x.png
Normal file
|
After Width: | Height: | Size: 6.8 KiB |
BIN
src-tauri/icons/ios/AppIcon-76x76@2x.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
BIN
src-tauri/icons/ios/AppIcon-83.5x83.5@2x.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
BIN
src-tauri/icons/logo.png
Normal file
|
After Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 469 B After Width: | Height: | Size: 469 B |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
BIN
src-tauri/resources/tray_recording_64x64.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
src-tauri/resources/tray_transcribing_64x64.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
|
|
@ -7,6 +7,8 @@ use managers::audio::AudioRecordingManager;
|
|||
use managers::transcription::TranscriptionManager;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::{Arc, Mutex};
|
||||
use tauri::image::Image;
|
||||
use tauri::menu::{Menu, MenuItem};
|
||||
use tauri::tray::TrayIconBuilder;
|
||||
use tauri::Manager;
|
||||
use tauri_plugin_autostart::MacosLauncher;
|
||||
|
|
@ -40,15 +42,36 @@ pub fn run() {
|
|||
.plugin(tauri_plugin_global_shortcut::Builder::new().build())
|
||||
.manage(AppState::new())
|
||||
.setup(move |app| {
|
||||
let _tray = TrayIconBuilder::new().build(app)?;
|
||||
let settings_i = MenuItem::with_id(app, "settings", "Settings", true, None::<&str>)?;
|
||||
let quit_i = MenuItem::with_id(app, "quit", "Quit", true, None::<&str>)?;
|
||||
let menu = Menu::with_items(app, &[&settings_i, &quit_i])?;
|
||||
let tray = TrayIconBuilder::new()
|
||||
.icon(Image::from_path(app.path().resolve(
|
||||
"resources/tray_64x64.png",
|
||||
tauri::path::BaseDirectory::Resource,
|
||||
)?)?)
|
||||
.menu(&menu)
|
||||
.show_menu_on_left_click(true)
|
||||
.on_menu_event(|app, event| match event.id.as_ref() {
|
||||
"settings" => {
|
||||
let settings_window = app.get_webview_window("main").unwrap();
|
||||
settings_window.show().unwrap();
|
||||
}
|
||||
"quit" => {
|
||||
app.exit(0);
|
||||
}
|
||||
_ => {}
|
||||
})
|
||||
.build(app)?;
|
||||
app.manage(tray);
|
||||
|
||||
let vad_path = app.path().resolve(
|
||||
"resources/silero_vad_v4.onnx",
|
||||
"resources/models/silero_vad_v4.onnx",
|
||||
tauri::path::BaseDirectory::Resource,
|
||||
)?;
|
||||
|
||||
let whisper_path = app.path().resolve(
|
||||
"resources/ggml-small.bin",
|
||||
"resources/models/ggml-small.bin",
|
||||
tauri::path::BaseDirectory::Resource,
|
||||
)?;
|
||||
|
||||
|
|
@ -75,6 +98,14 @@ pub fn run() {
|
|||
})
|
||||
.on_window_event(|window, event| match event {
|
||||
tauri::WindowEvent::CloseRequested { api, .. } => {
|
||||
#[cfg(target_os = "macos")]
|
||||
let res = window
|
||||
.app_handle()
|
||||
.set_activation_policy(tauri::ActivationPolicy::Accessory);
|
||||
if let Err(e) = res {
|
||||
println!("Failed to set activation policy: {}", e);
|
||||
}
|
||||
|
||||
api.prevent_close();
|
||||
|
||||
// TODO may be different on windows, this works for macos
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use serde::Serialize;
|
||||
use tauri::image::Image;
|
||||
use tauri::tray::TrayIcon;
|
||||
use tauri::App;
|
||||
use tauri::AppHandle;
|
||||
use tauri::Manager;
|
||||
|
|
@ -14,11 +16,37 @@ use crate::settings::ShortcutBinding;
|
|||
use crate::utils;
|
||||
|
||||
fn transcribe_pressed(app: &AppHandle) {
|
||||
let tray = app.state::<TrayIcon>();
|
||||
tray.set_icon(Some(
|
||||
Image::from_path(
|
||||
app.path()
|
||||
.resolve(
|
||||
"resources/tray_recording_64x64.png",
|
||||
tauri::path::BaseDirectory::Resource,
|
||||
)
|
||||
.expect("failed to resolve"),
|
||||
)
|
||||
.expect("failed to set icon"),
|
||||
));
|
||||
|
||||
let rm = app.state::<Arc<AudioRecordingManager>>();
|
||||
rm.try_start_recording("transcribe");
|
||||
}
|
||||
|
||||
fn transcribe_released(app: &AppHandle) {
|
||||
let tray = app.state::<TrayIcon>();
|
||||
tray.set_icon(Some(
|
||||
Image::from_path(
|
||||
app.path()
|
||||
.resolve(
|
||||
"resources/tray_64x64.png",
|
||||
tauri::path::BaseDirectory::Resource,
|
||||
)
|
||||
.expect("failed to resolve"),
|
||||
)
|
||||
.expect("failed to set icon"),
|
||||
));
|
||||
|
||||
let ah = app.clone();
|
||||
let rm = Arc::clone(&app.state::<Arc<AudioRecordingManager>>());
|
||||
let tm = Arc::clone(&app.state::<Arc<TranscriptionManager>>());
|
||||
|
|
|
|||
|
|
@ -19,15 +19,12 @@
|
|||
],
|
||||
"security": {
|
||||
"csp": null
|
||||
},
|
||||
"trayIcon": {
|
||||
"iconPath": "icons/tray_64x64.png"
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
"active": true,
|
||||
"targets": "all",
|
||||
"resources": ["resources/*"],
|
||||
"resources": ["resources/**/*"],
|
||||
"icon": [
|
||||
"icons/32x32.png",
|
||||
"icons/128x128.png",
|
||||
|
|
|
|||
22
src/App.tsx
|
|
@ -8,6 +8,24 @@ import {
|
|||
import { register } from "@tauri-apps/plugin-global-shortcut";
|
||||
import HandyTextLogo from "./components/icons/HandyTextLogo";
|
||||
import { invoke } from "@tauri-apps/api/core";
|
||||
// import { TrayIcon } from "@tauri-apps/api/tray";
|
||||
// import { Menu } from "@tauri-apps/api/menu";
|
||||
// import { defaultWindowIcon } from "@tauri-apps/api/app";
|
||||
|
||||
// const menu = await Menu.new({
|
||||
// items: [
|
||||
// {
|
||||
// id: "quit",
|
||||
// text: "Quit",
|
||||
// },
|
||||
// ],
|
||||
// });
|
||||
|
||||
// const options = {
|
||||
// icon: await defaultWindowIcon(),
|
||||
// menu,
|
||||
// menuOnLeftClick: true,
|
||||
// };
|
||||
|
||||
function App() {
|
||||
const [hasAccessibility, setHasAccessibility] = useState(false);
|
||||
|
|
@ -23,6 +41,10 @@ function App() {
|
|||
setHasAccessibility(hasPermissions);
|
||||
});
|
||||
|
||||
// TrayIcon.new(options).then((t) => {
|
||||
// console.log("tray init", t);
|
||||
// });
|
||||
|
||||
// invoke("set_binding", {
|
||||
// id: "test",
|
||||
// binding: "alt+d",
|
||||
|
|
|
|||