diff --git a/AppImage/components/lxc-terminal-modal.tsx b/AppImage/components/lxc-terminal-modal.tsx index 1388861f..674662b7 100644 --- a/AppImage/components/lxc-terminal-modal.tsx +++ b/AppImage/components/lxc-terminal-modal.tsx @@ -12,7 +12,16 @@ import { ArrowRight, CornerDownLeft, GripHorizontal, + ChevronDown, } from "lucide-react" +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, + DropdownMenuSeparator, + DropdownMenuLabel, +} from "@/components/ui/dropdown-menu" import "xterm/css/xterm.css" import { API_PORT } from "@/lib/api-config" @@ -62,12 +71,7 @@ export function LxcTerminalModal({ const resizeBarRef = useRef(null) const modalHeightRef = useRef(500) - const [showLoginModal, setShowLoginModal] = useState(false) - const [loginUsername, setLoginUsername] = useState("") - const [loginPassword, setLoginPassword] = useState("") - const [loginError, setLoginError] = useState("") - const [isLoggingIn, setIsLoggingIn] = useState(false) - const waitingForPasswordRef = useRef(false) + // Detect mobile/tablet useEffect(() => { @@ -171,9 +175,9 @@ export function LxcTerminalModal({ const ws = new WebSocket(wsUrl) wsRef.current = ws - // Reset state for new connection - isInsideLxcRef.current = false - outputBufferRef.current = "" +// Reset state for new connection + isInsideLxcRef.current = false + outputBufferRef.current = "" ws.onopen = () => { setConnectionStatus("online") @@ -353,33 +357,6 @@ export function LxcTerminalModal({ const sendArrowRight = useCallback(() => sendKey("\x1b[C"), [sendKey]) const sendEnter = useCallback(() => sendKey("\r"), [sendKey]) const sendCtrlC = useCallback(() => sendKey("\x03"), [sendKey]) // Ctrl+C - - // Ctrl key state - user presses Ctrl button, then types a letter - const [ctrlPressed, setCtrlPressed] = useState(false) - - const handleCtrlPress = useCallback(() => { - setCtrlPressed(true) - setTimeout(() => setCtrlPressed(false), 3000) - }, []) - - // Handle keyboard input when Ctrl is pressed - useEffect(() => { - if (!ctrlPressed || !isOpen) return - - const handleKeyDown = (e: KeyboardEvent) => { - if (e.key.length === 1) { - e.preventDefault() - const code = e.key.toLowerCase().charCodeAt(0) - 96 - if (code >= 1 && code <= 26) { - sendKey(String.fromCharCode(code)) - } - setCtrlPressed(false) - } - } - - window.addEventListener("keydown", handleKeyDown) - return () => window.removeEventListener("keydown", handleKeyDown) - }, [ctrlPressed, isOpen, sendKey]) const showMobileControls = isMobile || isTablet @@ -477,16 +454,34 @@ export function LxcTerminalModal({ Enter - + + + + + + Control Sequences + + sendKey("\x03")}> + Ctrl+C + Cancel/Interrupt + + sendKey("\x18")}> + Ctrl+X + Exit (nano) + + sendKey("\x12")}> + Ctrl+R + Search history + + + )} diff --git a/AppImage/components/script-terminal-modal.tsx b/AppImage/components/script-terminal-modal.tsx index 95c58e00..11d891e0 100644 --- a/AppImage/components/script-terminal-modal.tsx +++ b/AppImage/components/script-terminal-modal.tsx @@ -15,7 +15,16 @@ import { ArrowRight, CornerDownLeft, GripHorizontal, + ChevronDown, } from "lucide-react" +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, + DropdownMenuSeparator, + DropdownMenuLabel, +} from "@/components/ui/dropdown-menu" import "xterm/css/xterm.css" import { API_PORT } from "@/lib/api-config" @@ -741,18 +750,34 @@ export function ScriptTerminalModal({ Enter - + + + + + + Control Sequences + + sendCommand("\x03")}> + Ctrl+C + Cancel/Interrupt + + sendCommand("\x18")}> + Ctrl+X + Exit (nano) + + sendCommand("\x12")}> + Ctrl+R + Search history + + + )} diff --git a/AppImage/components/terminal-panel.tsx b/AppImage/components/terminal-panel.tsx index 5a2be017..8c393348 100644 --- a/AppImage/components/terminal-panel.tsx +++ b/AppImage/components/terminal-panel.tsx @@ -15,7 +15,16 @@ import { AlignJustify, Grid2X2, GripHorizontal, + ChevronDown, } from "lucide-react" +import { + DropdownMenu, + DropdownMenuContent, + DropdownMenuItem, + DropdownMenuTrigger, + DropdownMenuSeparator, + DropdownMenuLabel, +} from "@/components/ui/dropdown-menu" import { Button } from "@/components/ui/button" import { Dialog, DialogContent, DialogHeader, DialogTitle, DialogDescription } from "@/components/ui/dialog" import { Input } from "@/components/ui/input" @@ -967,18 +976,34 @@ const handleClose = () => { > ↵ Enter - + + + + + + Control Sequences + + sendSequence("\x03")}> + Ctrl+C + Cancel/Interrupt + + sendSequence("\x18")}> + Ctrl+X + Exit (nano) + + sendSequence("\x12")}> + Ctrl+R + Search history + + + )}