From df9e5ac0773556782dc12874692cd1e9c51196ea Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Wed, 24 Nov 2021 09:36:02 -0600 Subject: [PATCH] Fix tmux env not propogating DISPLAY vars --- common/bin/upload | 31 ++++++++++++++++++++++++------- common/fish/functions.fish | 9 +++++++++ common/git/config | 2 +- common/neovim/coc-settings.json | 5 +++++ common/tmux/conf | 2 ++ 5 files changed, 41 insertions(+), 8 deletions(-) diff --git a/common/bin/upload b/common/bin/upload index 404751b..486819d 100755 --- a/common/bin/upload +++ b/common/bin/upload @@ -5,24 +5,41 @@ HOST="faceless" f="${1}" + +[ "${f}" = "" ] && echo "No file provided. Exiting." >&2 && exit 2 +[ ! -e "${f}" ] && echo "File '$f' does not exist. Exiting." >&2 && exit 1 + +is_dir="$([ ! -e "${f}" ]; echo "$?")" + +set -xe + fname="${2:-$(basename "${f}")}" subdir="${3:-uploads}" internal_dir="/home/daniel/public-static-files/${subdir}" url="https://files.lyte.dev/${subdir}/${fname}" -[ "${f}" = "" ] && echo "No file provided. Exiting." >&2 && exit 2 -[ ! -f "${f}" ] && echo "File '$f' does not exist. Exiting." >&2 && exit 1 - if [ "$(curl -s -o /dev/null -w "%{http_code}" "${url}")" -eq 200 ]; then echo "ERROR: A file already exists at ${url}" exit 3 fi -ssh "$HOST" mkdir -p "$(dirname "${internal_dir}/${fname}")" -rsync --progress --no-owner --no-group --chmod=644 --ignore-existing "${f}" "${HOST}:${internal_dir}/${fname}" | tee "${HOME}/.upload.log" -code="$?" -echo "Uploaded to: ${url}" +flags=644 +code="" +if [ "$is_dir" = "0" ]; then + ssh "$HOST" mkdir -p "$(dirname "${internal_dir}/${fname}")" + rsync --progress --no-owner --no-group --chmod="$flags" --ignore-existing \ + "${f}" "${HOST}:${internal_dir}/${fname}" | tee "${HOME}/.upload.log" + code="$?" +else + ssh "$HOST" mkdir -p "${internal_dir}/${fname}" + flags=755 + rsync --recursive --progress --no-owner --no-group --chmod="$flags" \ + "${f}" "${HOST}:${internal_dir}" | tee "${HOME}/.upload.log" + code="$?" +fi if [ "$code" -ne 0 ]; then printf "ERROR: The file failed to upload - perhaps rsync failed for some reason?\n See \"%s/.upload.log\" for details\n" "$HOME" +else + echo "Uploaded to: ${url}" fi diff --git a/common/fish/functions.fish b/common/fish/functions.fish index 1b8e14d..bd3273d 100644 --- a/common/fish/functions.fish +++ b/common/fish/functions.fish @@ -165,3 +165,12 @@ alias mount 'sudo -E mount' alias umount 'sudo -E umount' has_command xdg-open && alias open xdg-open + +function fish_preexec + test -n $TMUX && begin + set envlist (tmux show-environment) + for var in DISPLAY WAYLAND_DISPLAY + set -gx $var (echo $envlist | rg '^'$var'=(.*)$' -r '$1') + end + end +end diff --git a/common/git/config b/common/git/config index cb6cb2a..89a716b 100644 --- a/common/git/config +++ b/common/git/config @@ -73,5 +73,5 @@ default = current [include] - path = ~/.config/lytedev-env/host-personal/gitconfig + path = ~/.config/lytedev-env/host-layer-personal/gitconfig path = ~/.config/lytedev-env/divvy/gitconfig diff --git a/common/neovim/coc-settings.json b/common/neovim/coc-settings.json index e2cbd22..ff7540d 100644 --- a/common/neovim/coc-settings.json +++ b/common/neovim/coc-settings.json @@ -4,6 +4,11 @@ "nim": { "command": "nimlsp", "filetypes": ["nim"] + }, + "godot": { + "host": "127.0.0.1", + "filetypes": ["gd", "gdscript3"], + "port": 6008 } }, "elixir.pathToElixirLS": "~/.elixir-ls/release/language_server.sh", diff --git a/common/tmux/conf b/common/tmux/conf index 31e85aa..5530295 100644 --- a/common/tmux/conf +++ b/common/tmux/conf @@ -19,6 +19,8 @@ bind s run "tmux split-window -l 12 'tmuxswitcher'" bind M-l source-file "$XDG_CONFIG_HOME/tmux/layouts/dev.tmux" +set -g update-environment "WAYLAND_DISPLAY DISPLAY" + set -g default-terminal "kitty" set -g mouse on set -g escape-time 0