python code here import os import time import pyperclip time . sleep(2) os . system( "xdotool key --delay 13 ctrl+c" ) x = pyperclip . paste () f = open( "/tmp/temp" , "w" ) length = f . write(x) f . close () time . sleep(1) os . system( "espeak -f /tmp/temp" ) dependencies: pyperclip - python library to get text from clipboard epseak - convert text to speak (linux) xdotool - send key strokes working Select the text to speak Then press a key stroke ( assign th python script to key stroke ) The data selected is copied to clipboard and using python get the clipboard data using pyperclip and store it in temp file pass the file to the espeak any doubts drop comment below
Let's make world safe, use technology wise