Macopa - texpander fork for wayland

texpander3 was a low effort continuation of the original and only ever mentioned in passing.

Now macopa has been forked to provide the same functionality on wayland.

There is some more information at the gitlab source linked in the top of this post.

In the past I have even used it for canned welcome/support/etc responses here on this forum. :innocent:

As always let me know if somethings broken or an improvement can be made.

Oh, and, be aware that I dont use zsh and the associated files are retained from the fork.
(quality unsure - they may be updated or removed in the future)

2 Likes

Iā€™m getting a 404 - not found error at https://gitlab.com/cscs/macopa

Ah, thatā€™ll happen when its left on ā€˜Privateā€™. :sweat_smile:

Thanks for letting me know - should be ā€˜Publicā€™ now.

1 Like

Downloaded, made executable, added the Meta+/ shortcut via Plasmaā€™s System Settings, & it is working like a dream. I already have one snippet added:

Screenshot_20250106_213838

When I installed ydotool, which is required to run macopa on Plasma, Pamac advised me to run the following command to add myself to the input group:

usermod -aG input $USER

However, as that gave me a ā€œPermission deniedā€ message, I was successful using:

sudo usermod -aG input scotty (my actual username on my PC)

It is getting a bit late for me to add more snippets tonight, but I will definitely be using macopa when it comes to standard replies such as requests for info, advice on switching branches etc on this forum.

It will, because you didnā€™t run it as rootā€¦

1 Like

After saying last night that it was getting too late in the evening to add more snippets to macopa, I ended up adding more snippets.

I also wrote a bash script that allows me to add snippets via the terminal. It will create a file using the snippet name in the ~/.config/macopa/ directory filled with the snippet text that has been typed or pasted into the terminal. New lines etc are not an issue. Once the snippet text is complete, you just need to type ^ to finish and write to the file.

Hereā€™s an example of the script in action:

addmacopa
What is the name of the Macopa snippet?: 
testing
Type or paste the text of the snippet (type "^" when done):
Test line 1

Test line 2 with a URL https://example.com/

The last test line - I'll press the caret symbol (above the 6 key) to finish^

Macopa snippet testing has been created - here is the file content:

Test line 1

Test line 2 with a URL https://example.com/

The last test line - I'll press the caret symbol (above the 6 key) to finish

And the script:

#!/usr/bin/env bash

# addmacopa - a script to enable creation of Macopa snippets via the terminal.

folder=~/.config/macopa/

echo -e "What is the name of the Macopa snippet?: "
read name

read -d "^" -p "Type or paste the text of the snippet (type \"^\" when done):
" snippet

echo "${snippet}" > ${folder}${name}

filecontent=$(<${folder}${name})

echo -e "\n\nMacopa snippet ${name} has been created - here is the file content:"

printf "\n%s\n" "${filecontent}"

exit 0

Just 2 issues with it:

  1. You canā€™t enter a snippet that contains a ^, as only the text up to the ^ will be saved

  2. You canā€™t use the Backspace key when typing your snippet, as the read -e flag cannot be used.

If anyone knows of a workaround to the 2nd issue, or has any other improvements to the script, feel free to let me know.

1 Like

Cool beans.

I had mentally toyed with a similar idea - though more towards a zenity dialog of some sort.

Maybe a feature to implement one way or another.

Iā€™m still torn on how much it should check/hand-hold/dynamically use backends or present extra functionality by default ā€¦ or if some of those things should be made toggles for specific use.

Like in this case - should it check for emptiness and prompt the user to create some files through zenity? Or maybe just do this on first run? Or should there be something like a macopa -n switch to open a dialog?

The less it does or checks by default the less overhead will be incurred.

Speaking of which ā€¦ new version, when ydotoold is not already running somehow, will start it using ydotoold -m because we dont need the mouse functionality. This appears to have decreased the opening time by up to 50%.

Also included some extra notes on the page as

1 Like

Well, in that case you could escape it as Unicode:

  • In HTML &#94; renders as: ^
  • The specific escape sequence in Unicode is: \u005E

This Wikipedia article lists many examples that can be treated in much the same way:

The ASCII Punctuation & Symbols sections are particularly worth noting.

This looks interesting too as you can click the character you want and the Unicode is then copied to clipboard:

1 Like