Add support for Linux/Wayland with wl-paste #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
This modifies linux.sh to support Wayland systems that do not use the
xclip command.
Logic is added to attempt to determine the type of display in use
(X11/Xorg or Wayland), and based on that, try the common clipboard CLI
commands for the given display system.
Failing to determine the display system for any reason will fall back to
the original behavior that assumes xclip is present.
This change also resulted in refactoring the script a bit since it got a
bit more complicated, any style changes are in-line with the Google
shell style guide (https://google.github.io/styleguide/shellguide.html)
A minor change to extension.ts was also made to support the error case
of wl-paste note being present on Wayland systems.
Related issues
This change should resolve dendronhq/dendron#1095 - which I perhaps should have filed in this repo :)
Testing
I have tested the linux.sh script and it behaves as expected, but I have not tested this end-to-end as a VS Code extension, as I'm just not familiar with extension development yet. So hopefully it's good there, but please do test that before merging!