Make open a function

This commit is contained in:
Sam A. 2022-07-05 19:22:45 +02:00
parent 464ee6086a
commit 092a9d897d
Signed by: samsapti
GPG key ID: CBBBE7371E81C4EA
4 changed files with 12 additions and 7 deletions

View file

@ -3,5 +3,5 @@ if [[ $(uname -o) == "GNU/Linux" ]] && [[ $(lsb_release -si) == "Artix" ]] && [[
export GTK_USE_PORTAL=1 export GTK_USE_PORTAL=1
export QT_QPA_PLATFORM="wayland" export QT_QPA_PLATFORM="wayland"
dbus-launch --sh-syntax --exit-with-session sway &>/dev/null; exit dbus-launch --sh-syntax --exit-with-session sway &> /dev/null; exit
fi fi

View file

@ -82,5 +82,4 @@ elif [[ $(uname -o) == "GNU/Linux" ]]; then
alias mount="udisksctl mount -b" alias mount="udisksctl mount -b"
alias unlock="udisksctl unlock -b" alias unlock="udisksctl unlock -b"
alias unmount="udisksctl unmount -b" alias unmount="udisksctl unmount -b"
alias open="xdg-open"
fi fi

View file

@ -32,11 +32,12 @@ doasedit() {
} }
get_ip() { get_ip() {
local IP="" (( ${+commands[curl]} )) || return 2
local ARGS=()
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
[[ $1 == --ip ]] && IP="?ip=$2" && shift || ARGS+=("$1") [[ $1 == --ip ]] \
&& local IP="?ip=$2" && shift \
|| local ARGS+=("$1")
shift shift
done done
@ -46,7 +47,12 @@ get_ip() {
http() { http() {
(( ${+commands[python]} )) || return 2 (( ${+commands[python]} )) || return 2
eval "python -m http.server 8080 --bind 127.0.0.1 \ eval "python -m http.server 8080 --bind 127.0.0.1 \
$( [[ $# -gt 0 ]] && echo "--directory $1" )" $( [[ $# -gt 0 ]] && echo "--directory $1" )"
} }
open() {
(( ${+commands[xdg-open]} )) || return 2
nohup xdg-open $1 &> /dev/null &
}

View file

@ -2,5 +2,5 @@ if [[ $(uname -o) == "GNU/Linux" ]] && [[ $(lsb_release -si) != "Debian" ]] && [
export GPG_TTY=$TTY export GPG_TTY=$TTY
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
gpgconf --launch gpg-agent gpgconf --launch gpg-agent
gpg-connect-agent updatestartuptty /bye &>/dev/null gpg-connect-agent updatestartuptty /bye &> /dev/null
fi fi