mirror of
https://github.com/0PandaDEV/Qopy.git
synced 2025-04-21 13:14:04 +02:00
change keybind test
This commit is contained in:
parent
0b077a9b2e
commit
ebf6e0311f
8 changed files with 780 additions and 531 deletions
53
pages/keybind.vue
Normal file
53
pages/keybind.vue
Normal file
|
@ -0,0 +1,53 @@
|
|||
<template>
|
||||
<div class="bg">
|
||||
<div class="keybind-container">
|
||||
<h2>Set New Keybind</h2>
|
||||
<div
|
||||
class="keybind-input"
|
||||
tabindex="0"
|
||||
@focus="startCapture"
|
||||
@blur="stopCapture"
|
||||
ref="keybindInput"
|
||||
>
|
||||
{{ currentKeybind || 'Click here, then press your desired key combination' }}
|
||||
</div>
|
||||
<button @click="saveKeybind" :disabled="!currentKeybind">Save Keybind</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onUnmounted } from 'vue';
|
||||
import { invoke } from '@tauri-apps/api/core';
|
||||
import { listen } from '@tauri-apps/api/event';
|
||||
|
||||
const currentKeybind = ref('');
|
||||
const keybindInput = ref<HTMLElement | null>(null);
|
||||
|
||||
const startCapture = async () => {
|
||||
await invoke('start_keybind_capture');
|
||||
};
|
||||
|
||||
const stopCapture = async () => {
|
||||
await invoke('stop_keybind_capture');
|
||||
};
|
||||
|
||||
const saveKeybind = () => {
|
||||
console.log('Saving keybind:', currentKeybind.value);
|
||||
// Implement saving logic here
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
const unlisten = await listen('keybind_captured', (event: any) => {
|
||||
currentKeybind.value = event.payload as string;
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
unlisten();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import '~/assets/css/keybind.scss';
|
||||
</style>
|
Loading…
Add table
Add a link
Reference in a new issue