I could never get your 2nd lone .desktop method to work.
I am running X11 too, I followed the instructions to the T.
Although, would be worth trying again, to see where the error is. But not for now.
However, i got the method 1 working & even fine tuned it. So I wont try the method 2 again for now.
Here's what i did, see below, i added some more steps to get what i needed, so now instead of two clicks with "CopyQ", i just have to one click my taskbar shortcut icon. See the star shortcut, it copies ★ to my clipboard with one click:
_________________________________________________________
--How to create star taskbar copy clipboard button
First, install xclip
sudo apt install xclip
Then create a text file with
#!/usr/bin/env bash
echo -n ★ | xclip -selection clipboard
Rename the text file as .sh (very important step)
–Make sure the file is executable by running chmod u+x <name_of_file>.
–For that .sh file in Nemo File manager, click Edit > Preferences > Behavior, Scroll to Executable Text Files and select the preferred option and select Run.
Then, next, create a .desktop link
https://askubuntu.com/questions/1090731/how-do-i-pin-a-file-shortcut-to-ubuntu-dock
with the following in it:
[Desktop Entry]
Name=desktopSTAR1stmethod
Exec=bash '/home/user/Downloads/Untitled Folder 3/star1stmethod.sh'
Comment=Launch desktopSTAR1stmethod
Terminal=false
Type=Application
Icon=starred
Then move it to /home/user/.local/share/applications
–it should show up in apps now, then search for "desktopSTAR1stmethod". It should appear. Then Right click on it and mark as favorite. It should be on the taskbar now.
Then if you want the icon to have a special image, like the star, u need to find the name/code for it, I used gtk3-icon-browser to find it.
I install gtk3-icon-browser, and luckily found a star icon.
The name for it is: "starred", so in the .desktop file, i put Icon=starred, at the end.
And voilà, done.