Skip to content

Commit

Permalink
fix: 修复MacOS无法设置Command快捷键及设置某些快捷键后闪退的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Pylogmon committed May 18, 2023
1 parent 309b4e5 commit 17fbfd8
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/windows/Config/pages/ShortCutConfig/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default function ShortCutConfig() {
const [shortcutOcr, setShortcutOcr] = useAtom(shortcutOcrAtom);
const [ismacos, setIsmacos] = useState(false);

const supportKey = ['Control', 'Shift', 'Alt', 'Command', 'Meta', 'Option'];
const supportKey = ['Control', 'Shift', 'Alt', 'Meta'];

useEffect(() => {
invoke('is_macos').then((v) => {
Expand All @@ -33,7 +33,11 @@ export default function ShortCutConfig() {
} else {
if (supportKey.includes(e.key)) {
if (e.key == 'Meta' && !ismacos) {
e.key = 'Super';
if (ismacos) {
e.key = 'Command';
} else {
e.key = 'Super';
}
}
if (value) {
let values = value.split('+');
Expand All @@ -45,7 +49,7 @@ export default function ShortCutConfig() {
} else {
setKey(e.key);
}
} else if (e.key.startsWith('F')) {
} else if (e.key.startsWith('F') && !ismacos) {
setKey(e.key);
} else {
if (e.keyCode == 8) {
Expand Down

0 comments on commit 17fbfd8

Please sign in to comment.