Snippet Expander v1.0.2 Released 🎉
Snippet Expander v1.0.2 is now available.
Changelog
- Fix copying snippet on Wayland
- Fix pasting snippet on Wayland (when using standards compliant compositor)
- Remove dependency on cgo and xtst
- Now depends on xclip and xdotool for X Server
- Now depends on wl-clipboard and wtype for Wayland
- Other dependencies updated
- Minor fixes to man pages
Wayland Support
Snippet Expander now works when using a Wayland compositor. Snippet Expander used to work fine with Wayland when auto expanding snippets, but not so much when using the Search & Paste window.
Previously, Snippet Expander used a Go library that did not use any external dependencies (in the form of programs) to add a snippet to the clipboard, or when grabbing the clipboard contents to insert into a snippet's body that used the @clipboard placeholder. This library did not work on Wayland (at least for me), so I switched to another library, but this library does use external programs to work with the clipboard. This new library has proven very reliable, using either xclip or wcopy (from the wl-clipboard package) to save or retrieve snippets to or from the clipboard.
Snippet Expander used to then use some custom cgo code I wrote to simulate using the ctrl+v keyboard shortcut to paste a snippet into an application once the Search & Paste window had closed. However, this simply did not work on Wayland (although I could swear it used to), no matter which X Server and Wayland supporting C library I tried to use.
So now, instead, Snippet Expander uses either xdotool or wtype on either X Server or Wayland desktops respectively to "press" ctrl+v.
On X Server this works fine everywhere I've tested it, but on Wayland, this only works on compositors that support the virtual keyboard protocol standard. So on wlroots based compositors like Sway, all is good, but on KDE Plasma or GNOME, not so much. It seems like KDE hasn't decided yet whether it will support the virtual keyboard protocol in Plasma, but GNOME isn't going to, which is a shame. I don't understand why a Wayland compositor wouldn't want to support all the standards. 🤷
---
"Snippet Expander v1.0.2 Released 🎉" was published on March 30, 2024.