diff --git a/frontend/index.html b/frontend/index.html index 72321d1..9b779b8 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -41,18 +41,19 @@
Input
- -
- + + diff --git a/frontend/src/main.js b/frontend/src/main.js index 2f439fe..11cecc1 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -24,12 +24,18 @@ async function loadSettings() { // Populate fields document.getElementById('apiKey').value = settings.api_key || ''; - document.getElementById('shortcutInput').value = settings.shortcut || 'alt+z'; document.getElementById('whisperModel').value = settings.whisper_model || 'whisper-large-v3-turbo'; document.getElementById('aiModel').value = settings.ai_model || 'llama-3.3-70b-versatile'; document.getElementById('aiPrompt').value = settings.ai_prompt || ''; document.getElementById('startupToggle').checked = settings.startup || false; + if (settings.linux_press_mode) { + const section = document.getElementById('linuxPressSection'); + const cmdInput = document.getElementById('linuxPressCommand'); + if (section) section.style.display = 'block'; + if (cmdInput) cmdInput.value = settings.linux_press_command || ''; + } + // Load history renderHistory(settings.history || []); @@ -123,25 +129,28 @@ async function saveApiKey() { showToast('API Key saved'); } -// Save Shortcut -async function saveShortcut() { - const shortcut = document.getElementById('shortcutInput').value.trim().toLowerCase(); - if (!shortcut) { - alert('Please enter a shortcut'); - return; +async function copyLinuxPressCommand() { + const cmdInput = document.getElementById('linuxPressCommand'); + if (!cmdInput) return; + + const command = cmdInput.value || ''; + try { + if (navigator.clipboard && navigator.clipboard.writeText) { + await navigator.clipboard.writeText(command); + } else { + cmdInput.focus(); + cmdInput.select(); + document.execCommand('copy'); + } + showToast('Command copied'); + } catch (err) { + console.error('Failed to copy Linux command:', err); } - - const parts = shortcut.split('+'); - if (parts.length < 2) { - alert('Shortcut must have a modifier + key (e.g., ctrl+x)'); - return; - } - - await saveSetting('shortcut', shortcut); - showToast('Shortcut saved: ' + shortcut); } +window.copyLinuxPressCommand = copyLinuxPressCommand; + // Save Whisper Model async function saveWhisperModel() { const model = document.getElementById('whisperModel').value;