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]
|
[dependencies]
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
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-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" }
|
tauri-plugin-store = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "dev" }
|
||||||
sqlx-cli = {version = "0.6.3", default-features = false, features = ["sqlite"] }
|
sqlx-cli = {version = "0.6.3", default-features = false, features = ["sqlite"] }
|
||||||
|
@ -66,6 +66,9 @@
|
|||||||
"exit": false,
|
"exit": false,
|
||||||
"relaunch": true,
|
"relaunch": true,
|
||||||
"relaunchDangerousAllowSymlinkMacos": false
|
"relaunchDangerousAllowSymlinkMacos": false
|
||||||
|
},
|
||||||
|
"globalShortcut": {
|
||||||
|
"all": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"bundle": {
|
"bundle": {
|
||||||
|
@ -9,7 +9,7 @@ export function Button({
|
|||||||
}: {
|
}: {
|
||||||
preset: "small" | "publish" | "large";
|
preset: "small" | "publish" | "large";
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
disabled: boolean;
|
disabled?: boolean;
|
||||||
onClick?: () => void;
|
onClick?: () => void;
|
||||||
}) {
|
}) {
|
||||||
let preClass: string;
|
let preClass: string;
|
||||||
|
@ -10,7 +10,9 @@ import {
|
|||||||
} from "@shared/icons";
|
} from "@shared/icons";
|
||||||
import { useActiveAccount } from "@stores/accounts";
|
import { useActiveAccount } from "@stores/accounts";
|
||||||
import { useComposer } from "@stores/composer";
|
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() {
|
export function Composer() {
|
||||||
const account = useActiveAccount((state: any) => state.account);
|
const account = useActiveAccount((state: any) => state.account);
|
||||||
@ -23,6 +25,16 @@ export function Composer() {
|
|||||||
toggle(false);
|
toggle(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const registerShortcut = async () => {
|
||||||
|
await register(COMPOSE_SHORTCUT, () => {
|
||||||
|
toggle(true);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
registerShortcut();
|
||||||
|
}, [registerShortcut]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Button onClick={() => toggle(true)} preset="small">
|
<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