mirror of
https://github.com/luminous-devs/lume.git
synced 2024-09-19 11:43:30 +00:00
add composer shortcut
This commit is contained in:
parent
f944693a2a
commit
ad51971239
@ -16,7 +16,7 @@ tauri-build = { version = "1.2", features = [] }
|
||||
[dependencies]
|
||||
serde_json = "1.0"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
tauri = { version = "1.2", features = ["clipboard-read-text", "clipboard-write-text", "dialog-open", "fs-read-dir", "fs-read-file", "http-all", "http-multipart", "notification-all", "os-all", "process-relaunch", "shell-open", "system-tray", "updater", "window-close", "window-start-dragging"] }
|
||||
tauri = { version = "1.2", features = [ "global-shortcut-all", "clipboard-read-text", "clipboard-write-text", "dialog-open", "fs-read-dir", "fs-read-file", "http-all", "http-multipart", "notification-all", "os-all", "process-relaunch", "shell-open", "system-tray", "updater", "window-close", "window-start-dragging"] }
|
||||
tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
||||
tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
||||
sqlx-cli = {version = "0.6.3", default-features = false, features = ["sqlite"] }
|
||||
|
@ -66,6 +66,9 @@
|
||||
"exit": false,
|
||||
"relaunch": true,
|
||||
"relaunchDangerousAllowSymlinkMacos": false
|
||||
},
|
||||
"globalShortcut": {
|
||||
"all": true
|
||||
}
|
||||
},
|
||||
"bundle": {
|
||||
|
@ -9,7 +9,7 @@ export function Button({
|
||||
}: {
|
||||
preset: "small" | "publish" | "large";
|
||||
children: ReactNode;
|
||||
disabled: boolean;
|
||||
disabled?: boolean;
|
||||
onClick?: () => void;
|
||||
}) {
|
||||
let preClass: string;
|
||||
|
@ -10,7 +10,9 @@ import {
|
||||
} from "@shared/icons";
|
||||
import { useActiveAccount } from "@stores/accounts";
|
||||
import { useComposer } from "@stores/composer";
|
||||
import { Fragment } from "react";
|
||||
import { COMPOSE_SHORTCUT } from "@stores/shortcuts";
|
||||
import { register } from "@tauri-apps/api/globalShortcut";
|
||||
import { Fragment, useEffect } from "react";
|
||||
|
||||
export function Composer() {
|
||||
const account = useActiveAccount((state: any) => state.account);
|
||||
@ -23,6 +25,16 @@ export function Composer() {
|
||||
toggle(false);
|
||||
};
|
||||
|
||||
const registerShortcut = async () => {
|
||||
await register(COMPOSE_SHORTCUT, () => {
|
||||
toggle(true);
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
registerShortcut();
|
||||
}, [registerShortcut]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Button onClick={() => toggle(true)} preset="small">
|
||||
|
1
src/stores/shortcuts.tsx
Normal file
1
src/stores/shortcuts.tsx
Normal file
@ -0,0 +1 @@
|
||||
export const COMPOSE_SHORTCUT = "CommandOrControl+N";
|
Loading…
Reference in New Issue
Block a user