urxvt-selection-pastebin(1)

πŸ’– selection-pastebin β€” automatic pastebin upload πŸ’–

okay so bestie, welcome to urxvt-selection-pastebin(1), part of the RXVT-UNICODE manual fam πŸ¦‹. This is a lil extension that does one specific slay little thing, and honestly? It's giving niche icon energy. Let's get into it ✨


🌸 EXAMPLES 🌸

Here's the whole vibe in one line, literally:

URxvt.keysym.C-M-e: selection-pastebin:remote-pastebin

that's it. that's the example. bind it and go πŸ’…


✨ DESCRIPTION ✨

okay so real talk: this is a little rarely-useful extension that uploads your selection as a textfile to a remote site (or does other things, honestly, it's flexible like that 🫢).

🚨 important caveat, no cap: the implementation is not currently secure for use in a multiuser environment, because it writes to /tmp directly. So like... be aware of that. Read the room before you deploy it on a shared box, bestie 😭

It listens to the selection-pastebin:remote-pastebin action β€” and when that action gets activated, it runs a command with % replaced by the name of the textfile. You set that command via a resource, like this:

URxvt.selection-pastebin.cmd: rsync -apP % ruth:/var/www/www.ta-sa.org/files/txt/.

and the default? yeah, the default is likely not useful to anybody but the few people around here :) β€” that's a direct quote from the manpage, we're keeping it, it's iconic πŸ‘‘

Now, the name of the textfile is the hex encoded md5 sum of the selection β€” which is a whole vibe, because it means the same content should lead to the same filename. deterministic queen behavior πŸ’–

After a successful upload, the selection gets replaced by the text given in the selection-pastebin-url resource (again, % is the placeholder for the filename, same energy as before):

URxvt.selection-pastebin.url: http://www.ta-sa.org/files/txt/%

πŸŽ€ a note for the xrdb girlies πŸŽ€

Listen up, xrdb users, this one's for you:

xrdb uses the C preprocessor, which might interpret those double "/" characters as a comment start πŸ’€. So instead of writing them straight, use "\057\057" β€” that works regardless of whether xrdb is used to parse the resource file or not. so fr fr, use that and you're golden 🌈


⭐ lowkey the whole extension in one sentence: it hashes your selection, drops it in a textfile, fires off your command, and swaps your selection for your URL template. cute, simple, a little chaotic. we stan πŸ’…

and that's the page! ✨ this was written by the RXVT-UNICODE girlies, version 9.31, dated 2023-12-02 β€” mwah, ty for reading, ily, go upload a pastebin πŸ“πŸ’œ

πŸ“¦ where this page comes from