mirror of
https://github.com/rubickCenter/rubick
synced 2025-06-09 20:34:10 +08:00
🏁 fix #180
This commit is contained in:
parent
de7fee6a23
commit
e52d3bbbc9
@ -36,12 +36,31 @@
|
|||||||
<div class="label">显示/隐藏快捷键</div>
|
<div class="label">显示/隐藏快捷键</div>
|
||||||
<a-tooltip placement="top" trigger="click">
|
<a-tooltip placement="top" trigger="click">
|
||||||
<template #title>
|
<template #title>
|
||||||
<span>{{ tipText }} </span>
|
<span>{{ tipText }}</span>
|
||||||
|
<template v-if="isWindows">
|
||||||
|
<br />
|
||||||
|
<span
|
||||||
|
style="cursor: pointer; text-decoration: underline"
|
||||||
|
@click="resetDefault('Alt')"
|
||||||
|
>
|
||||||
|
Alt+Space
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
style="
|
||||||
|
cursor: pointer;
|
||||||
|
margin-left: 8px;
|
||||||
|
text-decoration: underline;
|
||||||
|
"
|
||||||
|
@click="resetDefault('Ctrl')"
|
||||||
|
>
|
||||||
|
Ctrl+Space
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
<div
|
<div
|
||||||
class="value"
|
class="value"
|
||||||
tabIndex="-1"
|
tabIndex="-1"
|
||||||
@keyup="e => changeShortCut(e, 'showAndHidden')"
|
@keyup="(e) => changeShortCut(e, 'showAndHidden')"
|
||||||
>
|
>
|
||||||
{{ shortCut.showAndHidden }}
|
{{ shortCut.showAndHidden }}
|
||||||
</div>
|
</div>
|
||||||
@ -51,12 +70,12 @@
|
|||||||
<div class="label">截屏</div>
|
<div class="label">截屏</div>
|
||||||
<a-tooltip placement="top" trigger="click">
|
<a-tooltip placement="top" trigger="click">
|
||||||
<template #title>
|
<template #title>
|
||||||
<span>{{ tipText }} </span>
|
<span>{{ tipText }}</span>
|
||||||
</template>
|
</template>
|
||||||
<div
|
<div
|
||||||
class="value"
|
class="value"
|
||||||
tabIndex="-1"
|
tabIndex="-1"
|
||||||
@keyup="e => changeShortCut(e, 'capture')"
|
@keyup="(e) => changeShortCut(e, 'capture')"
|
||||||
>
|
>
|
||||||
{{ shortCut.capture }}
|
{{ shortCut.capture }}
|
||||||
</div>
|
</div>
|
||||||
@ -129,12 +148,12 @@
|
|||||||
<template :key="index" v-for="(item, index) in global">
|
<template :key="index" v-for="(item, index) in global">
|
||||||
<a-tooltip placement="top" trigger="click">
|
<a-tooltip placement="top" trigger="click">
|
||||||
<template #title>
|
<template #title>
|
||||||
<span>{{ tipText }}或按 F1-F12 单键 </span>
|
<span>{{ tipText }}或按 F1-F12 单键</span>
|
||||||
</template>
|
</template>
|
||||||
<div
|
<div
|
||||||
class="value"
|
class="value"
|
||||||
tabIndex="2"
|
tabIndex="2"
|
||||||
@keyup="e => changeGlobalKey(e, index)"
|
@keyup="(e) => changeGlobalKey(e, index)"
|
||||||
>
|
>
|
||||||
{{ item.key }}
|
{{ item.key }}
|
||||||
<MinusCircleOutlined
|
<MinusCircleOutlined
|
||||||
@ -152,7 +171,7 @@
|
|||||||
class="value"
|
class="value"
|
||||||
allowClear
|
allowClear
|
||||||
:disabled="!item.key"
|
:disabled="!item.key"
|
||||||
@change="e => changeGlobalValue(index, e.target.value)"
|
@change="(e) => changeGlobalValue(index, e.target.value)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
@ -176,41 +195,42 @@ import {
|
|||||||
MinusCircleOutlined,
|
MinusCircleOutlined,
|
||||||
PlusCircleOutlined,
|
PlusCircleOutlined,
|
||||||
FileAddOutlined,
|
FileAddOutlined,
|
||||||
} from "@ant-design/icons-vue";
|
} from '@ant-design/icons-vue';
|
||||||
import debounce from "lodash.debounce";
|
import debounce from 'lodash.debounce';
|
||||||
import { ref, reactive, watch, toRefs, computed, toRaw } from "vue";
|
import { ref, reactive, watch, toRefs, computed, toRaw } from 'vue';
|
||||||
import keycodes from "./keycode";
|
import keycodes from './keycode';
|
||||||
import Localhost from "./localhost.vue";
|
import Localhost from './localhost.vue';
|
||||||
import SuperPanel from "./super-panel.vue";
|
import SuperPanel from './super-panel.vue';
|
||||||
|
|
||||||
const { remote, ipcRenderer } = window.require("electron");
|
const { remote, ipcRenderer } = window.require('electron');
|
||||||
|
|
||||||
const examples = [
|
const examples = [
|
||||||
{
|
{
|
||||||
title: "快捷键 「 Alt + W」 关键字 「 微信」",
|
title: '快捷键 「 Alt + W」 关键字 「 微信」',
|
||||||
desc: "按下Alt + W 直接打开本地微信应用"
|
desc: '按下Alt + W 直接打开本地微信应用',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "快捷键 「 Alt + Q」 关键字 「 取色」",
|
title: '快捷键 「 Alt + Q」 关键字 「 取色」',
|
||||||
desc: "按下Alt + Q 直接打开屏幕取色功能"
|
desc: '按下Alt + Q 直接打开屏幕取色功能',
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
shortCut: {},
|
shortCut: {},
|
||||||
common: {},
|
common: {},
|
||||||
local: {},
|
local: {},
|
||||||
global: []
|
global: [],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const isWindows = window?.rubick?.isWindows();
|
||||||
const tipText = computed(() => {
|
const tipText = computed(() => {
|
||||||
const optionKeyName = window.rubick.isMacOs() ? "Option、Command" : "Alt";
|
const optionKeyName = isWindows ? 'Alt' : 'Option、Command';
|
||||||
return `先按功能键(Ctrl、Shift、${optionKeyName}),再按其他普通键。`;
|
return `先按功能键(Ctrl、Shift、${optionKeyName}),再按其他普通键。`;
|
||||||
});
|
});
|
||||||
|
|
||||||
const currentSelect = ref(["normal"]);
|
const currentSelect = ref(['normal']);
|
||||||
|
|
||||||
const { perf, global: defaultGlobal } = remote.getGlobal("OP_CONFIG").get();
|
const { perf, global: defaultGlobal } = remote.getGlobal('OP_CONFIG').get();
|
||||||
|
|
||||||
state.shortCut = perf.shortCut;
|
state.shortCut = perf.shortCut;
|
||||||
state.common = perf.common;
|
state.common = perf.common;
|
||||||
@ -218,19 +238,19 @@ state.local = perf.local;
|
|||||||
state.global = defaultGlobal;
|
state.global = defaultGlobal;
|
||||||
|
|
||||||
const setConfig = debounce(() => {
|
const setConfig = debounce(() => {
|
||||||
remote.getGlobal("OP_CONFIG").set(
|
remote.getGlobal('OP_CONFIG').set(
|
||||||
JSON.parse(
|
JSON.parse(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
perf: {
|
perf: {
|
||||||
shortCut: state.shortCut,
|
shortCut: state.shortCut,
|
||||||
common: state.common,
|
common: state.common,
|
||||||
local: state.local
|
local: state.local,
|
||||||
},
|
},
|
||||||
global: state.global
|
global: state.global,
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
ipcRenderer.send("re-register");
|
ipcRenderer.send('re-register');
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
watch(state, setConfig);
|
watch(state, setConfig);
|
||||||
@ -280,6 +300,22 @@ const changeGlobalKey = (e, index) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const resetDefault = (key) => {
|
||||||
|
switch (key) {
|
||||||
|
case 'Alt':
|
||||||
|
state.shortCut['showAndHidden'] = 'Option+SPACE';
|
||||||
|
// copyValue.value = "Option+SPACE";
|
||||||
|
break;
|
||||||
|
case 'Ctrl':
|
||||||
|
state.shortCut['showAndHidden'] = 'Ctrl+SPACE';
|
||||||
|
// copyValue.value = "Ctrl+SPACE";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
setConfig();
|
||||||
|
};
|
||||||
|
|
||||||
const changeGlobalValue = (index, value) => {
|
const changeGlobalValue = (index, value) => {
|
||||||
state.global[index].value = value;
|
state.global[index].value = value;
|
||||||
};
|
};
|
||||||
@ -291,8 +327,8 @@ const deleteGlobalKey = (e, index) => {
|
|||||||
|
|
||||||
const addConfig = () => {
|
const addConfig = () => {
|
||||||
state.global.push({
|
state.global.push({
|
||||||
key: "",
|
key: '',
|
||||||
value: ""
|
value: '',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -300,13 +336,13 @@ const { shortCut, common, local, global } = toRefs(state);
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
@import "~@/assets/common.less";
|
@import '~@/assets/common.less';
|
||||||
.settings {
|
.settings {
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
background: var(--color-body-bg);
|
background: var(--color-body-bg);
|
||||||
height: calc(~"100vh - 46px");
|
height: calc(~'100vh - 46px');
|
||||||
display: flex;
|
display: flex;
|
||||||
.settings-detail {
|
.settings-detail {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
@ -337,6 +373,7 @@ const { shortCut, common, local, global } = toRefs(state);
|
|||||||
}
|
}
|
||||||
.value {
|
.value {
|
||||||
width: 300px;
|
width: 300px;
|
||||||
|
cursor: pointer;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border: 1px solid var(--color-border-light);
|
border: 1px solid var(--color-border-light);
|
||||||
color: #6c9fe2;
|
color: #6c9fe2;
|
||||||
@ -366,6 +403,7 @@ const { shortCut, common, local, global } = toRefs(state);
|
|||||||
margin-left: 20px;
|
margin-left: 20px;
|
||||||
}
|
}
|
||||||
.value {
|
.value {
|
||||||
|
cursor: pointer;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
border: 1px solid var(--color-border-light);
|
border: 1px solid var(--color-border-light);
|
||||||
color: #6c9fe2;
|
color: #6c9fe2;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "rubick",
|
"name": "rubick",
|
||||||
"version": "2.2.6",
|
"version": "2.2.7",
|
||||||
"author": "muwoo <2424880409@qq.com>",
|
"author": "muwoo <2424880409@qq.com>",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user