index.md (4191B)
1 Right click to plumb 2 ==================== 3 Pretty much like plan9's acme and plumber: right-click some selected text to 4 send it to the plumbing program of your choosing: 5 6 * open an URL in a browser 7 * view an image, PDF, ... 8 * jump from logs to editor, at the specified line/col 9 * etc 10 11 The shell current working directory is set by the shell via `OSC 7` (borrowed 12 from vte, see `/etc/profile.d/vte.sh` if you have it installed). 13 14 For zsh : 15 __vte_urlencode() ( 16 # This is important to make sure string manipulation is handled 17 # byte-by-byte. 18 LC_ALL=C 19 str="$1" 20 while [ -n "$str" ]; do 21 safe="${str%%[!a-zA-Z0-9/:_\.\-\!\'\(\)~]*}" 22 printf "%s" "$safe" 23 str="${str#"$safe"}" 24 if [ -n "$str" ]; then 25 printf "%%%02X" "'$str" 26 str="${str#?}" 27 fi 28 done 29 ) 30 31 __vte_osc7 () { 32 printf "\033]7;%s%s\a" "${HOSTNAME:-}" "$(__vte_urlencode "${PWD}")" 33 } 34 35 [ -n "$ZSH_VERSION" ] && precmd_functions+=(__vte_osc7) 36 37 The patch itself only adds a `cwd` global and a button3 entry that will run a 38 shell, change directory to cwd and run the plumber with the primary selection. 39 Maybe I should use pass cwd as an argument too, like plan9 plumber does. 40 41 The plumbing program can be defined via `config.h`: 42 43 static char plumber[] = "plumb.sh"; 44 45 Download 46 -------- 47 * [right\_click\_to\_plumb.diff](right_click_to_plumb.diff) (2017-09-11) 48 49 Authors 50 ------- 51 * [jerome](http://blog.jardinmagique.info) <jerome@gcu.info> 52 53 A simpler plumb patch 54 ===================== 55 The plumbing command is run in the working directory of the shell, with as 56 parameter the text selected with the mouse. 57 58 Configuration is done in config.h and an example is supplied in config.def.h: 59 60 static char *plumb_cmd = "plumb"; 61 62 I made this version since I had a hard time understanding how the OSC 7 stuff 63 works and I preferred a full C implementation of a plumbing patch. 64 65 Download 66 -------- 67 * [plumb\_without\_shell\_OSC.diff](plumb_without_shell_OSC.diff) (2018-11-03) 68 69 Authors 70 ------- 71 * [john](http://roxor.me) <j@roxor.me> 72 73 A simpler, more flexible plumb patch 74 ==================================== 75 A further development on the previous patch to allow for specifying the command line 76 77 static char *plumb_cmd[] = {"plumb", "-m", NULL, NULL}; 78 79 My plumb utility takes on the stdin by default, and requires another option to 80 be passed input on the command line, so I made this to allow for that. It can be 81 applied on its own, without the other patches. It replaces the first NULL with 82 the current selection. 83 84 Download 85 -------- 86 * [simple_plumb-0.9.3.diff](simple_plumb-0.9.3.diff) (2025-08-19) 87 * [simple_plumb-0.8.5.diff](simple_plumb-0.8.5.diff) (2022-01-18) 88 * [simple_plumb.diff](simple_plumb.diff) (2020-04-10) 89 90 Authors 91 ------- 92 * [dallin](https://dallinjdahl.github.io/) <dallinjdahl@gmail.com> 93 * [Alexander Arkhipov](gopher://mineeyes.cyou/) (0.8.5 port) 94 95 Double click to plumb 96 ===================== 97 Adds additional functionality to the simple_plumb patch that allows the user to plumb a selected word 98 via double clicking while a mask key is held down. 99 100 This patch should be applied after simple_plumb. 101 102 Download 103 -------- 104 * [simple\_plumb\_double\_click-0.8.5.diff](simple_plumb_double_click-0.8.5.diff) (2022-08-01) 105 106 Author 107 ------ 108 * yasumori <ysmr@protonmail.com> 109 110 An even simpler plumb patch 111 =========================== 112 The differences of this patch to the simple, flexible plumb patch: 113 114 * The code for retrieving and setting the current working directory and executing is the 115 same as newterm, if patching with newterm it is suggested to keep the same function, hence 116 no global variables and initialization, and current selection of plumb. 117 * Double-fork execution of the plumber program, while this may have no benefit with programs 118 that only launch in CLI, this may interfere with the swallow patch if launching GUI programs. 119 * No arguments are passed to the plumber program, only the plumber program name is accepted. 120 * The plumb function can be passed to the mouse shortcuts in `config.h`, 121 instead of being hard-coded. 122 123 Download 124 -------- 125 * [simpler\_plumb-0.9.diff](simpler_plumb-0.9.diff) 126 127 Author 128 ------ 129 * sewn <sewn@disroot.org>