How to run TTS script from shortcut?



xsel > /tmp/speak.txt | trans -sp -n US,f -no-translate -e google -i /tmp/speak.txt

it is located:
I gave it run execute privileges.
I want to run the above script from global shortcut (Ctrl+Shift+L). I went to settings → shortcuts → own shortcuts → new → global → command or url.
I chose Ctrl+Shift+L and as action: /home/user_name/./speak

Although /home/user_name/./speak works in terminal, the shortcut from for example web browser doesn’t work.

Maybe it is a bug? How can I add this shortcut directly to kglobalshortcutsrc?

Is it possible to configure clipboard to run command line action? How to do it?

I am no coder and fairly new at bash scripting, so I could be wrong on this.

Should the shebang be the following to set the environment?

#!/usr/bin/env bash

I would also think you need to call it from a shortcut “link to application” and not “link to file”.

But how to do it? Do I need to use dbus option?

I’m not sure if it will let me post a link to my github, but I will try. Ignore what the little script does. I only did it to prove a proof of concept to myself. Just look at HOW it does what it does. I am just a newbie at scripting, so this was a learning experience for me.

The .desktop file is the link to application.