From c5636a081ce1a66b15c03d3a83f835f0b98c381a Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Mon, 18 Jul 2022 16:04:45 +0200 Subject: [PATCH] Make open support specifying program --- zsh/.config/zsh/functions.zsh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/zsh/.config/zsh/functions.zsh b/zsh/.config/zsh/functions.zsh index 31a66de..cb0bd64 100644 --- a/zsh/.config/zsh/functions.zsh +++ b/zsh/.config/zsh/functions.zsh @@ -53,7 +53,11 @@ http() { } open() { - (( ${+commands[xdg-open]} )) || return 2 - nohup xdg-open "$@" &> /dev/null & disown + if [[ $# -gt 1 ]] && (( ${+commands[$1]} )); then + nohup "$@" &> /dev/null & disown + else + (( ${+commands[xdg-open]} )) || return 2 + nohup xdg-open "$@" &> /dev/null & disown + fi }