From 03a0d5bbaedc732436b5c67b166cde954817cc2f Mon Sep 17 00:00:00 2001
From: Carlo Sala <carlosalag@protonmail.com>
Date: Thu, 24 Aug 2023 17:20:24 +0200
Subject: [PATCH] fix(clipboard): load clipboard on usage

Closes #8827
---
 lib/clipboard.zsh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/lib/clipboard.zsh b/lib/clipboard.zsh
index 2f3b6bca..4b37abc9 100644
--- a/lib/clipboard.zsh
+++ b/lib/clipboard.zsh
@@ -100,8 +100,8 @@ function detect-clipboard() {
   fi
 }
 
-# Detect at startup. A non-zero exit here indicates that the dummy clipboards were set,
-# which is not really an error. If the user calls them, they will attempt to redetect
-# (for example, perhaps the user has now installed xclip) and then either print an error
-# or proceed successfully.
-detect-clipboard || true
+function clipcopy clippaste {
+  unfunction clipcopy clippaste
+  detect-clipboard || true # let one retry
+  "$0" "$@"
+}