=== removed file 'xpra-skel/homedir/bin/clip2' --- old/xpra-skel/homedir/bin/clip2 2024-08-04 09:32:40 +0000 +++ new/xpra-skel/homedir/bin/clip2 1970-01-01 00:00:00 +0000 @@ -1,64 +0,0 @@ -#!/bin/zsh -setopt no_unset warn_create_global -zmodload zsh/stat zsh/datetime || exit $? -typeset -ga clipboards -typeset -g map=/run/display-container-map -#set -x - -get-clip() { - local sel out name=$1 - local -a env=( env ) - [[ -f /run/Xauthority.${DISPLAY#:} ]] && \ - env+=( XAUTHORITY=/run/Xauthority.${DISPLAY#:} ) - for sel in CLIPBOARD PRIMARY; do - out=$( $env xclip -o -sel $sel ) && \ - [[ -n $out ]] && - clipboards[${sel:l}@$name]=$out - done -} - -scan() { - local d f mtime - local -a found files stat - for d in /run/xpra/*-*; do - local -a l=( $d/*(.Nom) ) - for f in $l[1,2]; do - zstat -A stat +mtime $f || exit $? - strftime -s mtime '%Y-%m-%dT%H:%M:%S' $stat[1] || exit $? - files+=( "$mtime|$f" ) - done - done - local -a sorted - set +s -A sorted $files - for f in $sorted; do - mtime=${f%%|*} - f=${f#*|} - found=( $map/${${f:h:t}#*-}=*(N) ) - clipboards+=( $mtime/${${found[1]:-${$:h:t}}##*=}/${${f:h:t}%-*} "$(<$f)" ) - done -} -typeset -f -t scan - -print-clip() { - local name content - for name content in "${(kv@)clipboards}"; do - printf '>> %s <<\n%s\n\n' $name $content - done -} - -print-clip-0() { - local name content - for name content in "${(kv@)clipboards}"; do - printf '%s\0' $name $content - done -} - -main() { - scan - if (($#)) && [[ $1 == -0 ]]; then - print-clip-0 - else - print-clip - fi -} -main "$@" === modified file 'xsession-skel/homedir/bin/clip' --- old/xsession-skel/homedir/bin/clip 2024-08-04 09:32:40 +0000 +++ new/xsession-skel/homedir/bin/clip 2024-08-03 22:38:44 +0000 @@ -1,26 +1,10 @@ #!/bin/zsh -setopt no_unset extended_glob warn_create_global +setopt no_unset extended_glob # warn_create_global typeset -gA clipboards -typeset -ga labels - -print_choices() { - local label - for label in $labels; do - printf '%s » %s\n' $label ${clipboards[$label]//$'\n'/»} - done -} -main() { - s6-sudo /run/cmd.s link xpra.$USER xsession.${DISPLAY#:}.$USER run/exec/exec || exit $? - local label content - for label content in ${(0)"$(s6-sudo /run/inbox/xpra.ccx/run/exec/exec clip -0)"}; do - labels+=( $label ) - clipboards[$label]=$content - done - local choice - choice=$(print_choices | dmenu -l $#labels -fn Terminus) || exit $? - choice=${choice%% » *} - printf "%s" $clipboards[$choice] -} -typeset -f -t main - -main "$@" +set -x +s6-sudo /run/cmd.s link xpra.$USER xsession.${DISPLAY#:}.$USER run/exec/exec || exit $? +clipboards=( ${(0)"$(s6-sudo /run/inbox/xpra.ccx/run/exec/exec clip -0)"} ) +#clipboards=( ${(0)"$(c.exec xpra.$USER clip -0)"} ) +choice=$(printf '%s » %s\n' ${(kv)clipboards//$'\n'/»} | dmenu -l 8 -fn Terminus) +choice=${choice%% » *} +printf "%s" $clipboards[$choice]