Add macOS support to clip function

bladee.bsky.social 9b4663cd 79dc3a30

verified
Changed files
+20 -13
dot_config
private_fish
+20 -13
dot_config/private_fish/functions/clip.fish
···
function clip
-
if test $XDG_SESSION_TYPE = x11
-
if ! command --query xclip
-
echo -e "Error: `xclip` must be installed to copy on an X11 session"
-
return 1
-
end
-
-
command xclip -selection c
-
else if test $XDG_SESSION_TYPE = wayland
-
if ! command --query wl-copy
-
echo -e "Error: `wl-clipboard` must be installed to copy on a Wayland session"
+
if test (uname -s) = Darwin
+
command pbcopy
+
else if test (uname -s) = Linux
+
if test $XDG_SESSION_TYPE = x11
+
if ! command --query xclip
+
echo -e "Error: `xclip` must be installed to copy on an X11 session"
+
return 1
+
end
+
+
command xclip -selection c
+
else if test $XDG_SESSION_TYPE = wayland
+
if ! command --query wl-copy
+
echo -e "Error: `wl-clipboard` must be installed to copy on a Wayland session"
+
return 1
+
end
+
+
command wl-copy
+
else
+
echo -e "Error: Unknown session type `$XDG_SESSION_TYPE`"
return 1
end
-
-
command wl-copy
else
-
echo -e "Error: Unknown session type `$XDG_SESSION_TYPE`"
+
echo -e "Error: Unsupported operating system `$(uname -s)`"
return 1
end
end
dot_config/private_fish/functions/fish_greeting.fish dot_config/private_fish/functions/fish_greeting.fish.tmpl