<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="https://basetta.bz/feed_style.xsl" type="text/xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <tabi:metadata xmlns:tabi="https://github.com/welpo/tabi">
        <tabi:base_url>https://basetta.bz</tabi:base_url>
        <tabi:separator>
            •
        </tabi:separator>
        <tabi:about_feeds>
            This is a web feed, also known as an Atom feed. Subscribe by copying the URL from the address bar into your newsreader. Visit About Feeds to learn more and get started. It's free.
        </tabi:about_feeds>
        <tabi:visit_the_site>
            Visit website
        </tabi:visit_the_site>
        <tabi:recent_posts>
            Recent posts
        </tabi:recent_posts>
        <tabi:last_updated_on>
            Updated on $DATE
        </tabi:last_updated_on>
        <tabi:default_theme></tabi:default_theme>
        <tabi:post_listing_date>date</tabi:post_listing_date>
        <tabi:current_section>tech</tabi:current_section>
    </tabi:metadata><title>Basetta&apos;s Website - tech</title>
        <subtitle>Welcome to my personal blog! Find honest reflections, helpful advice, and a fresh perspective on travel, lifestyle, and more. Start exploring now.</subtitle>
    <link href="https://basetta.bz/tags/tech/atom.xml" rel="self" type="application/atom+xml"/>
    <link href="https://basetta.bz/tags/tech/" rel="alternate" type="text/html"/>
    <generator uri="https://www.getzola.org/">Zola</generator><updated>2026-10-30T00:00:00+00:00</updated><id>https://basetta.bz/tags/tech/atom.xml</id><entry xml:lang="en">
        <title>tmux Said “Not a Terminal.” The Terminal Was Fine</title>
        <published>2026-10-30T00:00:00+00:00</published>
        <updated>2026-10-30T00:00:00+00:00</updated>
        <author>
            <name>Patrick Martini</name>
        </author>
        <link rel="alternate" href="https://basetta.bz/blog/tmux-not-a-terminal/" type="text/html"/>
        <id>https://basetta.bz/blog/tmux-not-a-terminal/</id>
        
            <content type="html">&lt;p&gt;&lt;em&gt;How a misleading error sent us chasing terminal settings—and how we recovered the existing sessions without restarting their server.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;I had just updated Ghostty. Then I opened a terminal, typed &lt;code&gt;tmux&lt;/code&gt;, and got:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;open terminal failed: not a terminal&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The timing made Ghostty the obvious suspect. Everything had worked before the update, and now tmux refused to open.&lt;/p&gt;
