Replace "nohup" with "setsid" everywhere
This commit is contained in:
parent
34d17d1e99
commit
2b9b47ab46
4 changed files with 68 additions and 73 deletions
21
q-browse
21
q-browse
|
@ -4,19 +4,18 @@ ENV_xdg_open=xdg-open
|
|||
ENV_cut=cut
|
||||
|
||||
if [[ -z "$@" ]]; then
|
||||
echo "^f .*$"
|
||||
echo "^f .*$"
|
||||
elif [[ "$1" == "--hint" ]]; then
|
||||
shift
|
||||
shift
|
||||
elif [[ "$1" == "--complete" ]]; then
|
||||
shift
|
||||
echo "0 $@"
|
||||
shift
|
||||
echo "0 $@"
|
||||
elif [[ "$1" == "--preview" ]]; then
|
||||
shift
|
||||
URL="$(echo "$@" | $ENV_cut -d ' ' -f3-)"
|
||||
echo "Will open '$URL' in firefox"
|
||||
shift
|
||||
URL="$(echo "$@" | $ENV_cut -d ' ' -f3-)"
|
||||
echo "Will open '$URL' in firefox"
|
||||
elif [[ "$1" == "--run" ]]; then
|
||||
shift
|
||||
URL="$(echo "$@" | $ENV_cut -d ' ' -f3-)"
|
||||
(nohup $ENV_xdg_open "$URL" 2>/dev/null &)
|
||||
sleep 0.01
|
||||
shift
|
||||
URL="$(echo "$@" | $ENV_cut -d ' ' -f3-)"
|
||||
setsid $ENV_xdg_open "$URL"
|
||||
fi
|
||||
|
|
40
q-calc
40
q-calc
|
@ -5,33 +5,33 @@ ENV_wl_copy=wl-copy
|
|||
ENV_cut=cut
|
||||
|
||||
calc() {
|
||||
res="$(echo "$1" | $ENV_bc 2>/dev/null)"
|
||||
if [ "$res" == "" ]; then
|
||||
res="-"
|
||||
fi
|
||||
echo "$res"
|
||||
res="$(echo "$1" | $ENV_bc 2>/dev/null)"
|
||||
if [ "$res" == "" ]; then
|
||||
res="-"
|
||||
fi
|
||||
echo "$res"
|
||||
}
|
||||
|
||||
if [[ -z "$@" ]]; then
|
||||
echo "^= .*$"
|
||||
echo "^= .*$"
|
||||
elif [[ "$1" == "--hint" ]]; then
|
||||
shift
|
||||
echo "- = "
|
||||
shift
|
||||
echo "- = "
|
||||
elif [[ "$1" == "--complete" ]]; then
|
||||
shift
|
||||
EXPR="$(echo "$@" | cut -d ' ' -f2-)"
|
||||
RES="$(calc "$EXPR")"
|
||||
echo "$RES = $EXPR -> $(calc "$EXPR")"
|
||||
shift
|
||||
EXPR="$(echo "$@" | cut -d ' ' -f2-)"
|
||||
RES="$(calc "$EXPR")"
|
||||
echo "$RES = $EXPR -> $(calc "$EXPR")"
|
||||
elif [[ "$1" == "--preview" ]]; then
|
||||
shift
|
||||
echo "$1"
|
||||
shift
|
||||
echo "$1"
|
||||
elif [[ "$1" == "--run" ]]; then
|
||||
shift
|
||||
echo "$1"
|
||||
echo "$1" | (nohup $ENV_wl_copy -n 2>/dev/null &)
|
||||
shift
|
||||
echo "$1"
|
||||
echo "$1" | (setsid $ENV_wl_copy)
|
||||
elif [[ "$1" == "--cli" ]]; then
|
||||
shift
|
||||
calc "$(echo "$@" | $ENV_cut -d ' ' -f2-)"
|
||||
shift
|
||||
calc "$(echo "$@" | $ENV_cut -d ' ' -f2-)"
|
||||
else
|
||||
echo "Unexpected arguments: $@"
|
||||
echo "Unexpected arguments: $@"
|
||||
fi
|
||||
|
|
32
q-clipboard
32
q-clipboard
|
@ -6,25 +6,25 @@ ENV_base64=base64
|
|||
ENV_wl_copy=wl-copy
|
||||
|
||||
if [[ -z "$@" ]]; then
|
||||
echo "^c .*$"
|
||||
echo "^c .*$"
|
||||
elif [[ "$1" == "--hint" ]]; then
|
||||
shift
|
||||
if [[ -f ~/.clipboard.txt ]]; then
|
||||
$ENV_cat ~/.clipboard.txt | $ENV_tac
|
||||
fi
|
||||
shift
|
||||
if [[ -f ~/.clipboard.txt ]]; then
|
||||
$ENV_cat ~/.clipboard.txt | $ENV_tac
|
||||
fi
|
||||
elif [[ "$1" == "--complete" ]]; then
|
||||
shift
|
||||
if [[ -f ~/.clipboard.txt ]]; then
|
||||
$ENV_cat ~/.clipboard.txt | $ENV_tac
|
||||
fi
|
||||
shift
|
||||
if [[ -f ~/.clipboard.txt ]]; then
|
||||
$ENV_cat ~/.clipboard.txt | $ENV_tac
|
||||
fi
|
||||
elif [[ "$1" == "--preview" ]]; then
|
||||
shift
|
||||
echo "$1" | $ENV_base64 -d
|
||||
shift
|
||||
echo "$1" | $ENV_base64 -d
|
||||
elif [[ "$1" == "--run" ]]; then
|
||||
shift
|
||||
TEXT="$(echo "$1" | $ENV_base64 -d)"
|
||||
echo "$TEXT"
|
||||
echo -n "$TEXT" | (nohup $ENV_wl_copy -n 2>/dev/null &)
|
||||
shift
|
||||
TEXT="$(echo "$1" | $ENV_base64 -d)"
|
||||
echo "$TEXT"
|
||||
echo -n "$TEXT" | (setsid $ENV_wl_copy)
|
||||
else
|
||||
echo "Unexpected arguments: $@"
|
||||
echo "Unexpected arguments: $@"
|
||||
fi
|
||||
|
|
48
q-pass
48
q-pass
|
@ -6,34 +6,30 @@ ENV_sed=sed
|
|||
ENV_wl_copy=wl-copy
|
||||
|
||||
if [[ -z "$@" ]]; then
|
||||
# Return a regular expression that should trigger
|
||||
# this subcommand. q.sh will then pass control to
|
||||
# this script whenever the input line matches.
|
||||
echo "^p .*$"
|
||||
# Return a regular expression that should trigger
|
||||
# this subcommand. q.sh will then pass control to
|
||||
# this script whenever the input line matches.
|
||||
echo "^p .*$"
|
||||
elif [[ "$1" == "--hint" ]]; then
|
||||
# This subcommand has no hints
|
||||
shift
|
||||
# This subcommand has no hints
|
||||
shift
|
||||
elif [[ "$1" == "--complete" ]]; then
|
||||
shift
|
||||
# Return a list of all accounts for which we store
|
||||
# passwords. This will be used to provide a list of
|
||||
# completions.
|
||||
cd ~/.password-store
|
||||
$ENV_find . -name "*.gpg" | $ENV_sed -E 's/\.\/(.*)\.gpg/\1 p \1/'
|
||||
shift
|
||||
# Return a list of all accounts for which we store
|
||||
# passwords. This will be used to provide a list of
|
||||
# completions.
|
||||
cd ~/.password-store
|
||||
$ENV_find . -name "*.gpg" | $ENV_sed -E 's/\.\/(.*)\.gpg/\1 p \1/'
|
||||
elif [[ "$1" == "--preview" ]]; then
|
||||
shift
|
||||
# This information will be displayed in the preview
|
||||
# pane on the right.
|
||||
echo "Will get password for $1"
|
||||
shift
|
||||
# This information will be displayed in the preview
|
||||
# pane on the right.
|
||||
echo "Will get password for $1"
|
||||
elif [[ "$1" == "--run" ]]; then
|
||||
shift
|
||||
# This will be triggered when enter is pressed on
|
||||
# one of the options. We now decrypt the password
|
||||
# and place it to the clipboard.
|
||||
NAME="$1"
|
||||
$ENV_pass "$NAME" | (nohup $ENV_wl_copy -n 2>/dev/null &)
|
||||
|
||||
# A short sleep is needed to wait for child process
|
||||
# to spawn before exiting.
|
||||
sleep 0.01
|
||||
shift
|
||||
# This will be triggered when enter is pressed on
|
||||
# one of the options. We now decrypt the password
|
||||
# and place it to the clipboard.
|
||||
NAME="$1"
|
||||
$ENV_pass "$NAME" | (setsid $ENV_wl_copy)
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue