From 622b6e4e63788fe11a1eea9627e759d0185801d5 Mon Sep 17 00:00:00 2001 From: FollieHiyuki Date: Mon, 3 May 2021 15:50:23 +0300 Subject: [PATCH] forgit: fix setting env logic --- home/.bashrc-bloated | 14 ++++++++------ home/.config/fish/conf.d/env.fish | 14 ++++++++------ home/.config/zsh/.zshenv | 14 ++++++++------ 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/home/.bashrc-bloated b/home/.bashrc-bloated index daea8c5..c71a658 100644 --- a/home/.bashrc-bloated +++ b/home/.bashrc-bloated @@ -674,13 +674,15 @@ if [ ! -f "$BASH_COMPLETION_USER_DIR/plugins/forgit.plugin.bash" ]; then fi source $BASH_COMPLETION_USER_DIR/plugins/forgit.plugin.sh -if [ "$XDG_SESSION_TYPE" = "wayland" ]; then - export FORGIT_COPY_CMD="wl-copy" -elif [ "$XDG_SESSION_TYPE" = "x11" ]; then - if command -v xclip >/dev/null; then - export FORGIT_COPY_CMD="xclip -selection clipboard" +if [ -n "$XDG_SESSION_TYPE" ]; then + if [ "$XDG_SESSION_TYPE" = "wayland" ]; then + export FORGIT_COPY_CMD="wl-copy" else - export FORGIT_COPY_CMD="xsel -i -b" + if command -v xclip >/dev/null; then + export FORGIT_COPY_CMD="xclip -selection clipboard" + else + export FORGIT_COPY_CMD="xsel -i -b" + fi fi fi diff --git a/home/.config/fish/conf.d/env.fish b/home/.config/fish/conf.d/env.fish index 3f3fd4f..befc6b7 100644 --- a/home/.config/fish/conf.d/env.fish +++ b/home/.config/fish/conf.d/env.fish @@ -101,13 +101,15 @@ set -gx _ZO_RESOLVE_SYMLINKS 1 # set -gx _ZL_ROOT_MARKERS ".git,.svn,.hg,.root,package.json,.projectile,.pro" # set -gx RANGER_ZLUA $HOME/.config/fish/z.lua # forgit -if test $XDG_SESSION_TYPE = "wayland" - set -gx FORGIT_COPY_CMD wl-copy -else if test $XDG_SESSION_TYPE = "x11" - if command -v xclip >/dev/null - set -gx FORGIT_COPY_CMD "xclip -selection clipboard" +if test -n "$XDG_SESSION_TYPE" + if test $XDG_SESSION_TYPE = "wayland" + set -gx FORGIT_COPY_CMD wl-copy else - set -gx FORGIT_COPY_CMD "xsel -i -b" + if command -v xclip >/dev/null + set -gx FORGIT_COPY_CMD "xclip -selection clipboard" + else + set -gx FORGIT_COPY_CMD "xsel -i -b" + end end end # nnn diff --git a/home/.config/zsh/.zshenv b/home/.config/zsh/.zshenv index 5920c87..b14ea6b 100644 --- a/home/.config/zsh/.zshenv +++ b/home/.config/zsh/.zshenv @@ -387,13 +387,15 @@ export ABBR_USER_ABBREVIATIONS_FILE="$HOME/.local/share/zsh/abbreviations" # gencomp export GENCOMP_DIR=$XDG_DATA_HOME/zsh/completions # forgit -if [ "$XDG_SESSION_TYPE" = "wayland" ]; then - export FORGIT_COPY_CMD="wl-copy" -elif [ "$XDG_SESSION_TYPE" = "x11" ]; then - if command -v xclip >/dev/null; then - export FORGIT_COPY_CMD="xclip -selection clipboard" +if [ -n "$XDG_SESSION_TYPE" ]; then + if [ "$XDG_SESSION_TYPE" = "wayland" ]; then + export FORGIT_COPY_CMD="wl-copy" else - export FORGIT_COPY_CMD="xsel -i -b" + if command -v xclip >/dev/null; then + export FORGIT_COPY_CMD="xclip -selection clipboard" + else + export FORGIT_COPY_CMD="xsel -i -b" + fi fi fi