From bbfd2790a9b50e2ffdcdf45fb4fb2071862c2364 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Wed, 16 Apr 2025 21:50:37 -0400 Subject: [PATCH] Attempt to fix import/export GUI clipboard for some distros. --- .../commands/commands/export_clipboard_to_x.py | 2 ++ .../commands/commands/import_clipboard_from_x.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py b/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py index e4a7fe49..296c93bd 100644 --- a/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py +++ b/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py @@ -6,6 +6,7 @@ from fenrirscreenreader.core import debug import os +import importlib import _thread import pyperclip @@ -42,6 +43,7 @@ class command(): # Set display environment variable os.environ['DISPLAY'] = display # Attempt to set clipboard content + importlib.reload(pyperclip) # Weird workaround for some distros pyperclip.copy(clipboard) # If we get here without exception, we found a working display success = True diff --git a/src/fenrirscreenreader/commands/commands/import_clipboard_from_x.py b/src/fenrirscreenreader/commands/commands/import_clipboard_from_x.py index 2d6224d5..40f395e1 100644 --- a/src/fenrirscreenreader/commands/commands/import_clipboard_from_x.py +++ b/src/fenrirscreenreader/commands/commands/import_clipboard_from_x.py @@ -5,6 +5,7 @@ # By Chrys, Storm Dragon, and contributers. from fenrirscreenreader.core import debug +import importlib import _thread import pyperclip import os @@ -34,6 +35,7 @@ class command(): # Set display environment variable os.environ['DISPLAY'] = display # Attempt to get clipboard content + importlib.reload(pyperclip) # Weird workaround for some distros clipboardContent = pyperclip.paste() # If we get here without exception, we found a working display if clipboardContent: