niedzielski / cb

📋 Universal command-line clipboard with automatic copy and paste detection. Eg, `cb|sort|cb`. The missing link between GUIs and CLIs!
The Unlicense
125 stars 6 forks source link

Termux #7

Closed chapmanjacobd closed 1 year ago

chapmanjacobd commented 1 year ago

termux-clipboard-get termux-clipboard-set

example usage

string replace --all --regex '\s{2,}' '\n' -- (termux-clipboard-get) | termux-clipboard-set
niedzielski commented 1 year ago

Hm, I think Termux is mostly used for Android? I'm unsure if I've used it before and don't understand the example usage here or what language it is. The readme suggests an approach that only relies on PATH and should work with any terminal.

chapmanjacobd commented 1 year ago

okay I tried it out

/data/data/com.termux/files/home/bin/cb: 14: XDG_SESSION_TYPE: parameter not set

it looks like termux provides an xclip but it's just a shell script with an incomplete API. I think calling termux-clipboard-get/set directly would be better.

Screenshot_20230924_151234_Termux.jpg

is_android() { [ -n "$TERMUX_VERSION" ]; }

elif is_android; then
  alias cbcopy=termux-clipboard-set
  alias cbpaste=termux-clipboard-get

these changes allow it to work. I'm sure Android is pretty low priority so I'll close this issue but if you want to make the change feel free or if you want me to open a PR I can do that

https://github.com/chapmanjacobd/phone/blob/main/bin/cb