Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
Add shortcut to open settings (#935)
Wesley4bc8e516ce09
diff --git a/apps/desktop/src-tauri/src/hotkeys.rs b/apps/desktop/src-tauri/src/hotkeys.rsindex 0247fdd58..d59cab3f3 100644--- a/apps/desktop/src-tauri/src/hotkeys.rs+++ b/apps/desktop/src-tauri/src/hotkeys.rs@@ -1,4 +1,4 @@-use crate::{RequestStartRecording, recording};+use crate::{RequestStartRecording, recording, windows::ShowCapWindow};use global_hotkey::HotKeyState;use serde::{Deserialize, Serialize};use specta::Type;@@ -81,6 +81,13 @@ pub fn init(app: &AppHandle) {OnEscapePress.emit(app).ok();}+ if shortcut.key == Code::Comma && shortcut.mods == Modifiers::META {+ let app = app.clone();+ tokio::spawn(async move {+ let _ = ShowCapWindow::Settings { page: None }.show(&app).await;+ });+ }+let state = app.state::<HotkeysState>();let store = state.lock().unwrap();@@ -94,7 +101,14 @@ pub fn init(app: &AppHandle) {).unwrap();- let store = HotkeysStore::get(app).unwrap().unwrap_or_default();+ let mut store = match HotkeysStore::get(app) {+ Ok(Some(s)) => s,+ Ok(None) => HotkeysStore::default(),+ Err(e) => {+ eprintln!("Failed to load hotkeys store: {e}");+ HotkeysStore::default()+ }+ };let global_shortcut = app.global_shortcut();for hotkey in store.hotkeys.values() {diff --git a/apps/desktop/src/routes/(window-chrome)/settings/hotkeys.tsx b/apps/desktop/src/routes/(window-chrome)/settings/hotkeys.tsxindex f45cd81f5..19e9e62d9 100644--- a/apps/desktop/src/routes/(window-chrome)/settings/hotkeys.tsx+++ b/apps/desktop/src/routes/(window-chrome)/settings/hotkeys.tsx@@ -169,7 +169,7 @@ function Inner(props: { initialStore: HotkeysStore | null }) {when={hotkeys[item()]}fallback={<p- class="flex items-center text-[11px] uppercase transition-colors hover:bg-gray-6 hover:border-gray-7+ class="flex items-center text-[11px] uppercase transition-colors hover:bg-gray-6 hover:border-gray-7cursor-pointer py-3 px-2.5 h-5 bg-gray-4 border border-gray-5 rounded-lg text-gray-11 hover:text-gray-12">None