&lt;p&gt;But the terminal was fine. The breakthrough came when we stopped looking only at the terminal and started looking at &lt;strong&gt;which tmux server the client was talking to&lt;/strong&gt;.&lt;/p&gt;
&lt;h2 id=&quot;the-confusing-part-my-sessions-were-still-there&quot;&gt;The confusing part: my sessions were still there&lt;/h2&gt;
&lt;p&gt;Although attaching failed, listing sessions worked:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;tmux&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; list-sessions&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;All my existing sessions appeared, including projects with multiple windows and running processes.&lt;/p&gt;
&lt;p&gt;That was reassuring, but also confusing: if tmux could find my sessions, why couldn’t it open one?&lt;/p&gt;
&lt;p&gt;The distinction matters. Listing sessions only requires communication with the server. Attaching also requires the server to accept and initialize the client’s terminal.&lt;/p&gt;
&lt;p&gt;One can work while the other fails.&lt;/p&gt;
&lt;h2 id=&quot;the-false-leads&quot;&gt;The false leads&lt;/h2&gt;
&lt;p&gt;We initially investigated terminal configuration:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Was Ghostty’s terminfo entry missing?&lt;/li&gt;
&lt;li&gt;Was &lt;code&gt;$TERM&lt;/code&gt; incorrect?&lt;/li&gt;
&lt;li&gt;Was a shell plugin interfering?&lt;/li&gt;
&lt;li&gt;Did the shell lack a controlling terminal?&lt;/li&gt;
&lt;li&gt;Had the Ghostty update introduced a PTY regression?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Those were hypotheses—not established causes. Several were stated far too confidently during the troubleshooting.&lt;/p&gt;
&lt;p&gt;Changing Ghostty’s terminal type to &lt;code&gt;xterm-256color&lt;/code&gt; did not help. Neither did upgrading the tmux client, first to a newer stable release and then to a development build.&lt;/p&gt;
&lt;p&gt;We also made an important diagnostic mistake: running terminal checks through a coding agent’s command runner. Those commands ran without an interactive TTY, so their results did not describe the actual Ghostty shell.&lt;/p&gt;
&lt;p&gt;The useful checks had to run &lt;strong&gt;directly in Ghostty&lt;/strong&gt;:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;tty&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; -t&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; ] &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;z-11 z-i&quot;&gt; echo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;stdin: tty&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; -t&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; ] &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;z-11 z-i&quot;&gt; echo&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;stdout: tty&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;They showed a valid terminal device and confirmed that stdin and stdout were TTYs.&lt;/p&gt;
&lt;p&gt;Further checks succeeded too: opening the terminal device, reading its attributes, querying its size, and passing its file descriptor between processes.&lt;/p&gt;
&lt;p&gt;There was no evidence supporting the theory that Ghostty had stopped providing a usable terminal.&lt;/p&gt;
&lt;h2 id=&quot;the-turning-point-a-separate-server&quot;&gt;The turning point: a separate server&lt;/h2&gt;
&lt;p&gt;The most useful test was also one of the simplest:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;tmux&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -L &amp;quot;ghostty-test-&lt;/span&gt;&lt;span&gt;$$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot; -f /dev/null new-session -s test&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;It worked.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This command changes two things:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;-L&lt;/code&gt; selects a separate, named server socket rather than the default one.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-f /dev/null&lt;/code&gt; starts that server without loading my tmux configuration.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It did not restart or modify the server holding my existing sessions.&lt;/p&gt;
&lt;p&gt;Next, we repeated the experiment with my normal configuration:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;tmux&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -L &amp;quot;ghostty-config-test-&lt;/span&gt;&lt;span&gt;$$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;  -f &amp;quot;&lt;/span&gt;&lt;span&gt;$HOME&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/.config/tmux/tmux.conf&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;  new-session -s test&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That worked too, apart from two unrelated configuration warnings.&lt;/p&gt;
&lt;p&gt;At that point, the problem was much narrower:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The current client could start and attach to a fresh server in Ghostty—even with my configuration. Attaching to the existing server was what failed.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;there-were-two-different-tmux-versions&quot;&gt;There were two different tmux versions&lt;/h2&gt;
&lt;p&gt;Running:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;tmux&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -V&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;reported the version of the &lt;strong&gt;client executable on disk&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;It did not tell us the version of the server that had been keeping my sessions alive.&lt;/p&gt;
&lt;p&gt;To inspect that server, we ran:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;tmux&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; display-message -p&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;  &amp;#39;server_pid=#{pid} server_version=#{version} socket=#{socket_path}&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The important parts of the result were:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;server_version=3.5a socket=/private/tmp/tmux-501/default&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;My existing server was still running &lt;strong&gt;tmux 3.5a&lt;/strong&gt;. Meanwhile, after the troubleshooting upgrades, the client reported &lt;strong&gt;&lt;code&gt;next-3.9&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Updating an installed executable does not replace a process that is already running. The old server had continued managing my sessions throughout the upgrades.&lt;/p&gt;
&lt;p&gt;That persistence is useful—but it also means “which tmux version am I using?” can have two answers.&lt;/p&gt;
&lt;h2 id=&quot;recovering-the-old-sessions&quot;&gt;Recovering the old sessions&lt;/h2&gt;
&lt;p&gt;Starting a fresh server was a useful diagnostic, but it was not the solution I needed. I wanted access to the work already running in my old sessions.&lt;/p&gt;
&lt;p&gt;Rather than kill the original server, we built a separate &lt;strong&gt;tmux 3.5a client&lt;/strong&gt; and installed it alongside the newer version:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;~/.local/opt/tmux-3.5a/bin/tmux&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then we connected it explicitly to the original server:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1&quot;&gt;~&lt;/span&gt;&lt;span&gt;/.local/opt/tmux-3.5a/bin/tmux &lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt;\&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;  -S&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; /private/tmp/tmux-501/default&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;  attach-session -t COCKPIT&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;It worked. My old session opened.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;No server restart. No deleted sessions. No need to recreate the running work.&lt;/p&gt;
&lt;p&gt;This strongly implicated compatibility between the newer clients and that particular older server. We did not establish the precise internal reason the terminal initialization failed, so claiming a specific protocol bug—or a Ghostty regression—would go beyond the evidence.&lt;/p&gt;
&lt;h2 id=&quot;where-did-that-socket-path-come-from&quot;&gt;Where did that socket path come from?&lt;/h2&gt;
&lt;p&gt;We did not guess it. The running server reported it:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;tmux&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; display-message -p &amp;#39;#{socket_path}&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;On this machine, the result was:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;/private/tmp/tmux-501/default&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The path breaks down as follows:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;/private/tmp&lt;/code&gt; is the macOS temporary directory that &lt;code&gt;/tmp&lt;/code&gt; points to.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tmux-501&lt;/code&gt; is tmux’s directory for user ID &lt;code&gt;501&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;default&lt;/code&gt; is the default server socket name.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;code&gt;-S&lt;/code&gt; option tells a client to use an exact socket path. That made it explicit that the separately installed 3.5a client should connect to the original server.&lt;/p&gt;
&lt;p&gt;Your own path may differ. Ask the server rather than copying this example blindly.&lt;/p&gt;
&lt;h2 id=&quot;a-shorter-troubleshooting-path&quot;&gt;A shorter troubleshooting path&lt;/h2&gt;
&lt;p&gt;If you encounter the same error while existing tmux sessions are still running, this is the sequence I would follow.&lt;/p&gt;
&lt;h3 id=&quot;1-preserve-the-existing-server&quot;&gt;1. Preserve the existing server&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Do not start with &lt;code&gt;tmux kill-server&lt;/code&gt;.&lt;/strong&gt; It terminates the sessions you may be trying to recover, putting their running work at risk.&lt;/p&gt;
&lt;p&gt;First, check whether they are still available:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;tmux&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; list-sessions&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&quot;2-compare-the-client-and-server-versions&quot;&gt;2. Compare the client and server versions&lt;/h3&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;tmux&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -V&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;tmux&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; display-message -p &amp;#39;server=#{version} socket=#{socket_path}&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Different versions do not automatically prove incompatibility, but they are an important clue.&lt;/p&gt;
&lt;h3 id=&quot;3-test-a-fresh-isolated-server&quot;&gt;3. Test a fresh, isolated server&lt;/h3&gt;
&lt;p&gt;Run this directly in your terminal, outside tmux:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;tmux&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -L &amp;quot;tty-test-&lt;/span&gt;&lt;span&gt;$$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot; -f /dev/null new-session -s test&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;If it opens, type &lt;code&gt;exit&lt;/code&gt; to close the test session.&lt;/p&gt;
&lt;p&gt;Success shows that a basic interactive tmux session works in that terminal. It shifts attention toward the existing server or its configuration.&lt;/p&gt;
&lt;h3 id=&quot;4-test-the-normal-configuration-separately&quot;&gt;4. Test the normal configuration separately&lt;/h3&gt;
&lt;p&gt;Start another named server with your usual configuration file. This helps distinguish configuration problems from problems specific to the original running server.&lt;/p&gt;
&lt;h3 id=&quot;5-try-a-matching-client&quot;&gt;5. Try a matching client&lt;/h3&gt;
&lt;p&gt;If the old server is running a different version, install a matching client separately and use it to attach through the server’s reported socket path:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;/path/to/matching/tmux&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -S /path/to/original/socket attach-session&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This avoids replacing or restarting the server during recovery.&lt;/p&gt;
&lt;h2 id=&quot;the-lesson&quot;&gt;The lesson&lt;/h2&gt;
&lt;p&gt;The Ghostty update was a compelling clue because it happened immediately before the failure. But timing alone did not establish the cause.&lt;/p&gt;
&lt;p&gt;The decisive evidence was:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Terminal checks passed.&lt;/li&gt;
&lt;li&gt;A fresh tmux server worked.&lt;/li&gt;
&lt;li&gt;A fresh server with my normal configuration also worked.&lt;/li&gt;
&lt;li&gt;The original server was running an older version.&lt;/li&gt;
&lt;li&gt;A matching client successfully attached to it.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The error said &lt;strong&gt;“not a terminal.”&lt;/strong&gt; The practical fix was not to change the terminal—it was to use a client that could successfully attach to the server already holding my work.&lt;/p&gt;
</content>
        <summary type="html">How a misleading tmux error sent us chasing terminal settings—and how we recovered the existing sessions without restarting their server.</summary>
        </entry><entry xml:lang="en">
        <title>From a Folder Picker to a tmux Workspace Switcher</title>
        <published>2026-10-30T00:00:00+00:00</published>
        <updated>2026-10-30T00:00:00+00:00</updated>
        <author>
            <name>Patrick Martini</name>
        </author>
        <link rel="alternate" href="https://basetta.bz/blog/tmux-sessionizer/" type="text/html"/>
        <id>https://basetta.bz/blog/tmux-sessionizer/</id>
        
            <content type="html">&lt;p&gt;A small tmux sessionizer can make moving between projects almost effortless: choose a directory with &lt;code&gt;fzf&lt;/code&gt;, then create or attach to a session for it.&lt;/p&gt;
