From 742d3073dd43bb156dc1e3ef26c5dee5bbc90bac Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sun, 28 Apr 2019 11:27:50 -0400 Subject: [PATCH 1/8] used shel for export to X --- .../commands/commands/export_clipboard_to_x.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py b/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py index 2b344bf4..a8696518 100644 --- a/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py +++ b/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py @@ -7,6 +7,7 @@ from fenrirscreenreader.core import debug import subprocess, os from subprocess import Popen, PIPE +import shlex import _thread class command(): @@ -28,7 +29,7 @@ class command(): return clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') for display in range(10): - p = Popen('su ' + self.env['general']['currUser'] + ' -c "echo -n \\\"' + clipboard.replace('"','\\\\\\"') +'\\\" | xclip -d :' + str(display) + ' -selection c"' , stdout=PIPE, stderr=PIPE, shell=True) + p = Popen('su ' + self.env['general']['currUser'] + ' -c "echo -n ' + shlex.quote(clipboard) +' | xclip -d :' + str(display) + ' -selection c"' , stdout=PIPE, stderr=PIPE, shell=True) stdout, stderr = p.communicate() self.env['runtime']['outputManager'].interruptOutput() #screenEncoding = self.env['runtime']['settingsManager'].getSetting('screen', 'encoding') From c8f85351b6e05209d5d86db037209921b054ad50 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sun, 28 Apr 2019 11:40:08 -0400 Subject: [PATCH 2/8] try to make export to X handle strings with weird symbols, replaced the surrounding quotes. --- .../commands/commands/export_clipboard_to_x.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py b/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py index a8696518..c76a1e3d 100644 --- a/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py +++ b/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py @@ -29,7 +29,7 @@ class command(): return clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') for display in range(10): - p = Popen('su ' + self.env['general']['currUser'] + ' -c "echo -n ' + shlex.quote(clipboard) +' | xclip -d :' + str(display) + ' -selection c"' , stdout=PIPE, stderr=PIPE, shell=True) + p = Popen('su ' + self.env['general']['currUser'] + ' -c "echo -n \\\"' + shlex.quote(clipboard) +'\\\" | xclip -d :' + str(display) + ' -selection c"' , stdout=PIPE, stderr=PIPE, shell=True) stdout, stderr = p.communicate() self.env['runtime']['outputManager'].interruptOutput() #screenEncoding = self.env['runtime']['settingsManager'].getSetting('screen', 'encoding') From ee7dc30376680d103ca4df011eb429290c0ba8ff Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sun, 28 Apr 2019 19:40:42 -0400 Subject: [PATCH 3/8] Another attempt to fix the weird quoting stuff with export to x. --- .../commands/commands/export_clipboard_to_x.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py b/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py index c76a1e3d..e5cb04a0 100644 --- a/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py +++ b/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py @@ -29,7 +29,7 @@ class command(): return clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') for display in range(10): - p = Popen('su ' + self.env['general']['currUser'] + ' -c "echo -n \\\"' + shlex.quote(clipboard) +'\\\" | xclip -d :' + str(display) + ' -selection c"' , stdout=PIPE, stderr=PIPE, shell=True) + p = Popen("su " + self.env['general']['currUser'] + " -c \"echo -n " + shlex.quote(clipboard) + " | xclip -d :" + str(display) + " -selection c\"", stdout=PIPE, stderr=PIPE, shell=True) stdout, stderr = p.communicate() self.env['runtime']['outputManager'].interruptOutput() #screenEncoding = self.env['runtime']['settingsManager'].getSetting('screen', 'encoding') From 13d06d8470b8e33d6871f8fa3c95737fa6cc0560 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sun, 28 Apr 2019 21:00:12 -0400 Subject: [PATCH 4/8] Revert "Another attempt to fix the weird quoting stuff with export to x." This reverts commit ee7dc30376680d103ca4df011eb429290c0ba8ff. It didn't work. --- .../commands/commands/export_clipboard_to_x.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py b/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py index e5cb04a0..c76a1e3d 100644 --- a/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py +++ b/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py @@ -29,7 +29,7 @@ class command(): return clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') for display in range(10): - p = Popen("su " + self.env['general']['currUser'] + " -c \"echo -n " + shlex.quote(clipboard) + " | xclip -d :" + str(display) + " -selection c\"", stdout=PIPE, stderr=PIPE, shell=True) + p = Popen('su ' + self.env['general']['currUser'] + ' -c "echo -n \\\"' + shlex.quote(clipboard) +'\\\" | xclip -d :' + str(display) + ' -selection c"' , stdout=PIPE, stderr=PIPE, shell=True) stdout, stderr = p.communicate() self.env['runtime']['outputManager'].interruptOutput() #screenEncoding = self.env['runtime']['settingsManager'].getSetting('screen', 'encoding') From 014d23c61a3929bd0818f8a8f4d940354dcacb7d Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sun, 28 Apr 2019 21:10:47 -0400 Subject: [PATCH 5/8] tried to fix weird quote stuff with export to X by using a here document. --- .../commands/commands/export_clipboard_to_x.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py b/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py index c76a1e3d..c35d7d9d 100644 --- a/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py +++ b/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py @@ -29,7 +29,7 @@ class command(): return clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') for display in range(10): - p = Popen('su ' + self.env['general']['currUser'] + ' -c "echo -n \\\"' + shlex.quote(clipboard) +'\\\" | xclip -d :' + str(display) + ' -selection c"' , stdout=PIPE, stderr=PIPE, shell=True) + p = Popen('su ' + self.env['general']['currUser'] + ' -c "cat << \\\"EOF\\\"\n' + clipboard + '\nEOF | xclip -d :' + str(display) + ' -selection c"', stdout=PIPE, stderr=PIPE, shell=True) stdout, stderr = p.communicate() self.env['runtime']['outputManager'].interruptOutput() #screenEncoding = self.env['runtime']['settingsManager'].getSetting('screen', 'encoding') From 23badb0940a5892d1745714484220488e602ad27 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sun, 28 Apr 2019 21:17:28 -0400 Subject: [PATCH 6/8] Small bug fix with the export here document. --- .../commands/commands/export_clipboard_to_x.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py b/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py index c35d7d9d..4bab2148 100644 --- a/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py +++ b/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py @@ -29,7 +29,7 @@ class command(): return clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') for display in range(10): - p = Popen('su ' + self.env['general']['currUser'] + ' -c "cat << \\\"EOF\\\"\n' + clipboard + '\nEOF | xclip -d :' + str(display) + ' -selection c"', stdout=PIPE, stderr=PIPE, shell=True) + p = Popen('su ' + self.env['general']['currUser'] + ' -c "cat << \\\"EOF\\\"\n' + clipboard + '\nEOF\n | xclip -d :' + str(display) + ' -selection c"', stdout=PIPE, stderr=PIPE, shell=True) stdout, stderr = p.communicate() self.env['runtime']['outputManager'].interruptOutput() #screenEncoding = self.env['runtime']['settingsManager'].getSetting('screen', 'encoding') From 83fadb885486f1ba08ab8adfa8a99a27e271fac1 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sun, 28 Apr 2019 21:26:52 -0400 Subject: [PATCH 7/8] Forgot to move the pipe to the right spot for a here document. --- .../commands/commands/export_clipboard_to_x.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py b/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py index 4bab2148..b7e5681f 100644 --- a/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py +++ b/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py @@ -29,7 +29,7 @@ class command(): return clipboard = self.env['runtime']['memoryManager'].getIndexListElement('clipboardHistory') for display in range(10): - p = Popen('su ' + self.env['general']['currUser'] + ' -c "cat << \\\"EOF\\\"\n' + clipboard + '\nEOF\n | xclip -d :' + str(display) + ' -selection c"', stdout=PIPE, stderr=PIPE, shell=True) + p = Popen('su ' + self.env['general']['currUser'] + ' -c "cat << \\\"EOF\\\" | xclip -d :' + str(display) + ' -selection clipboard\n' + clipboard + '\nEOF\n"', stdout=PIPE, stderr=PIPE, shell=True) stdout, stderr = p.communicate() self.env['runtime']['outputManager'].interruptOutput() #screenEncoding = self.env['runtime']['settingsManager'].getSetting('screen', 'encoding') From c3ccf3c5dff7a9edfdb4a2e0421c8ea0ef21bb1e Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Mon, 29 Apr 2019 08:16:03 -0400 Subject: [PATCH 8/8] removed import shlex because it is not used. --- .../commands/commands/export_clipboard_to_x.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py b/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py index b7e5681f..fba57a56 100644 --- a/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py +++ b/src/fenrirscreenreader/commands/commands/export_clipboard_to_x.py @@ -7,7 +7,6 @@ from fenrirscreenreader.core import debug import subprocess, os from subprocess import Popen, PIPE -import shlex import _thread class command():