From 742d3073dd43bb156dc1e3ef26c5dee5bbc90bac Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sun, 28 Apr 2019 11:27:50 -0400 Subject: [PATCH 01/12] 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 02/12] 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 03/12] 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 04/12] 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 05/12] 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 06/12] 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 07/12] 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 82c3ef97f86139c120cdae6dde8df9a5cca211da Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Mon, 29 Apr 2019 08:14:27 -0400 Subject: [PATCH 08/12] Fixed nvda layout files. --- config/keyboard/nvda-desktop.conf | 4 ++-- config/keyboard/nvda-laptop.conf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/config/keyboard/nvda-desktop.conf b/config/keyboard/nvda-desktop.conf index f16e3627..9a0dba35 100644 --- a/config/keyboard/nvda-desktop.conf +++ b/config/keyboard/nvda-desktop.conf @@ -99,14 +99,14 @@ KEY_FENRIR,KEY_SHIFT,KEY_S=remove_word_from_spell_check KEY_FENRIR,KEY_F2=forward_keypress KEY_FENRIR,KEY_ALT,KEY_UP=inc_sound_volume KEY_FENRIR,KEY_ALT,KEY_DOWN=dec_sound_volume -KEY_FENRIR,KEY_CTRL,KEY_SHIFT,KEY_C=clear_clipboard +#=clear_clipboard KEY_FENRIR,KEY_HOME=first_clipboard KEY_FENRIR,KEY_END=last_clipboard KEY_FENRIR,KEY_PAGEUP=prev_clipboard KEY_FENRIR,KEY_PAGEDOWN=next_clipboard KEY_FENRIR,KEY_SHIFT,KEY_C=curr_clipboard KEY_FENRIR,KEY_C=copy_marked_to_clipboard -KEY_FENRIR,KEY_CTRL,KEY_U=copy_last_echo_to_clipboard +KEY_FENRIR,KEY_CTRL,KEY_SHIFT,KEY_C=copy_last_echo_to_clipboard KEY_FENRIR,KEY_V=paste_clipboard KEY_FENRIR,KEY_F5=import_clipboard_from_file KEY_FENRIR,KEY_F6=export_clipboard_to_file diff --git a/config/keyboard/nvda-laptop.conf b/config/keyboard/nvda-laptop.conf index 9e9e62ed..dab8d124 100644 --- a/config/keyboard/nvda-laptop.conf +++ b/config/keyboard/nvda-laptop.conf @@ -99,14 +99,14 @@ KEY_FENRIR,KEY_SHIFT,KEY_S=remove_word_from_spell_check KEY_FENRIR,KEY_F2=forward_keypress KEY_FENRIR,KEY_ALT,KEY_UP=inc_sound_volume KEY_FENRIR,KEY_ALT,KEY_DOWN=dec_sound_volume -KEY_FENRIR,KEY_CTRL,KEY_SHIFT,KEY_C=clear_clipboard +#=clear_clipboard #=first_clipboard #=last_clipboard KEY_FENRIR,KEY_PAGEUP=prev_clipboard KEY_FENRIR,KEY_PAGEDOWN=next_clipboard KEY_FENRIR,KEY_SHIFT,KEY_C=curr_clipboard KEY_FENRIR,KEY_C=copy_marked_to_clipboard -KEY_FENRIR,KEY_CTRL,KEY_U=copy_last_echo_to_clipboard +KEY_FENRIR,KEY_CTRL,KEY_SHIFT,KEY_C=copy_last_echo_to_clipboard KEY_FENRIR,KEY_V=paste_clipboard KEY_FENRIR,KEY_F5=import_clipboard_from_file KEY_FENRIR,KEY_F6=export_clipboard_to_file From c3ccf3c5dff7a9edfdb4a2e0421c8ea0ef21bb1e Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Mon, 29 Apr 2019 08:16:03 -0400 Subject: [PATCH 09/12] 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(): From c4cc983c5ae7fd5e0b351e8d7794f2d09321e3b8 Mon Sep 17 00:00:00 2001 From: chrys Date: Fri, 17 May 2019 10:18:48 +0200 Subject: [PATCH 10/12] Update fenrirManager.py --- src/fenrirscreenreader/core/fenrirManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fenrirscreenreader/core/fenrirManager.py b/src/fenrirscreenreader/core/fenrirManager.py index 619a3f7c..259132e4 100644 --- a/src/fenrirscreenreader/core/fenrirManager.py +++ b/src/fenrirscreenreader/core/fenrirManager.py @@ -38,7 +38,7 @@ class fenrirManager(): parser.add_argument('-o', '--options', metavar='SECTION#SETTING=VALUE;..', default='', help='Overwrite options in given settings file. Sections, settings and Values are cases sensitive') parser.add_argument('-d', '--debug', action='store_true', help='Turns on Debugmode') parser.add_argument('-p', '--print', action='store_true', help='Print debug messages on screen') - parser.add_argument('-e', '--emulated-pty', action='store_true', help=' se PTY emulation and escape sequences for input. Allows to use fenrir on the desktop, in a terminal for X or Wayland') + parser.add_argument('-e', '--emulated-pty', action='store_true', help='Use PTY emulation and escape sequences for input. Allows to use fenrir on the desktop, in a terminal for X or Wayland') parser.add_argument('-E', '--emulated-evdev', action='store_true', help='Use PTY emulation and evdev for input (single instance)') try: args = parser.parse_args() From c8be993dd64134a93eecdfff176df21a3c5cb4f6 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Mon, 29 Jul 2019 15:56:29 -0400 Subject: [PATCH 11/12] TTY info added to cursor_position. --- src/fenrirscreenreader/commands/commands/cursor_position.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fenrirscreenreader/commands/commands/cursor_position.py b/src/fenrirscreenreader/commands/commands/cursor_position.py index bbb1208f..c85e167e 100644 --- a/src/fenrirscreenreader/commands/commands/cursor_position.py +++ b/src/fenrirscreenreader/commands/commands/cursor_position.py @@ -5,6 +5,8 @@ # By Chrys, Storm Dragon, and contributers. from fenrirscreenreader.core import debug +import os +import sys class command(): def __init__(self): @@ -14,13 +16,13 @@ class command(): def shutdown(self): pass def getDescription(self): - return _('displays the position of the review cursor') + return _('displays the position of the review cursor and current TTY') def run(self): # Prefer review cursor over text cursor cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - self.env['runtime']['outputManager'].presentText(_("line {0}, column {1}").format(cursorPos['y']+1, cursorPos['x']+1), interrupt=True) + self.env['runtime']['outputManager'].presentText(_("line {0}, column {1}, " + str(os.ttyname(sys.stdout.fileno()))[5:].replace("/", "")).format(cursorPos['y']+1, cursorPos['x']+1), interrupt=True) def setCallback(self, callback): pass From d17d2817d358abbba329793694000833fb964d8c Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Mon, 29 Jul 2019 19:00:00 -0400 Subject: [PATCH 12/12] Terminal number added. --- src/fenrirscreenreader/commands/commands/cursor_position.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/fenrirscreenreader/commands/commands/cursor_position.py b/src/fenrirscreenreader/commands/commands/cursor_position.py index c85e167e..1f123f87 100644 --- a/src/fenrirscreenreader/commands/commands/cursor_position.py +++ b/src/fenrirscreenreader/commands/commands/cursor_position.py @@ -5,8 +5,6 @@ # By Chrys, Storm Dragon, and contributers. from fenrirscreenreader.core import debug -import os -import sys class command(): def __init__(self): @@ -16,13 +14,13 @@ class command(): def shutdown(self): pass def getDescription(self): - return _('displays the position of the review cursor and current TTY') + return _('displays the position of the review cursor') def run(self): # Prefer review cursor over text cursor cursorPos = self.env['runtime']['cursorManager'].getReviewOrTextCursor() - self.env['runtime']['outputManager'].presentText(_("line {0}, column {1}, " + str(os.ttyname(sys.stdout.fileno()))[5:].replace("/", "")).format(cursorPos['y']+1, cursorPos['x']+1), interrupt=True) + self.env['runtime']['outputManager'].presentText(_("line {0}, column {1}, Terminal {2}").format(cursorPos['y']+1, cursorPos['x']+1, self.env['screen']['newTTY']), interrupt=True) def setCallback(self, callback): pass