&lt;p&gt;That was enough until Git worktrees entered the picture. A project was no longer just one directory. It could have a main checkout, several feature branches in separate worktrees, and existing tmux sessions running agents or development servers.&lt;/p&gt;
&lt;p&gt;The question changed from “Which folder do I want?” to &lt;strong&gt;“Which workspace do I want to return to?”&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Here is how I evolved a simple folder picker into a workspace switcher—without turning it into another project-management tool.&lt;/p&gt;
&lt;h2 id=&quot;what-the-picker-does&quot;&gt;What the picker does&lt;/h2&gt;
&lt;p&gt;The finished workflow starts with &lt;strong&gt;prefix, then &lt;code&gt;f&lt;/code&gt;&lt;/strong&gt;. My prefix is &lt;code&gt;Ctrl+A&lt;/code&gt;; substitute yours if it is different.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://basetta.bz/blog/tmux-sessionizer/workspace-picker.png&quot;&gt;&lt;img src=&quot;https://basetta.bz/blog/tmux-sessionizer/workspace-picker.png&quot; alt=&quot;The tmux workspace picker listing existing sessions and project folders, with shortcuts for filtering and opening a workspace.&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A popup lists two kinds of entries:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[session] feature-login    /home/me/projects/web-app__worktrees/feature-login&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[session] docs             /home/me/notes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[folder] web-app           /home/me/projects/web-app&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[folder] feature-login     /home/me/projects/web-app__worktrees/feature-login&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Session entries point to something already running. Folder entries are places where a session can be reused or created.&lt;/p&gt;
&lt;p&gt;Inside the picker:&lt;/p&gt;
&lt;table&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Key&lt;/th&gt;&lt;th&gt;Action&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;Type&lt;/td&gt;&lt;td&gt;Fuzzy-search the entries&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;Ctrl+S&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Show existing sessions only&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;Ctrl+A&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Show sessions and folders again&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;Enter&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Open the selected workspace&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;Esc&lt;/code&gt;&lt;/td&gt;&lt;td&gt;Cancel&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;The filters preserve the search query. The popup closes after a successful selection, leaving the chosen session visible.&lt;/p&gt;
&lt;h2 id=&quot;discover-workspaces-not-every-directory&quot;&gt;Discover workspaces, not every directory&lt;/h2&gt;
&lt;p&gt;Recursively searching an entire home directory is rarely a useful project picker. It quickly fills with dependency folders, build output, and repositories’ internal directories.&lt;/p&gt;
&lt;p&gt;Instead, the script starts with a few explicit search roots:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span class=&quot; z-i&quot;&gt;HOME&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;/projects&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span class=&quot; z-i&quot;&gt;HOME&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;/work/repos&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;$&lt;/span&gt;&lt;span class=&quot; z-i&quot;&gt;HOME&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;/notes&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It lists their immediate subdirectories and skips missing roots quietly. Two additions make that shallow search useful with worktrees:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Workmux containers.&lt;/strong&gt; By default, Workmux creates worktrees in a sibling directory named &lt;code&gt;&amp;lt;repo&amp;gt;__worktrees&lt;/code&gt;. The picker lists that container’s immediate children instead of treating the container as a project.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Git’s worktree registry.&lt;/strong&gt; For discovered directories, it asks Git for registered worktrees with &lt;code&gt;git worktree list --porcelain -z&lt;/code&gt;. This also finds worktrees stored outside the configured search roots.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Existing tmux sessions are listed independently of folder discovery, so they remain reachable even when their directories are somewhere else.&lt;/p&gt;
&lt;p&gt;This is deliberately not an exhaustive filesystem index. For example, a repository at &lt;code&gt;~/projects/team/web-app&lt;/code&gt; needs &lt;code&gt;~/projects/team&lt;/code&gt; added as a search root if it is not otherwise discoverable.&lt;/p&gt;
&lt;h2 id=&quot;a-session-name-is-a-label-not-an-identity&quot;&gt;A session name is a label, not an identity&lt;/h2&gt;
&lt;p&gt;The original script used a directory’s basename as the tmux session name. That is convenient until two repositories have the same name:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;~/projects/api&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;~/work/repos/api&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Looking up the session named &lt;code&gt;api&lt;/code&gt; cannot tell those directories apart.&lt;/p&gt;
&lt;p&gt;The revised script first resolves the selected directory to a physical, absolute path, then compares it with each session’s &lt;code&gt;session_path&lt;/code&gt;. It only creates a session if no match exists.&lt;/p&gt;
&lt;p&gt;New sessions still get readable names. If the basename is already taken, the script adds a checksum-derived suffix, with a numeric fallback for further collisions. The checksum helps generate a name; it is not the identity check.&lt;/p&gt;
&lt;p&gt;When choosing an existing session directly, the picker uses tmux’s session ID, such as &lt;code&gt;$3&lt;/code&gt;, rather than trying to reconstruct a target from its display name.&lt;/p&gt;
&lt;p&gt;There is one important boundary: &lt;code&gt;session_path&lt;/code&gt; is the session’s recorded starting directory, not the current directory of every pane inside it. If another tool starts sessions from a generic directory, choose their explicit &lt;code&gt;[session]&lt;/code&gt; entries rather than expecting directory-based matching to identify them.&lt;/p&gt;
&lt;h2 id=&quot;keep-display-text-separate-from-selection-data&quot;&gt;Keep display text separate from selection data&lt;/h2&gt;
&lt;p&gt;Each picker row contains four tab-separated fields:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;kind    target    display-label    display-path&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For a session, the target is its tmux ID. For a directory, it is the full path.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;fzf --with-nth=3..&lt;/code&gt; shows only the friendly label and path, while the original row remains available when an entry is selected. This avoids parsing a path back out of a decorated label.&lt;/p&gt;
&lt;p&gt;The session-only shortcut changes the input rather than inserting a magic search term. &lt;code&gt;Ctrl+S&lt;/code&gt; reloads the script in a data-only mode; &lt;code&gt;Ctrl+A&lt;/code&gt; reloads all entries. Neither data-only mode creates or attaches to a session.&lt;/p&gt;
&lt;h2 id=&quot;the-complete-script&quot;&gt;The complete script&lt;/h2&gt;
&lt;p&gt;Save this as &lt;code&gt;~/.config/scripts/tmux-sessionizer&lt;/code&gt; and adjust the search roots to match your own directory layout.&lt;/p&gt;
&lt;p&gt;This implementation uses Bash, Git, tmux, &lt;code&gt;fzf&lt;/code&gt;, and standard utilities including &lt;code&gt;find&lt;/code&gt;, &lt;code&gt;sort&lt;/code&gt;, &lt;code&gt;cksum&lt;/code&gt;, and &lt;code&gt;awk&lt;/code&gt;. The popup binding below was tested with &lt;strong&gt;tmux 3.8 and fzf 0.74.4 on macOS&lt;/strong&gt;; check compatibility before using it with older versions.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-16 z-i&quot;&gt;#!/usr/bin/env bash&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;# Project/worktree picker. Also accepts a directory directly.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-11 z-i&quot;&gt;set&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -euo pipefail&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;client&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; [[&lt;/span&gt;&lt;span class=&quot;z-12 z-i&quot;&gt; ${1&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:-&lt;/span&gt;&lt;span class=&quot;z-12 z-i&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ==&lt;/span&gt;&lt;span&gt; --client &lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]];&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    client&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-12 z-i&quot;&gt;${2&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:?&lt;/span&gt;&lt;span&gt;Missing tmux client&lt;/span&gt;&lt;span class=&quot;z-12 z-i&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-11 z-i&quot;&gt;    shift&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; ((&lt;/span&gt;&lt;span&gt; $#&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; &amp;gt;&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; ));&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-11 z-i&quot;&gt;    printf&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;Usage: %s [--client CLIENT] [DIRECTORY]\n&amp;#39; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-12 z-i&quot;&gt;$0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; &amp;gt;&amp;amp;2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-11 z-i&quot;&gt;    exit&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;canonical_path&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;() {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;    (&lt;/span&gt;&lt;span class=&quot;z-11 z-i&quot;&gt;cd&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -- &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-12 z-i&quot;&gt;$1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; 2&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/dev/null&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;z-11 z-i&quot;&gt; pwd&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -P&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;session_rows&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;() {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    tmux&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; list-sessions -F $&amp;#39;#{session_id}&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt;\t&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;#{session_name}&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt;\t&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;#{session_path}&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; 2&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/dev/null&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ||&lt;/span&gt;&lt;span class=&quot;z-11 z-i&quot;&gt; true&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;find_session&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;() {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;    local&lt;/span&gt;&lt;span&gt; wanted&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-12 z-i&quot;&gt;$1&lt;/span&gt;&lt;span&gt; id name path resolved&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;    while&lt;/span&gt;&lt;span&gt; IFS&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;$&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt;\t&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-11 z-i&quot;&gt; read&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -r id name path&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; do&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        [[&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; -n&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$id&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; ]]&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ||&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; continue&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        resolved&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;canonical_path&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$path&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ||&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; continue&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        if&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; [[&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$resolved&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ==&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$wanted&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; ]];&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-11 z-i&quot;&gt;            printf&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;%s\n&amp;#39; &amp;quot;&lt;/span&gt;&lt;span&gt;$id&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            return&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;    done&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;lt;(&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;session_rows&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;project_directories&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;() {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;    local&lt;/span&gt;&lt;span&gt; root directory record&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;    for&lt;/span&gt;&lt;span&gt; root&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; in&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$HOME&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/projects&amp;quot; &amp;quot;&lt;/span&gt;&lt;span&gt;$HOME&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/work/repos&amp;quot; &amp;quot;&lt;/span&gt;&lt;span&gt;$HOME&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/notes&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; do&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        [[&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; -d&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$root&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; ]]&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ||&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; continue&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        while&lt;/span&gt;&lt;span&gt; IFS&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-11 z-i&quot;&gt; read&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -r -d &amp;#39;&amp;#39; directory&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; do&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            if&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; [[&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$directory&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; == *&lt;/span&gt;&lt;span&gt;__worktrees &lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]];&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;                find&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$directory&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot; -mindepth&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -maxdepth&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -type d -print0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;                continue&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-11 z-i&quot;&gt;            printf&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;%s\0&amp;#39; &amp;quot;&lt;/span&gt;&lt;span&gt;$directory&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            while&lt;/span&gt;&lt;span&gt; IFS&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-11 z-i&quot;&gt; read&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -r -d &amp;#39;&amp;#39; record&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; do&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;                if&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; [[&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$record&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ==&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;worktree &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;*&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; ]];&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-11 z-i&quot;&gt;                    printf&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;%s\0&amp;#39; &amp;quot;&lt;/span&gt;&lt;span&gt;${record&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;#&lt;/span&gt;&lt;span&gt;worktree }&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;                fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            done&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;lt;(&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;git&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -C &amp;quot;&lt;/span&gt;&lt;span&gt;$directory&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot; worktree list --porcelain -z&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; 2&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/dev/null&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ||&lt;/span&gt;&lt;span class=&quot;z-11 z-i&quot;&gt; true&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        done&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;lt;(&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$root&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot; -mindepth&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -maxdepth&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -type d -print0)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;    done&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;session_picker_rows&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;() {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;    local&lt;/span&gt;&lt;span&gt; id name path&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;    while&lt;/span&gt;&lt;span&gt; IFS&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;$&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt;\t&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-11 z-i&quot;&gt; read&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -r id name path&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; do&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        [[&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; -n&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$id&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; ]]&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ||&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; continue&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-11 z-i&quot;&gt;        printf&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;session\t%s\t[session] %s\t%s\n&amp;#39; &amp;quot;&lt;/span&gt;&lt;span&gt;$id&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span&gt;$name&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span&gt;$path&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;    done&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;lt;(&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;session_rows&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;picker_rows&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;() {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;    local&lt;/span&gt;&lt;span&gt; directory&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    session_picker_rows&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;    while&lt;/span&gt;&lt;span&gt; IFS&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-11 z-i&quot;&gt; read&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -r directory&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; do&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-11 z-i&quot;&gt;        printf&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;directory\t%s\t[folder] %s\t%s\n&amp;#39; &amp;quot;&lt;/span&gt;&lt;span&gt;$directory&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span&gt;${directory&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;##*/&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span&gt;$directory&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;    done&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;lt;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        while&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; IFS&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; read -r -d &amp;#39;&amp;#39; directory&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; do&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;            canonical_path&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$directory&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ||&lt;/span&gt;&lt;span class=&quot;z-11 z-i&quot;&gt; true&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        done&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; &amp;lt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;lt;(&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;project_directories&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; |&lt;/span&gt;&lt;span&gt; LC_ALL&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;C&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; sort&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -u&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;    )&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;# Data-only commands for fzf reloads.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;case&lt;/span&gt;&lt;span class=&quot;z-12 z-i&quot;&gt; ${1&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:-&lt;/span&gt;&lt;span class=&quot;z-12 z-i&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; in&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;    --list-sessions&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; session_picker_rows&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-11 z-i&quot;&gt; exit&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; ;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;    --list-all&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; picker_rows&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-11 z-i&quot;&gt; exit&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; ;;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;esac&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; ((&lt;/span&gt;&lt;span&gt; $#&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ==&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; ));&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    selected&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-12 z-i&quot;&gt;$1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;else&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    reload_command&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;z-11 z-i&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;%q&amp;#39; &amp;quot;&lt;/span&gt;&lt;span class=&quot;z-12 z-i&quot;&gt;$0&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    choice&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;picker_rows&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; fzf&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --delimiter=$&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt;\t&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;#39; --with-nth=3..&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        --layout=reverse --border --no-preview --prompt=&amp;#39;Workspace &amp;gt; &amp;#39;&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        --bind=&amp;quot;ctrl-s:reload(&lt;/span&gt;&lt;span&gt;$reload_command&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --list-sessions)+change-prompt(Sessions &amp;gt; )&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        --bind=&amp;quot;ctrl-a:reload(&lt;/span&gt;&lt;span&gt;$reload_command&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; --list-all)+change-prompt(Workspace &amp;gt; )&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt; \&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-7&quot;&gt;        --header=&amp;#39;Ctrl+S: sessions only · Ctrl+A: all · Enter: open · Esc: cancel&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ||&lt;/span&gt;&lt;span class=&quot;z-11 z-i&quot;&gt; exit&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;    [[&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; -n&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$choice&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; ]]&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ||&lt;/span&gt;&lt;span class=&quot;z-11 z-i&quot;&gt; exit&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    IFS&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;$&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-16&quot;&gt;\t&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-11 z-i&quot;&gt; read&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -r kind selected label path&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; &amp;lt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$choice&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;#39;&amp;#39;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;    if&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; [[&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$kind&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ==&lt;/span&gt;&lt;span&gt; session &lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]];&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span&gt;$selected&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;    fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; [[&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; -z&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$target&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; ]];&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    selected&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;canonical_path&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$selected&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ||&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-11 z-i&quot;&gt;        printf&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;Directory does not exist.\n&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; &amp;gt;&amp;amp;2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-11 z-i&quot;&gt;        exit&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;    }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;    target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;find_session&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$selected&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;    if&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; [[&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; -z&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$target&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; ]];&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        base&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;basename&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -- &amp;quot;&lt;/span&gt;&lt;span&gt;$selected&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; tr&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;.:&amp;#39; &amp;#39;__&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;        [[&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; -n&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$base&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; &amp;amp;&amp;amp;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$base&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; !=&lt;/span&gt;&lt;span&gt; / &lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]]&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; ||&lt;/span&gt;&lt;span&gt; base&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;workspace&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span&gt;$base&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        suffix&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;z-11 z-i&quot;&gt;printf&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;%s&amp;#39; &amp;quot;&lt;/span&gt;&lt;span&gt;$selected&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; cksum&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; |&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; awk&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;#39;{print $1}&amp;#39;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        n&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        while&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt; tmux&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; has-session -t &amp;quot;=&lt;/span&gt;&lt;span&gt;$name&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; 2&amp;gt;&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/dev/null&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; do&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;${base}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;-&lt;/span&gt;&lt;span&gt;${suffix}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;            if&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; ((&lt;/span&gt;&lt;span&gt; n&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; &amp;gt;&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 0&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; ));&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; then&lt;/span&gt;&lt;span&gt; name&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;${name}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;-&lt;/span&gt;&lt;span&gt;${n}&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;;&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            n&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;$((&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;n&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; +&lt;/span&gt;&lt;span class=&quot;z-14&quot;&gt; 1&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;        done&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        target&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;$(&lt;/span&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;tmux&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; new-session -d -P -F &amp;#39;#{session_id}&amp;#39; -s &amp;quot;&lt;/span&gt;&lt;span&gt;$name&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot; -c &amp;quot;&lt;/span&gt;&lt;span&gt;$selected&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;    fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;if&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; [[&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; -n&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; &amp;quot;&lt;/span&gt;&lt;span&gt;$client&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; ]];&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    tmux&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; switch-client -c &amp;quot;&lt;/span&gt;&lt;span&gt;$client&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot; -t &amp;quot;&lt;/span&gt;&lt;span&gt;$target&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;elif&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; [[&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; -n&lt;/span&gt;&lt;span&gt; ${TMUX&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:-&lt;/span&gt;&lt;span&gt;}&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt; ]];&lt;/span&gt;&lt;span class=&quot;z-9&quot;&gt; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    tmux&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; switch-client -t &amp;quot;&lt;/span&gt;&lt;span&gt;$target&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;else&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;    tmux&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; attach-session -t &amp;quot;&lt;/span&gt;&lt;span&gt;$target&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-9&quot;&gt;fi&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Make it executable:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;chmod&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; +x ~/.config/scripts/tmux-sessionizer&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It can also be invoked directly, inside or outside tmux:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-1&quot;&gt;~&lt;/span&gt;&lt;span&gt;/.config/scripts/tmux-sessionizer &lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span&gt;$HOME&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;/projects/web-app&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Outside tmux it attaches to the selected session; inside tmux it switches the client.&lt;/p&gt;
&lt;h2 id=&quot;the-popup-bug-that-the-first-tests-missed&quot;&gt;The popup bug that the first tests missed&lt;/h2&gt;
&lt;p&gt;The first popup binding launched the script with a client format embedded directly in its command:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# This did not work in the tested tmux version.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bind-key f display-popup -E &amp;#39;~/.config/scripts/tmux-sessionizer --client #{q:client_name}&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The popup immediately disappeared.&lt;/p&gt;
&lt;p&gt;The script’s selection logic had passed tests, but those tests had not exercised this launch path. In the tested tmux version, the popup command did not expand that format. Passed to the shell unquoted, the literal &lt;code&gt;#&lt;/code&gt; began a comment, leaving &lt;code&gt;--client&lt;/code&gt; without its required argument.&lt;/p&gt;
&lt;p&gt;The fix was to expand the format in &lt;code&gt;run-shell&lt;/code&gt; first, then pass the resolved client explicitly to both the popup and the script:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# ~/.config/tmux/tmux.conf&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;# Keep this binding on one line.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;bind-key f run-shell -b &amp;#39;tmux display-popup -c #{q:client_name} -w 85% -h 70% -s &amp;quot;bg=#2e3440,fg=#d8dee9&amp;quot; -S &amp;quot;bg=#2e3440,fg=#89c0d0&amp;quot; -EE &amp;quot;$HOME/.config/scripts/tmux-sessionizer&amp;quot; --client #{q:client_name}&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There are a few deliberate choices here:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;An explicit client:&lt;/strong&gt; selection switches the client that opened the picker, rather than relying on an implicit target.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Separate command arguments:&lt;/strong&gt; tmux receives the executable and its arguments separately, avoiding another layer of shell-command quoting.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Percentage dimensions:&lt;/strong&gt; the popup scales with the terminal.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Explicit colors:&lt;/strong&gt; the popup does not inherit an unexpectedly pale background.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;-EE&lt;/code&gt;:&lt;/strong&gt; the popup closes on success but remains visible if its command exits unsuccessfully.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Reload the configuration:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;tmux&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; source-file ~/.config/tmux/tmux.conf&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;No server restart is necessary.&lt;/p&gt;
&lt;p&gt;One diagnostic limitation remains: the script currently treats an unsuccessful picker pipeline as cancellation. That means &lt;code&gt;-EE&lt;/code&gt; cannot expose every &lt;code&gt;fzf&lt;/code&gt; failure. For a more hardened version, distinguish expected cancellation from unexpected picker errors instead of mapping all of them to a successful exit.&lt;/p&gt;
&lt;h2 id=&quot;where-workmux-fits&quot;&gt;Where Workmux fits&lt;/h2&gt;
&lt;p&gt;Workmux and the sessionizer have different jobs:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Workmux creates and manages worktrees&lt;/strong&gt;, including their configured agent and pane layouts.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The sessionizer navigates directories and existing tmux sessions.&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For a session-per-worktree workflow, Workmux supports this global setting:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4 z-i&quot;&gt;# ~/.config/workmux/config.yaml&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;mode&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; session&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;With a shell alias such as &lt;code&gt;wm=workmux&lt;/code&gt;, &lt;code&gt;wm add feature-login&lt;/code&gt; can create a worktree and its session. The sessionizer can then find that session alongside unrelated projects.&lt;/p&gt;
&lt;p&gt;Selecting a &lt;code&gt;[folder]&lt;/code&gt; entry does &lt;strong&gt;not&lt;/strong&gt; invoke &lt;code&gt;workmux add&lt;/code&gt; or start a configured agent layout. If there is no matching session, it creates a plain tmux session in that directory. That separation is intentional: the picker should not quietly perform worktree lifecycle operations.&lt;/p&gt;
&lt;p&gt;Likewise, deleting worktrees or cleaning up branches after a pull request merge remains a Workmux or Git operation—not something this picker does.&lt;/p&gt;
&lt;h2 id=&quot;test-the-interaction-not-just-the-script&quot;&gt;Test the interaction, not just the script&lt;/h2&gt;
&lt;p&gt;A syntax check is useful:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;bash&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; -n ~/.config/scripts/tmux-sessionizer&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But the immediately closing popup demonstrated why it is not enough.&lt;/p&gt;
&lt;p&gt;The checks for this workflow covered:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Directory names containing spaces.&lt;/li&gt;
&lt;li&gt;Two directories with the same basename.&lt;/li&gt;
&lt;li&gt;Reusing an existing session instead of creating another.&lt;/li&gt;
&lt;li&gt;Missing search roots.&lt;/li&gt;
&lt;li&gt;Default Workmux containers and externally located registered worktrees.&lt;/li&gt;
&lt;li&gt;Cancelling without creating a session.&lt;/li&gt;
&lt;li&gt;Opening the actual popup with real &lt;code&gt;fzf&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Switching between sessions-only and all entries.&lt;/li&gt;
&lt;li&gt;Selecting a session and switching the originating client.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The interactive checks ran in a separate tmux server under a pseudo-terminal. That exercised the real keybinding and popup without touching the working sessions.&lt;/p&gt;
&lt;p&gt;There are still sensible limits for a personal script: the picker’s tab-separated, line-oriented records assume names do not contain tabs or newlines; directory-based reuse is based on &lt;code&gt;session_path&lt;/code&gt;; and discovery intentionally stays shallow. Making those boundaries explicit is better than claiming it finds every possible workspace.&lt;/p&gt;
&lt;h2 id=&quot;keep-the-switcher-small&quot;&gt;Keep the switcher small&lt;/h2&gt;
&lt;p&gt;The useful improvements were not elaborate previews or more status information. They were about making navigation predictable:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Existing sessions are first-class choices.&lt;/li&gt;
&lt;li&gt;Worktrees are discoverable without scanning the entire filesystem.&lt;/li&gt;
&lt;li&gt;A full directory path matters more than a convenient basename.&lt;/li&gt;
&lt;li&gt;Sessions-only mode is one keystroke away.&lt;/li&gt;
&lt;li&gt;Cancelling does not leave a temporary window behind.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The result is still a small Bash script, but it now answers the question that matters during a working day: &lt;strong&gt;where do I want to continue?&lt;/strong&gt;&lt;/p&gt;
</content>
        <summary type="html">Evolving a Bash and fzf folder picker into a tmux workspace switcher that discovers Git worktrees and reuses existing sessions.</summary>
        </entry><entry xml:lang="en">
        <title>Back to Blogging: Keeping Basetta Up-to-Date</title>
        <published>2025-09-12T00:00:00+00:00</published>
        <updated>2025-09-12T00:00:00+00:00</updated>
        <author>
            <name>Patrick Martini</name>
        </author>
        <link rel="alternate" href="https://basetta.bz/blog/back-to-blogging-keeping-basetta-up-to-date/" type="text/html"/>
        <id>https://basetta.bz/blog/back-to-blogging-keeping-basetta-up-to-date/</id>
        
            <content type="html">&lt;p&gt;&lt;img src=&quot;https://basetta.bz/blog/back-to-blogging-keeping-basetta-up-to-date/retro_nvim_c_coding.png&quot; alt=&quot;Retro nvim coding session with C code and coffee.&quot; /&gt;&lt;/p&gt;
