Open tjex opened 11 months ago
Does MacOS expose $XDG_CURRENT_DESKTOP
variable?
Is it possible at all to run cht.sh
script on MacOS without desktop?
If yes, then is clipboard copy possible in this case?
I'm not following the reasoning for your questions. Should they apply to the pr or are they general questions?
We need to detect if clipboard is available. It probably only available if script is run in the desktop session. The way to detect desktop session on Linux is using $XDG_CURRENT_DESKTOP
variable. The questions are about how it works on MacOS.
ah ok. Well as far as I found out, $DESKTOP
used to exist as an env variable on mac. But not any more. I would say that as osx effectively is a desktop environment (there is no headless / minimal install or such) then it's redundant to check? Another option could just be to check $(which pbcopy)
?
Resolves issue #361.
Problem:
ccopy
andcopy
return an error on mac, "copy: supported only in the Desktop version"This is because the cht.sh script checks for presence of the
$DISPLAY
environment variable, which is no longer a part of MacOS as it comes from the X11 days. So, calling the function would always return the error on mac.pr366 attempted to fix this with a similar approach.
The solution of this PR reuses the
$is_macos
boolean variable, which is already a part of this script.It now only returns the error if
$DISPLAY
is null/empty and the OS is not MacOS.