commit 87e1641b50ff0cc57ca850c34fe4d4c8cbb60bb0
parent 920c23b3cb8e17376814fa9a32a8fc170a4ca7a5
Author: Rob Pilling <robpilling@gmail.com>
Date: Thu, 5 May 2022 18:05:02 +0100
Handle syncing clipboard to primary
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/clipmenud b/clipmenud
@@ -3,6 +3,7 @@
: "${CM_ONESHOT=0}"
: "${CM_OWN_CLIPBOARD=0}"
: "${CM_SYNC_PRIMARY_TO_CLIPBOARD=0}"
+: "${CM_SYNC_CLIPBOARD_TO_PRIMARY=0}"
: "${CM_DEBUG=0}"
: "${CM_MAX_CLIPS:=1000}"
@@ -114,6 +115,7 @@ Environment variables:
- $CM_OWN_CLIPBOARD: take ownership of the clipboard. Note: this may cause missed copies if some other application also handles the clipboard directly (default: 0)
- $CM_SELECTIONS: space separated list of the selections to manage (default: "clipboard primary")
- $CM_SYNC_PRIMARY_TO_CLIPBOARD: sync selections from primary to clipboard immediately (default: 0)
+- $CM_SYNC_CLIPBOARD_TO_PRIMARY: sync selections from clipboard to primary immediately (default: 0)
- $CM_IGNORE_WINDOW: disable recording the clipboard in windows where the windowname matches the given regex (e.g. a password manager), do not ignore any windows if unset or empty (default: unset)
EOF
exit 0
@@ -231,6 +233,9 @@ while true; do
if (( CM_SYNC_PRIMARY_TO_CLIPBOARD )) && (( updated_sel[primary] )); then
_xsel -o --primary | _xsel -i --clipboard
fi
+ if (( CM_SYNC_CLIPBOARD_TO_PRIMARY )) && (( updated_sel[clipboard] )); then
+ _xsel -o --clipboard | _xsel -i --primary
+ fi
# The cache file may not exist if this is the first run and data is skipped
if (( CM_MAX_CLIPS )) && [[ -f "$cache_file" ]] && (( "$(wc -l < "$cache_file")" > CM_MAX_CLIPS_THRESH )); then