From 064eacf513b5779f5a2f6311a71b94cb5576785e Mon Sep 17 00:00:00 2001 From: Scott Little Date: Fri, 23 Apr 2021 14:10:48 -0500 Subject: [PATCH] Add wayland support to stealth-mode --- share/cht.sh.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/share/cht.sh.txt b/share/cht.sh.txt index 3b7f125..a4532d8 100755 --- a/share/cht.sh.txt +++ b/share/cht.sh.txt @@ -686,7 +686,11 @@ cmd_stealth() { if [ "$is_macos" = yes ]; then past=$(pbpaste) else - past=$(xsel -o) + if [ "$XDG_SESSION_TYPE" = wayland ]; then + past=$(xl-paste -p) + else + past=$(xsel -o) + fi fi printf "\033[0;31mstealth:\033[0m you are in the stealth mode; select any text in any window for a query\n" printf "\033[0;31mstealth:\033[0m selections longer than $STEALTH_MAX_SELECTION_LENGTH words are ignored\n" @@ -698,7 +702,11 @@ cmd_stealth() { if [ "$is_macos" = yes ]; then current=$(pbpaste) else - current=$(xsel -o) + if [ "$XDG_SESSION_TYPE" = wayland ]; then + current=$(wl-paste -p) + else + current=$(xsel -o) + fi fi if [ "$past" != "$current" ]; then past=$current