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.

Revisions

  1. garywill revised this gist Jan 9, 2025. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions askopen
    Original file line number Diff line number Diff line change
    @@ -9,6 +9,7 @@ fi


    kdialog --yesnocancel "$TEXT"
    #kdialog --yesnocancel "$TEXT" --cancel-label "假装成功打开"
    DIALOG_R=$?

    if [[ $DIALOG_R -eq 0 ]]; then
  2. garywill created this gist Jan 9, 2025.
    20 changes: 20 additions & 0 deletions askopen
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    #!/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