[dev] [st] mouse usage, right click to plumb selection

From: Jérôme Andrieux <jerome_AT_jardinmagique.info>
Date: Tue, 12 Sep 2017 13:38:42 +0200

Bonjour suckless,

TLDR: I use the mouse button3 to plumb the current selection in st,
how would you feel about making this patch a core feature?

I pushed a patch for st yesterday that I have been using for a while,
after getting addicted to some plan9/9term/acme features :
https://st.suckless.org/patches/right_click_to_plumb/
(Thanks Evil_Bob)

For those unfamiliar with plan9/acme, "right click to plumb" means
"right click in your terminal to send its current text selection to
some plumbing script": open a PDF with zathura, jump to
path/file:line:cal in your editor, launch browser at URL ...
acme packs together a lot of features, being a "window manager", a
shell and an editor at the same time, and integrating with the
surrounding system via its plumber and its 9pfs system. It can get
quite addictive integration-wise but also quite frustrating when you
are used to vi, non-dumb terminals and generic tiling window managers.
mpu has even written its own acme/vi hybrid editor.

Using the mouse to trigger the plumbing within st has an advantage
over using a keybinding from dwm, since it eventually allows to get
some context and most importantly the current working directory of the
shell within st, and thus allows to plumb path relative to cwd.
Both are not mutually exclusive, I use a binding to trigger something
like "plumber `xclip -o`" from anywhere. The mouse just makes it a bit
nicer within st.

Now, I get that URL matching/launching is explicitly marked as a non
goal for st but I understood that as "we don't provide a parser and a
plumber, double click to select is smart enough".
For some reason, rxvt, VTE based terminal emulators & others preferred
the complex logic of parsing, matching ... URLs only. The termite
terminal emulator requires a vte-ng fork to provide features that
won't even match a path/file:line ... Tilix provides its own sub-par
regex only plumber, tabs and sub-par tiling system.
Now, with st, it is just a matter of a dozen LOC to feed the plumber
of your choosing and get on with your life.

The patch I mentioned above introduce :
- a "cwd" global that is fed from a shell function pushing an OSC7
escape sequence, instead of descending the st child pid. It's simple
to code at the expense of more work on the user side.
- "plumber_cmd" configuration entry for the user to set, that is
executed in a shell, in `cwd`. I am not sure whether changing
directory before executing is preferable to passing `cwd` as an
argument alongside sel.primary

Is this feature of any interest? Bloat? Not enough?

-- 
Jérôme
Received on Tue Sep 12 2017 - 13:38:42 CEST

This archive was generated by hypermail 2.3.0 : Tue Sep 12 2017 - 13:48:19 CEST