What does HackerNews think of native_messenger?

Native messenger for Tridactyl, a vim-like web-extension.

Language: Nim

You can achieve this with native messaging [0] in tridactyl [1]:

https://github.com/tridactyl/tridactyl/blob/850acdf2ca11018e...

It's really cool, I've added an option to open these windows in floating mode automatically in my sway config through another application name iirc. Ans then I press a simple shortcut, and it opens my editor (Helix) with the already entered text and once I close it, it'll transfer the text from that temporary file which was open in your editor to the the input field/textare again.

[0] https://github.com/tridactyl/native_messenger [1] https://github.com/tridactyl/tridactyl

For those using firefox there is tridactyl available as others have commented as well. They've gone a step further introducing native messaging [1][2] which opens up an endless ways of interacting with the underlying OS which makes implementing all sorts of useful day-to-day functionality such as personal automation a joyful breeze.

For example, saving the current page in a local file can be as easy as: tri.excmds.exclaim_quiet ('echo "' + document.location.href + '"' > $HOME/notes')

Sky is the limit given that you can interface with any page with JS and then pipe and process the output with any system utility or system context.

A simple example for demonstration would be copying the contents of the body tag, piping them to a readability[3] util and have the output saved to a local vault.

Or have a video played with mpv with a press of a button since you can invoke any of these functions be it custom or built-in targeting any element the same way you would follow a link by hinting.

Here are a few other, pretty interesting use cases as seen in examplar custom user configurations taken from their github wiki[4]

alias playAllVideos js tri.native.run("mpv --really-quiet --ontop --keepaspect-window --profile=protocol.http " + Array.from(document.querySelectorAll("a, iframe, video")).reduce((s, e) => {let r=(/^https?:\/\/((www.)?youtu((\.be\/)|(be\.com\/((embed\/)|(watch\?v=))))[^ ]+)|(.+\.webm)$/);let l="";if(e.tagName=="IFRAME")l=e.src.match(r);else if(e.tagName=="A")l=e.href.match(r)||e.innerText.match(r);else if(e.tagName=="VIDEO")l=[e.currentSrc?e.currentSrc:e.src];console.log(l);return s+(l && l.length > 0 && s.indexOf(l[0])<0?"'"+l[0]+"' ":"")},""))

alias gitclone jsb -p tri.native.run("git clone --depth=1 '" + JS_ARG + "' /home/me/prog/" + JS_ARG.split("/").slice(-1))

alias rsssave jsb -p tri.native.run('cat >> ~/.config/newsboat/urls', JS_ARG + "\n")

alias openGithubNotifications composite js Array.from(document.querySelectorAll("li.list-group-item > span:nth-child(1) > a:nth-child(2)")).map(e => e.href) | jsb -p JS_ARG.forEach(url => tri.excmds.tabopen(url))

Edit: I assume native messaging has security implications you should probably consider if the browser is running directly with your system without any means of isolation like sandboxing with bubblewrap or better running under a virtual environment.

[1] https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/Web... [2] https://github.com/tridactyl/native_messenger [3] https://github.com/cixtor/readability [4] https://github.com/tridactyl/tridactyl/wiki/

I think you've misunderstood, "native messaging" allows the tridactyl extension to interact with the filesystem and native applications: https://github.com/tridactyl/native_messenger