1
0
Files
dotfiles/.config/fish/functions/clip.fish
2024-12-14 00:15:47 +01:00

20 lines
404 B
Fish

function clip
set -g stdin
if not tty -s >/dev/null
read stdin
end
set stdin $(string trim -- $stdin)
set -l argv $(string trim -- $argv)
if test -n "$argv"
echo "$argv" | xclip -selection clipboard
return 0
end
if test -n "$stdin"
echo "$stdin" | xclip -selection clipboard
return 0
end
xclip -selection clipboard -o
end