Update settings menu test for new option

This commit is contained in:
thePR0M3TH3AN committed 2025-07-03 23:55:27 -04:00
1 parent 838ef90ddf
commit 9b9fc038d3
13 files changed
+326 -25

No files matched your search

+2
View File
@@ -25,6 +25,7 @@ try:
from .password_prompt import prompt_for_password
from .input_utils import timed_input
from .memory_protection import InMemorySecret
from .clipboard import copy_to_clipboard
if logger.isEnabledFor(logging.DEBUG):
logger.info("Modules imported successfully.")
@@ -49,4 +50,5 @@ __all__ = [
"prompt_for_password",
"timed_input",
"InMemorySecret",
"copy_to_clipboard",
]
+16
View File
@@ -0,0 +1,16 @@
import threading
import pyperclip
def copy_to_clipboard(text: str, timeout: int) -> None:
"""Copy text to the clipboard and clear after timeout seconds if unchanged."""
pyperclip.copy(text)
def clear_clipboard() -> None:
if pyperclip.paste() == text:
pyperclip.copy("")
timer = threading.Timer(timeout, clear_clipboard)
timer.daemon = True
timer.start()