&lt;h1 id=&quot;back-to-blogging-keeping-basetta-up-to-date&quot;&gt;Back to Blogging: Keeping Basetta Up-to-Date&lt;/h1&gt;
&lt;p&gt;It feels almost surreal logging into my own blog after such a long pause.
More than five years have passed since I last hit “publish,” and so much has changed—both in technology and in my life.
I genuinely missed working through problems, untangling ideas,
and sharing discoveries from my technical journey.&lt;/p&gt;
&lt;p&gt;Looking at some of my old posts on Git tricks and file recovery, I’m reminded that this blog wasn’t just a place to share useful info—it was a way for me to mark my own progress and experiments. There were nights when troubleshooting and tinkering with code sparked late blog entries, and times when finding a new solution felt worth documenting.&lt;/p&gt;
&lt;p&gt;The truth is, my break wasn’t planned. Life got busy and priorities shifted, but throughout it all this site lingered in my mind as a creative anchor. Now, as AI becomes more embedded in every tool and workflow, I feel drawn to my roots—a world where writing, coding, and problem-solving happen in a more hands-on, personal way.&lt;/p&gt;
&lt;p&gt;To that end, I’ve started working on something new (and a little old-school): building my own text editor in C, writing entirely in nvim and following the legendary “Build Your Own Text Editor” tutorial. The guide takes you step by step through creating a powerful editor based on antirez’s kilo, letting you experience every feature from the ground up. In a time when AI promises shortcuts and automated suggestions, there’s something deeply satisfying about crafting and understanding every line on your own.&lt;/p&gt;
&lt;p&gt;From now on, I’m committed to keeping Basetta’s site current, sharing technical deep-dives, experiments, and reflections on what it means to build tools yourself—even in the age of AI. For those interested in hands-on development, practical guides, and the personal side of programming, I hope this fresh start brings both insights and a sense of creative independence.&lt;/p&gt;
</content>
        <summary type="html">Returning to technical blogging in a world of AI by building my own text editor in C, old-school style.</summary>
        </entry><entry xml:lang="en">
        <title>How to recover a deleted file in Git</title>
        <published>2020-03-27T00:00:00+00:00</published>
        <updated>2020-03-27T00:00:00+00:00</updated>
        <author>
            <name>Patrick Martini</name>
        </author>
        <link rel="alternate" href="https://basetta.bz/blog/how-to-recover-a-deleted-a-file-in-git/" type="text/html"/>
        <id>https://basetta.bz/blog/how-to-recover-a-deleted-a-file-in-git/</id>
        
            <content type="html">&lt;span id=&quot;continue-reading&quot;&gt;&lt;/span&gt;
