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

Add CLIPBOARD_COPY and CLIPBOARD_PASTE environment variables #1

Open
alexherbo2 opened this issue Jul 16, 2020 · 7 comments
Open

Add CLIPBOARD_COPY and CLIPBOARD_PASTE environment variables #1

alexherbo2 opened this issue Jul 16, 2020 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@alexherbo2
Copy link

No description provided.

@RyanGreenup
Copy link
Owner

Yeah sure thing, can you be more specific, do you mean something to specify the command so that the script doesn't rely specifically on xclip? so something like this:

CLIPBOARD_COPY="xclip -selection clipboard"

I recently refactored the code so it uses a config.json, so this could probably go into there, what do you think?

@RyanGreenup RyanGreenup added enhancement New feature or request good first issue Good for newcomers labels Jul 20, 2020
@RyanGreenup RyanGreenup self-assigned this Jul 20, 2020
@alexherbo2
Copy link
Author

Yep, it sounds good. I use a similar approach for a plumb script. It uses the CLIPBOARD_COPY and CLIPBOARD_PASTE command implementation, with defaults (for Wayland, X11, macOS) if they are not set.

@RyanGreenup
Copy link
Owner

So I implemented this in 5f05120, but I haven't put the xclip into the config file yet because I don't know better.

@alexherbo2 would you be able to point me in the right direction for some other default clipboard tools for other systems? I've always just used Xorg and xclip, but I do use sway quite a bit in another TTY so I should probably get this working,

System tool
X11 xclip
Wayland ??
MacOS ??
WSL ??
BSD ??

Also does anybody know if it safe to use $XDG_SESSION_TYPE inside the config script to automatically set the users clipboard?

@RyanGreenup RyanGreenup added question Further information is requested and removed good first issue Good for newcomers labels Jul 22, 2020
@RyanGreenup
Copy link
Owner

RyanGreenup commented Jul 22, 2020

  • Mac

    • pbcopy
    • pbopen
  • Wayland

    • wl-open
    • wl-paste
  • BSD is just Xclip

Try also something like this :

#!/bin/sh

case "$(uname -s)" in

   Darwin)
     echo 'Mac OS X'
     ;;

   Linux)
     echo 'Linux'
     ;;

   CYGWIN*|MINGW32*|MSYS*|MINGW*)
     echo 'MS Windows'
     ;;

@RyanGreenup
Copy link
Owner

So as of d3b53df the cadmus script should now use commands for the clipboard based on the kernel name using uname -s, this issue however, should stay open until #12 is closed because any subscript other than find and search doesn't follow the stdin/stdout philosophy and hence this logic will not be applied.

can somebody on macOS confirm that cadmus convert org2md actually transforms the clipboard?

@RyanGreenup RyanGreenup added bug Something isn't working and removed enhancement New feature or request question Further information is requested labels Jul 23, 2020
RyanGreenup added a commit that referenced this issue Jul 23, 2020
RyanGreenup added a commit that referenced this issue Jul 23, 2020
This means that the xclip used will be governed by cadmus making it more
cross platform
@RyanGreenup
Copy link
Owner

Now all the subscripts either take STDIN or STDOUT (or checks itself in the case of fix) and cadmus tests the OS for the appropriate clipboard command.

Any scripts underneath bin/tags or bin/tools needs to be re-written, I just copy pasted them in from where they were, they're all half-assed, but that's tracked in #12

@alexherbo2 Could you review the changes I made and if they address the issue could you please close it?

@alexherbo2
Copy link
Author

@RyanGreenup Sure.

  • Prefer CLIPBOARD_COPY and CLIPBOARD_PASTE naming. CLIP_IN and CLIP_OUT naming sounds very specific to xclip.
  • Also long option names for understanding what they do when possible.
  • Using the same approach than the plumb script I mentioned for detecting the user environment and setting the clipboard variables.
  • Making xclip copying both primary and clipboard selections (xclip -filter | xclip -selection clipboard).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants