Skip to content

Instantly share code, notes, and snippets.

@garywill
Last active January 9, 2025 14:48
Show Gist options
  • Save garywill/a8e8c2ded02a742b1293794c53a9c1a6 to your computer and use it in GitHub Desktop.
Save garywill/a8e8c2ded02a742b1293794c53a9c1a6 to your computer and use it in GitHub Desktop.
askbrowser. (can link from xdg-open, firefox, dolphin). Ask to open, copy, cancel, pretend to success
#!/bin/bash
PARAS="$@"
TEXT="是否复制以下内容?"
if [[ "$PARAS" ]] ; then
TEXT="$TEXT\n$PARAS"
fi
kdialog --yesnocancel "$TEXT"
DIALOG_R=$?
if [[ $DIALOG_R -eq 0 ]]; then
echo "$PARAS" | xclip -i /dev/stdin -selection clipboard
fi
EXITCODE=$DIALOG_R
[[ $DIALOG_R -eq 2 ]] && EXITCODE=0
exit $EXITCODE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment