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

make "y" copy independent of a display server #18

Open
m040601 opened this issue Jul 17, 2022 · 2 comments
Open

make "y" copy independent of a display server #18

m040601 opened this issue Jul 17, 2022 · 2 comments

Comments

@m040601
Copy link

m040601 commented Jul 17, 2022

First of all thank your work on this really interesting tool. I found it via suckless.org and the termbox library links. Nice to know you're also an Archlinux user. It really deserves a post there on the forum.

You can press y to copy a selected item into X or Wayland clipboard. Note that you must have xsel or wl-copy installed (depending on whether you use X or Wayland) to use the command.

You also can press o to write a path to standard output and exit program. It may be useful in a system without a display server.

So, by default, "y" is binded to a clipboard action. When one is not using X11/Wayland it doesnt do anything.

Since I'm using tmux, without X11 I tried in ~/.config/ictree/config

map y echo "$f" | tmux load-buffer -

And it worked !

So, my suggestion, instead of hard coding "y" to use xsel etc,

Maybe you could probe for a $DISPLAY environement (returning false), and a $TMUX environment (returning true). If both check then map y to the tmux copy buffer.

By the way,

You can define custom commands in a configuration file
to open selected path in another program (e.g. an image viewer or a text editor):

open file in $EDITOR
map e $EDITOR $f

You might want to add to the README/man page a word or two about quoting that $f.
Apparently ictree sends $f unquoted.

I first tried

map e $EDITOR $f
or
map i $PAGER $f

But very often my folders and files have spaces, so it failed.

I had to

map e $EDITOR "$f"
or
map i $PAGER "$f"

@NikitaIvanovV
Copy link
Owner

Maybe you could probe for a $DISPLAY environement (returning false), and a $TMUX environment (returning true). If both check then map y to the tmux copy buffer.

That's a good idea, will do!

You might want to add to the README/man page a word or two about quoting that $f.

Added quotes in examples: b561d0e . I think that should suffice?

@jirutka
Copy link
Contributor

jirutka commented Aug 1, 2022

TIP: You can also use tty-copy to make copying work even via SSH. ;)

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

No branches or pull requests

3 participants