&lt;p&gt;At work happens multiple times that I got asked how to recover a file somebody else deleted from a git repository.&lt;/p&gt;
&lt;p&gt;Even if it is not complicated, I decided to jot down a quick tutorial for future reference.
The process takes 3 steps:
find all deleted files&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git log --diff-filter=D --summary | grep delete&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;find the file you are looking for&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git log -- &amp;lt;filename&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;find the last commit before the file was deleted&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git rev-list -n 1 HEAD -- &amp;lt;filename&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;restore the file&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;git checkout ~&amp;lt;commit&amp;gt; -- &amp;lt;filename&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Restore the file!
That is it. Your deleted file has been recovered.&lt;/p&gt;
</content>
        </entry><entry xml:lang="en">
        <title>Protect Your Private Data Using Gitconfig Include Directive</title>
        <published>2013-01-28T00:00:00+00:00</published>
        <updated>2013-01-28T00:00:00+00:00</updated>
        <author>
            <name>Patrick Martini</name>
        </author>
        <link rel="alternate" href="https://basetta.bz/blog/protect-your-private-data-using-gitconfig-include-directive/" type="text/html"/>
        <id>https://basetta.bz/blog/protect-your-private-data-using-gitconfig-include-directive/</id>
        
            <content type="html">&lt;span id=&quot;continue-reading&quot;&gt;&lt;/span&gt;
&lt;p&gt;I am using a &lt;a rel=&quot;external&quot; href=&quot;https://github.com/basetta/dotfiles&quot;&gt;dotfiles&lt;/a&gt; git repository in order to keep my machine preferences in sync.&lt;/p&gt;
&lt;p&gt;This is working pretty well, until you realise that are some config entries that are clashing with each other.&lt;/p&gt;
&lt;p&gt;One of those cases, is the common situation  of having two github accounts – one for work and one for private purposes. In this case we would like to share the common git configuration but not the committer’s author name and email address held in the .gitconfig.&lt;/p&gt;
&lt;p&gt;Recently, git added a new feature, the include directive for config files ( since 1.7.10 ) that can solve the problem.
With the include feature you can split your gitconfig across multiple files, so you can have the common git configuration in one file, and private information in another.&lt;/p&gt;
&lt;p&gt;Let’s have a look at an example :&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Add the include directive to your .gitconfig ( this is the file in your git dotfiles repository )&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[include]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;path = ~/.gitconfig_user&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;Add to ~/.gitconfig_user your private data&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;[user]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;name = Silvio Berlusconi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;email = silvio.berlusconi@bungabunga.it&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;Test if the config is working properly&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git config user.name&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;Silvio Berlusconi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git config user.email&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;silvio.berlusconi@bungabunga.it&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;</content>
        </entry><entry xml:lang="en">
        <title>Extract a Directory From a Git Branch/Repository Preserving The History</title>
        <published>2012-05-12T00:00:00+00:00</published>
        <updated>2012-05-12T00:00:00+00:00</updated>
        <author>
            <name>Patrick Martini</name>
        </author>
        <link rel="alternate" href="https://basetta.bz/blog/extract-a-directory-from-a-git-branch-slash-repository-preserving-the-history/" type="text/html"/>
        <id>https://basetta.bz/blog/extract-a-directory-from-a-git-branch-slash-repository-preserving-the-history/</id>
        
            <content type="html">&lt;span id=&quot;continue-reading&quot;&gt;&lt;/span&gt;
&lt;p&gt;At work we wanted to extract from a branch a subdirectory containing a specific feature that had to be used from everyone in the team.
Just for sake of example, let’s define the terms of our problem.
Our repository (MAIN) structure looks like:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;MAIN/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;        Library/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            libA/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            libB/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;            libC/&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Our goal is to extract the libA contained in the branch FTR-B in its own branch called FTR-A.&lt;/p&gt;
&lt;p&gt;If you are not interested in preserving the history the task is quite easy. &lt;strong&gt;Git checkout&lt;/strong&gt; is our friend in this case.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git checkout master&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git checkout -b FTR-A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git checkout FTR-B Library/libA&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git commit -a -m &amp;quot;Extract libA&amp;quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git push&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;More complicated is the case in which preserving the history is a matter of importance.
For God’s sake &lt;strong&gt;git&lt;/strong&gt; has a powerful command &lt;strong&gt;git filter-branch&lt;/strong&gt;.
The following are my notes and observations, for pleasing my poor memory.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Clone the local repository into a temporary repository DIRTY.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git clone ~/MAIN/ ~/DIRTY/&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cd DIRTY&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git checkout FTR-B&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;Remove everything except the desired subdirectory ( libA ).&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git filter-branch --prune-empty --tree-filter &amp;#39;rm -rf Library/libB Library/libC&amp;#39;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Basically, &lt;strong&gt;Git filter-branch&lt;/strong&gt; executes a command on each commit in a specific branch. Instead of the option &lt;strong&gt;tree-filter&lt;/strong&gt; you could have used &lt;strong&gt;subdirectory-filter&lt;/strong&gt; that removes everything except the desired directory moving it up to the root project. I will explain it better in another post.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Clean all the cruft&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git gc --aggressive&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;Merge the new feature in its own branch FTR-A.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ cd ~/MAIN&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git remote add dirty ~/DIRTY&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git fetch dirty&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git branch dirty remotes/tools/FTR-B&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git checkout master&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git checkout -b FTR-A&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git merge dirty&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;$ git remote rm dirty&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;Create a pull request&lt;/li&gt;
&lt;/ul&gt;
</content>
        </entry><entry xml:lang="en">
        <title>How to fetch upstream changes in git easily</title>
        <published>2012-04-18T00:00:00+00:00</published>
        <updated>2012-04-18T00:00:00+00:00</updated>
        <author>
            <name>Patrick Martini</name>
        </author>
        <link rel="alternate" href="https://basetta.bz/blog/how-to-fetch-upstream-changes-in-git-easily/" type="text/html"/>
        <id>https://basetta.bz/blog/how-to-fetch-upstream-changes-in-git-easily/</id>
        
            <content type="html">&lt;p&gt;It is quite common to update your git fork repository with the upstream changes.&lt;/p&gt;
&lt;p&gt;Here it is the workflow I use to keep synchronize my branch with &lt;a rel=&quot;external&quot; href=&quot;http://www.google.com&quot;&gt;Octopress&lt;/a&gt;.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;First of all, we should configure the remotes.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; git remote add upstream git://github.com/imathis/octopress.git&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Check the remotes&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; git remote&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Merge/Rebase the changes&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; git fetch origin -v&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; git fetch upstream -v&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; git merge upstream/master&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you prefere you can create an alias in your &lt;em&gt;.gitconfig&lt;/em&gt;.&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;ini&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-4&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;z-10&quot;&gt;alias&lt;/span&gt;&lt;span class=&quot;z-4&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3&quot;&gt;  pull_upstream&lt;/span&gt;&lt;span class=&quot;z-1&quot;&gt; =&lt;/span&gt;&lt;span&gt; !&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt;&amp;quot;git fetch origin -v; git fetch upstream -v; git merge upstream/master&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now &lt;em&gt;git pull_upstream&lt;/em&gt; will fetch the changes of both remotes, and the merge in the upstream changes.&lt;/p&gt;
</content>
        </entry><entry xml:lang="en">
        <title>Back Online</title>
        <published>2012-02-04T00:00:00+00:00</published>
        <updated>2012-02-04T00:00:00+00:00</updated>
        <author>
            <name>Patrick Martini</name>
        </author>
        <link rel="alternate" href="https://basetta.bz/blog/back-online/" type="text/html"/>
        <id>https://basetta.bz/blog/back-online/</id>
        
            <content type="html">&lt;p&gt;It has been nearly four years since I last posted. Quite a lot.
Anyhow, now I am back online thanks to &lt;a rel=&quot;external&quot; href=&quot;http://octopress.org/&quot;&gt;Octopress&lt;/a&gt; and Github pages.&lt;/p&gt;
&lt;p&gt;I’ll have more to do:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;write a catch up post&lt;/li&gt;
&lt;li&gt;importing the old posts parked &lt;a rel=&quot;external&quot; href=&quot;http://ricettebimby.pupazzo.org&quot;&gt;here&lt;/a&gt; after my previous Django blog
abandoned me.&lt;/li&gt;
&lt;li&gt;personalized the Octopress default template.&lt;/li&gt;
&lt;/ul&gt;
</content>
        </entry><entry xml:lang="en">
        <title> Future of Web design</title>
        <published>2007-04-26T00:00:00+00:00</published>
        <updated>2007-04-26T00:00:00+00:00</updated>
        <author>
            <name>Patrick Martini</name>
        </author>
        <link rel="alternate" href="https://basetta.bz/blog/futurewebdesign/" type="text/html"/>
        <id>https://basetta.bz/blog/futurewebdesign/</id>
        
            <content type="html">&lt;p&gt;In London on 18th April took place the &lt;a rel=&quot;external&quot; href=&quot;http://futureofwebdesign.com/&quot;&gt;Future of Web Design Conference&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;On the website you can find all the presentations(slides and mp3 files).
Any I have found really interesting.&lt;/p&gt;
</content>
        </entry><entry xml:lang="en">
        <title> Performance Tip For Edgy/Feisty Users</title>
        <published>2007-03-21T00:00:00+00:00</published>
        <updated>2007-03-21T00:00:00+00:00</updated>
        <author>
            <name>Patrick Martini</name>
        </author>
        <link rel="alternate" href="https://basetta.bz/blog/performanceedgy/" type="text/html"/>
        <id>https://basetta.bz/blog/performanceedgy/</id>
        
            <content type="html">&lt;p&gt;Now and again I’ve been experiencing poor performance in GNOME.
Looking for a solutionI have found this tip &lt;a rel=&quot;external&quot; href=&quot;http://ubuntuforums.org/showthread.php?t=388765&quot;&gt; here &lt;/a&gt;.
It really works at leat for me.&lt;/p&gt;
&lt;p&gt;Edit your /etc/hosts file:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;shellscript&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span class=&quot;z-3 z-i&quot;&gt;$&lt;/span&gt;&lt;span class=&quot;z-7&quot;&gt; sudo gedit /etc/hosts&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;You should see something like that:&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;127.0.0.1 localhost&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;127.0.1.1 basetta-laptop&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now write on the first line your hostname (my hostname is basetta-laptop).&lt;/p&gt;
&lt;pre class=&quot;giallo z-code&quot; &gt;&lt;code data-lang=&quot;plain&quot;&gt;&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;127.0.0.1 localhost basetta-laptop&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;giallo-l&quot;&gt;&lt;span&gt;127.0.1.1 basetta-laptop&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now Save.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Explanation why&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;/blockquote&gt;
&lt;p&gt;This is a fix for the new system that was started back in edgy where the host name was split off to 127.0.1.1, the problem is that some applications still look for the host name @ 127.0.0.1, so to keep those applications happy and running smoothly you simple need to add the host name where those applications expect it to be.&lt;/p&gt;
</content>
        </entry><entry xml:lang="en">
        <title>Django is running</title>
        <published>2006-07-17T00:00:00+00:00</published>
        <updated>2006-07-17T00:00:00+00:00</updated>
        <author>
            <name>Patrick Martini</name>
        </author>
        <link rel="alternate" href="https://basetta.bz/blog/django-is-running/" type="text/html"/>
        <id>https://basetta.bz/blog/django-is-running/</id>
        
            <content type="html">&lt;span id=&quot;continue-reading&quot;&gt;&lt;/span&gt;
&lt;p&gt;Finally, my new &lt;a rel=&quot;external&quot; href=&quot;http://www.djangoproject.com&quot;&gt;Django&lt;/a&gt; website is running.
First of all, I have to thank a lot of people from whom I took some
pieces of code.
So, thanks to &lt;a rel=&quot;external&quot; href=&quot;http://socialistsoftware.com/&quot;&gt;http://socialistsoftware.com/&lt;/a&gt; ,&lt;a rel=&quot;external&quot; href=&quot;http://www.wamber.net/&quot;&gt;http://www.wamber.net/&lt;/a&gt; and
for the design to &lt;a rel=&quot;external&quot; href=&quot;http://aaron.ganschow.us/&quot;&gt; Aaron &lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I haven’t corrected all the errors but you know I’m lazy ….one of the
most lazy ones.&lt;/p&gt;
&lt;p&gt;Right now I’m working on a small application in order to keep a record of my books.&lt;/p&gt;
</content>
        </entry>
</feed>
