<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Vedang.me, posts tagged webdev</title>
  <link href="https://vedang.me/feeds/webdev.xml" rel="self"/>
  <link href="https://vedang.me/"/>
  <updated>2026-08-31T02:14:12+00:00</updated>
  <id>https://vedang.me/</id>
  <author>
    <name>Vedang Manerikar</name>
  </author>
  <entry>
    <id>https://vedang.me/tabfs-and-automation/</id>
    <link href="https://vedang.me/tabfs-and-automation/"/>
    <title>TabFS and Automation</title>
    <updated>2022-09-20T00:00:00+00:00</updated>
    <content type="html"><![CDATA[<p>Hello reader! This is a short update about the very cool <a href='https://omar.website/tabfs/'>TabFS</a>, which is a browser extension that maps your open tabs to the filesystem using Fuse. Think <code>/proc</code> but for the browser. This is an excellent idea, because now I can run all the tools that I am already familiar with on my tabs!</p><p>As I was reading through the TabFS page (linked above), I thought to myself: "this is so much RC energy!". So I checked, and lo and behold, Omar Rizwan is an RC Alum :D</p><h1 id="why_i_wanted_something_like_tabfs">Why I wanted something like TabFS</h1><p>The internet is full of interesting stuff that hijacks my attention. I end up getting completely distracted from my planned tasks. My solution to this is: I open all the links I want, but I don't read anything immediately. Instead, I capture the link in Org-Mode and schedule it for later (generally tomorrow). This way, when I am planning the day, I have a bunch of links in my Agenda. I choose which ones I want to read on any given day and defer / delete the rest. I use the excellent <a href='https://orgmode.org/manual/Agenda-Commands.html'>Bulk Scatter</a> tool built into Org Agenda for this.</p><p>I thought: Why do this manually? Enter TabFS</p><h1 id="a_small_babashka_script">A small Babashka script</h1><p>With TabFS installed, it was a small step to go from there to <code>org-mode</code>. My go-to scripting tool is <a href='https://book.babashka.org/'>Babashka</a>. Here is the meat of the code:</p><pre><code class="language-clojure">&#40;require '&#91;babashka.fs :as fs&#93;
         '&#91;clojure.string :as cs&#93;&#41;

&#40;defn build-tab-info
  &quot;Collects the title and URL for all open tabs using TabFS.&quot;
  &#91;opts&#93;
  &#40;map &#40;fn &#91;t&#93;
         {:title &#40;first &#40;fs/read-all-lines &#40;str t &quot;/title.txt&quot;&#41;&#41;&#41;
          :url &#40;first &#40;fs/read-all-lines &#40;str t &quot;/url.txt&quot;&#41;&#41;&#41;}&#41;
       &#40;fs/list-dir &#40;:tab-dir opts&#41;&#41;&#41;&#41;

&#40;def plain-text-template
  &quot;The template for creating the org-mode plain-text entry. Placeholders
are for the following items &#40;in order&#41;:
  1. Org-Mode Heading level: default value is 1.
  2. URL of the link to the stored.
  3. Title of the link to be stored.
  4. Date when the Tab is scheduled for reading: default is tomorrow.
  5. Date when the Tab was captured.&quot;
  &quot;%s TODO &#91;&#91;%s&#93;&#91;%s&#93;&#93;\nSCHEDULED: %s\n%s&quot;&#41;

&#40;defn tabs-&gt;text
  &quot;Convert the list of open tabs to a wall of text that can be stored in
  Plain-Text.&quot;
  &#91;opts&#93;
  &#40;-&gt;&gt; &#40;build-tab-info opts&#41;
       &#40;map &#40;fn &#91;t&#93;
              &#40;format plain-text-template
                      &#40;apply str &#40;repeat &#40;:org-mode-heading-level opts&#41; &quot;&#42;&quot;&#41;&#41;
                      &#40;:url t&#41;
                      &#40;:title t&#41;
                      &#40;:scheduled-on opts&#41;
                      &#40;:captured-on opts&#41;&#41;&#41;&#41;
       &#40;cs/join \newline&#41;&#41;&#41;
</code></pre><p>I wrote a <a href='https://github.com/vedang/bb-scripts#bb-plain-text-tabs'>CLI script</a> for the code, here is what the <code>help</code> command looks like:</p><pre><code>✦ ➜ bb-plain-text-tabs --help
Convert all open tabs to plain text Org Mode format. Optionally, close the open tabs.

Usage: bb-plain-text-tabs &#91;options&#93;

Options:
  -fs,  --tabfs-mnt-path                &#42;REQUIRED&#42; TabFS mount path. The path on the filesystem where TabFS is mounted.
  -hl,  --org-mode-heading-level        1                            The heading level at which link headings will be stored in Org Mode.
  -s,   --scheduled-on           &lt;date&gt; tomorrow                     Date on which to schedule reading this batch of links, in yyyy-MM-dd format.
  -del, --delete-tabs            &lt;del&gt;  false                        Boolean value to indicate if browser tabs should be closed

Examples:
   bb-plain-text-tabs -fs &lt;TabFS Mount Path&gt; # Convert Open Tabs to Plain Text
   bb-plain-text-tabs -fs &lt;TabFS Mount Path&gt; --delete-tabs # Delete tabs and print plain text
   bb-plain-text-tabs -fs &lt;TabFS Mount Path&gt; | tee tabs.org # Capture Plain Text output to file
</code></pre><h1 id="what_it_looks_like">What it looks like</h1><p>Finally, this is the output, in Org Mode:</p><p><img src="/assets/images/tabfs.png" alt="img" title="Open Tabs moved to org-mode, and automatically closed!" /></p><p>I hope all the Emacs/Org-mode folks reading this find it useful! Thank you to Omar for the excellent <a href='https://omar.website/tabfs/'>TabFS</a> tool!</p>]]></content>
  </entry>
</feed>
