Skip to content

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

Description

@m040601

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"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions