Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: if statement breaking copy() and ccopy() on macos #395

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tjex
Copy link

@tjex tjex commented Dec 11, 2023

Resolves issue #361.

Problem: ccopy and copy 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.

@abitrolly
Copy link
Collaborator

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?

https://superuser.com/questions/1074068/what-is-the-difference-between-desktop-session-xdg-session-desktop-and-xdg-cur

@tjex
Copy link
Author

tjex commented Nov 18, 2024

I'm not following the reasoning for your questions. Should they apply to the pr or are they general questions?

@abitrolly
Copy link
Collaborator

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.

@tjex
Copy link
Author

tjex commented Nov 19, 2024

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)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants