From 4fb2e4698c23a82664c3427ef103813dffda5847 Mon Sep 17 00:00:00 2001 From: "kebler.net" Date: Tue, 19 Oct 2021 11:01:32 -0700 Subject: [PATCH] vscode script supports vscodium and uses USER as subdirectory gnome terminal alias to use from vscdoe --- all/alias/term | 1 + all/modules/vscode.sh | 32 ++++++++++++++++++-------------- 2 files changed, 19 insertions(+), 14 deletions(-) create mode 100755 all/alias/term diff --git a/all/alias/term b/all/alias/term new file mode 100755 index 0000000..0c642ef --- /dev/null +++ b/all/alias/term @@ -0,0 +1 @@ +alias gterm='GNOME_TERMINAL_SCREEN='\'''\'' gnome-terminal' \ No newline at end of file diff --git a/all/modules/vscode.sh b/all/modules/vscode.sh index c5095b9..53597f5 100755 --- a/all/modules/vscode.sh +++ b/all/modules/vscode.sh @@ -1,20 +1,24 @@ #!/bin/bash -command -v code >/dev/null 2>&1 || exit - +VSCODE_BIN=$(command -v code) +VSCODE_BIN=${VSCODE_BIN:-$(command -v codium)} +[[ $VSCODE_BIN ]] || { + echo "no vscode binary on machine" + exit +} # set default home here -# can pass -vscode () { -#local home=$HOME -local home=/opt/vscode -home=${VSCODE_HOME:-$home} -[[ $1 == "-h" ]] && home=$2 && shift 2 -mkdir -p $home -[[ $? -ne 0 ]] && echo "unable to set vscode home at $home, aborting" && return 1 -exts=${home}/extensions -user=${home}/user -exe=$(command -v code) -$exe --user-data-dir=$user --extensions-dir=$exts "$@" +# can pass +vscode() { + #local home=$HOME + local home=/opt/vscode + home=${VSCODE_HOME:-$home} + [[ $1 == "-h" ]] && home=$2 && shift 2 + mkdir -p ${home}/${USER} + [[ $? -ne 0 ]] && echo "unable to set vscode home at $home/$USER, aborting" && return 1 + exts=${home}/${USER}/extensions + user=${home}/${USER}/data + echo $VSCODE_BIN --user-data-dir=$user --extensions-dir=$exts "$@" + $VSCODE_BIN --user-data-dir=$user --extensions-dir=$exts "$@" } # # if script was executed then call the function