Skip to content

Commit

Permalink
fix(linux): check XDG_SESSION_TYPE when determining copy command
Browse files Browse the repository at this point in the history
Resolve an issue with the GH_FZF_COPY_CMD config option's default value
on linux machines where both Wayland and X11 are installed.
  • Loading branch information
benelan committed Jul 7, 2024
1 parent 617ae65 commit f743c80
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gh-fzf
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ GH_FZF_DEFAULT_LIMIT="${GH_FZF_DEFAULT_LIMIT:-75}"
if [ -z "$GH_FZF_COPY_CMD" ]; then
if has /mnt/c/Windows/System32/clip.exe; then
GH_FZF_COPY_CMD="/mnt/c/Windows/System32/clip.exe" # Windows (WSL)
elif has wl-copy && [ "$XDG_SESSION_TYPE" = "wayland" ]; then
GH_FZF_COPY_CMD="wl-copy" # Linux (Wayland)
elif has xsel; then
GH_FZF_COPY_CMD="xsel -bi" # Linux (X11)
elif has xclip; then
GH_FZF_COPY_CMD="xclip -selection clipboard" # Linux (X11)
elif has wl-copy; then
GH_FZF_COPY_CMD="wl-copy" # Linux (Wayland)
elif has pbcopy; then
GH_FZF_COPY_CMD="pbcopy" # OSX
fi
Expand Down

0 comments on commit f743c80

Please sign in to comment.