Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

terminalFocus.ts

6 lines311 Bytes

1export function isTerminalFocused(): boolean {
2 const activeElement = document.activeElement;
3 if (!(activeElement instanceof HTMLElement)) return false;
4 if (activeElement.classList.contains("xterm-helper-textarea")) return true;
5 return activeElement.closest(".thread-terminal-drawer .xterm") !== null;
6}