Attempt to fix import/export GUI clipboard for some distros.

This commit is contained in:
Storm Dragon 2025-04-16 21:50:37 -04:00
parent 6edb743c23
commit bbfd2790a9
2 changed files with 4 additions and 0 deletions

View File

@ -6,6 +6,7 @@
from fenrirscreenreader.core import debug from fenrirscreenreader.core import debug
import os import os
import importlib
import _thread import _thread
import pyperclip import pyperclip
@ -42,6 +43,7 @@ class command():
# Set display environment variable # Set display environment variable
os.environ['DISPLAY'] = display os.environ['DISPLAY'] = display
# Attempt to set clipboard content # Attempt to set clipboard content
importlib.reload(pyperclip) # Weird workaround for some distros
pyperclip.copy(clipboard) pyperclip.copy(clipboard)
# If we get here without exception, we found a working display # If we get here without exception, we found a working display
success = True success = True

View File

@ -5,6 +5,7 @@
# By Chrys, Storm Dragon, and contributers. # By Chrys, Storm Dragon, and contributers.
from fenrirscreenreader.core import debug from fenrirscreenreader.core import debug
import importlib
import _thread import _thread
import pyperclip import pyperclip
import os import os
@ -34,6 +35,7 @@ class command():
# Set display environment variable # Set display environment variable
os.environ['DISPLAY'] = display os.environ['DISPLAY'] = display
# Attempt to get clipboard content # Attempt to get clipboard content
importlib.reload(pyperclip) # Weird workaround for some distros
clipboardContent = pyperclip.paste() clipboardContent = pyperclip.paste()
# If we get here without exception, we found a working display # If we get here without exception, we found a working display
if clipboardContent: if clipboardContent: