Skip to content

Commit a15c9fd

Browse files
committed
Bump cht.sh version
1 parent 8e789a8 commit a15c9fd

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

share/cht.sh.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
# count words in text counter
2525
# group elements list
2626

27-
__CHTSH_VERSION=0.0.2
28-
__CHTSH_DATETIME="2021-04-23 09:30:30 +0200"
27+
__CHTSH_VERSION=0.0.3
28+
__CHTSH_DATETIME="2021-04-25 09:30:30 +0200"
2929

3030
# cht.sh configuration loading
3131
#

tests/results/8

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
# count words in text counter
2525
# group elements list
2626

27-
__CHTSH_VERSION=0.0.2
28-
__CHTSH_DATETIME="2021-04-23 09:30:30 +0200"
27+
__CHTSH_VERSION=0.0.3
28+
__CHTSH_DATETIME="2021-04-25 09:30:30 +0200"
2929

3030
# cht.sh configuration loading
3131
#
@@ -514,7 +514,11 @@ else
514514
fi
515515

516516
if [ "$is_macos" != yes ]; then
517-
command -v xsel >/dev/null || echo 'DEPENDENCY: please install "xsel" for "copy"' >&2
517+
if [ "$XDG_SESSION_TYPE" = wayland ]; then
518+
command -v wl-copy >/dev/null || echo 'DEPENDENCY: please install "wl-copy" for "copy"' >&2
519+
else
520+
command -v xsel >/dev/null || echo 'DEPENDENCY: please install "xsel" for "copy"' >&2
521+
fi
518522
fi
519523
command -v rlwrap >/dev/null || { echo 'DEPENDENCY: install "rlwrap" to use cht.sh in the shell mode' >&2; exit 1; }
520524

@@ -562,7 +566,11 @@ cmd_copy() {
562566
else
563567
curl -s "${CHTSH_URL}"/"$(get_query_options "$query"?T)" > "$TMP1"
564568
if [ "$is_macos" != yes ]; then
565-
xsel -bi < "$TMP1"
569+
if [ "$XDG_SESSION_TYPE" = wayland ]; then
570+
wl-copy < "$TMP1"
571+
else
572+
xsel -bi < "$TMP1"
573+
fi
566574
else
567575
pbcopy < "$TMP1"
568576
fi
@@ -578,7 +586,11 @@ cmd_ccopy() {
578586
else
579587
curl -s "${CHTSH_URL}"/"$(get_query_options "$query"?TQ)" > "$TMP1"
580588
if [ "$is_macos" != yes ]; then
581-
xsel -bi < "$TMP1"
589+
if [ "$XDG_SESSION_TYPE" = wayland ]; then
590+
wl-copy < "$TMP1"
591+
else
592+
xsel -bi < "$TMP1"
593+
fi
582594
else
583595
pbcopy < "$TMP1"
584596
fi
@@ -674,7 +686,11 @@ cmd_stealth() {
674686
if [ "$is_macos" = yes ]; then
675687
past=$(pbpaste)
676688
else
677-
past=$(xsel -o)
689+
if [ "$XDG_SESSION_TYPE" = wayland ]; then
690+
past=$(wl-paste -p)
691+
else
692+
past=$(xsel -o)
693+
fi
678694
fi
679695
printf "\033[0;31mstealth:\033[0m you are in the stealth mode; select any text in any window for a query\n"
680696
printf "\033[0;31mstealth:\033[0m selections longer than $STEALTH_MAX_SELECTION_LENGTH words are ignored\n"
@@ -686,7 +702,11 @@ cmd_stealth() {
686702
if [ "$is_macos" = yes ]; then
687703
current=$(pbpaste)
688704
else
689-
current=$(xsel -o)
705+
if [ "$XDG_SESSION_TYPE" = wayland ]; then
706+
current=$(wl-paste -p)
707+
else
708+
current=$(xsel -o)
709+
fi
690710
fi
691711
if [ "$past" != "$current" ]; then
692712
past=$current

0 commit comments

Comments
 (0)