I am running Xubuntu 20.04. I have created a small bash script where the user can select a line from a list with fzf and output the selection to the system clipboard. This is a simple one-liner:
cat list-select | fzf | xclip -sel c
where list-select
is a simple text file containing the items to be selected.
The script works if I run it in the terminal, but what I would like to do is to create a keyboard shortcut for this script. This way, If I am for example writing an email, I could simply paste an element from this list using this script.
I thought that creating a Launcher would be a good idea, so I did a right-click on the Desktop and chose Create Launcher
. I gave the launcher a name, wrote the path of the executable as a command and chose Run in Terminal
as an option. Here is the desktop file:
[Desktop Entry]
Version=1.0
Type=Application
Name=ClipSel
Comment=
Exec=/home/itsme/clipsel.sh
Icon=
Path=
Terminal=true
StartupNotify=false
My script is:
#!/bin/bash
cat /home/itsme/list-select | fzf | xclip -sel c
And it is executable:
$ ls -lah clipsel.sh
-rwxrwxr-x 1 itsme itsme 62 Nov 14 16:13 clipsel.sh
The problem is now that, when I execute this launcher, I am able to choose a line in the list, but there is nothing in the system clipboard.
I assume I must change something in the command of the launcher, but I don't know exactly what. Any idea?
Also, if you think of any other way to do this, I would be glad to hear about it.
Best regards