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