Skip to content
This repository was archived by the owner on May 1, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion tessen.bash
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ tsn_clip() {
if [[ -n $WAYLAND_DISPLAY ]]; then
tsn_clip_cmd=(wl-copy --trim-newline)
tsn_clip_args=(--clear)
elif command -v pbcopy > /dev/null; then
tsn_clip_cmd=(pbcopy)
else
tsn_clip_cmd=(xclip -selection clipboard -rmlastnl)
tsn_clip_args=(-i /dev/null)
Expand All @@ -192,7 +194,11 @@ tsn_clip() {
printf "%s\n" "data has been copied and will be cleared from the clipboard after $CLIP_TIME seconds"
{
sleep "$CLIP_TIME" || kill 0
"${tsn_clip_cmd[@]}" "${tsn_clip_args[@]}"
if [[ -n ${tsn_clip_args[*]} ]]; then
"${tsn_clip_cmd[@]}" "${tsn_clip_args[@]}"
else
"${tsn_clip_cmd[@]}" <<< ''
fi
} > /dev/null 2>&1 &
else
_die "error: no data found for copying"
Expand Down