RyanGreenup / cadmus

Shell Scripts to Facilitate Effective Note Taking
169 stars 7 forks source link

Add CLIPBOARD_COPY and CLIPBOARD_PASTE environment variables #1

Open alexherbo2 opened 4 years ago

RyanGreenup commented 4 years ago

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?

alexherbo2 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

@RyanGreenup Sure.