Update settings menu test for new option

This commit is contained in:
thePR0M3TH3AN
2025-07-03 23:55:27 -04:00
parent 838ef90ddf
commit 9b9fc038d3
13 changed files with 326 additions and 25 deletions

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
src/utils/clipboard.py Normal file
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()