Last active
January 9, 2025 14:48
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| PARAS="$@" | |
| TEXT="是否复制以下内容?" | |
| if [[ "$PARAS" ]] ; then | |
| TEXT="$TEXT\n$PARAS" | |
| fi | |
| kdialog --yesnocancel "$TEXT" | |
| #kdialog --yesnocancel "$TEXT" --cancel-label "假装成功打开" | |
| 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