From b40c13d3f8a68a7f94f1a084d7219c8ff4f62e42 Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Thu, 21 Feb 2019 14:13:41 +0000 Subject: [PATCH] Adds open-local script --- bin/open-local | 21 +++++++++++++++++++++ shells/aliases | 2 ++ 2 files changed, 23 insertions(+) create mode 100755 bin/open-local diff --git a/bin/open-local b/bin/open-local new file mode 100755 index 00000000..752f9570 --- /dev/null +++ b/bin/open-local @@ -0,0 +1,21 @@ +#!/bin/zsh + +# absolute path to image folder +FOLDER="$PWD" + +PH="${${PWD%/public_html*}%/wiki*}" + +FILE="https://${PH##*/}.local.jh" + +# get current open browser command +case $( uname -s ) in + Darwin) open=open;; + MINGW*) open=start;; + CYGWIN*) open=cygstart;; + MSYS*) open="powershell.exe –NoProfile Start";; + *) open=${BROWSER:-xdg-open};; +esac + +# open it in a browser +$open "$FILE" &> /dev/null & disown +exit $? diff --git a/shells/aliases b/shells/aliases index fb623244..b1624fd3 100644 --- a/shells/aliases +++ b/shells/aliases @@ -154,3 +154,5 @@ alias kb="xmodmap ~/.Xmodmap; xset r rate 200 70; xcape" alias colemak="setxkbmap -layout gb,gb -variant \"colemak,\" -option grp:shifts_toggle" alias qwerty="setxkbmap -layout gb" + +alias ol="open-local"