Skip to content

Commit 064eacf

Browse files
Add wayland support to stealth-mode
1 parent b071e17 commit 064eacf

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

share/cht.sh.txt

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,11 @@ cmd_stealth() {
686686
if [ "$is_macos" = yes ]; then
687687
past=$(pbpaste)
688688
else
689-
past=$(xsel -o)
689+
if [ "$XDG_SESSION_TYPE" = wayland ]; then
690+
past=$(xl-paste -p)
691+
else
692+
past=$(xsel -o)
693+
fi
690694
fi
691695
printf "\033[0;31mstealth:\033[0m you are in the stealth mode; select any text in any window for a query\n"
692696
printf "\033[0;31mstealth:\033[0m selections longer than $STEALTH_MAX_SELECTION_LENGTH words are ignored\n"
@@ -698,7 +702,11 @@ cmd_stealth() {
698702
if [ "$is_macos" = yes ]; then
699703
current=$(pbpaste)
700704
else
701-
current=$(xsel -o)
705+
if [ "$XDG_SESSION_TYPE" = wayland ]; then
706+
current=$(wl-paste -p)
707+
else
708+
current=$(xsel -o)
709+
fi
702710
fi
703711
if [ "$past" != "$current" ]; then
704712
past=$current

0 commit comments

Comments
 (0)