<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>docs/recipes/passing-data.md - fork/wezterm @ termwiz-0.23.2</title>
<meta name="description" content="docs/recipes/passing-data.md in fork/wezterm at termwiz-0.23.2.">
<meta property="og:title" content="docs/recipes/passing-data.md - fork/wezterm @ termwiz-0.23.2">
<meta property="og:description" content="docs/recipes/passing-data.md in fork/wezterm at termwiz-0.23.2.">
<meta property="og:type" content="website">
<meta property="og:site_name" content="git.julia.blue">
<link rel="stylesheet" href="/css/style.css?v=62">
<script type="module" src="/js/main.js?v=62"></script>
</head>
<body>
<main data-ref="termwiz-0.23.2" data-tip="8b7ca454b5e0a65b69b1b736db54eae3c195384b">
<noscript>
  <div class="callout">
    <p>
      hey! this is a static git repo viewer. commit diffs, file history,
      older commits and other revisions won't load without javascript.
    </p>
    <p>
      you are still able to view source files on branch/tag tips,
      but the experience is degraded.
    </p>
  </div>
</noscript>
<header class="repo"><div>
<h1>fork/wezterm</h1>
</div>
<pre class="clone">git clone https://git.julia.blue/fork/wezterm</pre>
</header>
<p class="snapshot-commit"><span class="commit-author">Wez Furlong</span><span class="commit-message" data-commit="e725d68f08653b5f9970cd934dd089924add855b">docs: shell-integration: cover the new built-in user-vars</span><span class="snapshot-sha sha" data-commit="e725d68f08653b5f9970cd934dd089924add855b">e725d68f0</span><time datetime="2023-01-23T10:50:49-07:00" title="2023-01-23 10:50:49 -0700">2023-01-23</time></p>
<header class="topbar"><details class="switcher"><summary>termwiz-0.23.2</summary><div class="menu"><strong>branches</strong><a href="/fork/wezterm/ref/main/">main</a><strong>tags</strong><a href="/fork/wezterm/ref/termiz-0.23.1/">termiz-0.23.1</a><a href="/fork/wezterm/ref/termiz-0.23.2/">termiz-0.23.2</a><a href="/fork/wezterm/ref/termiz-0.23.3/">termiz-0.23.3</a><a href="/fork/wezterm/ref/termwiz-0.23.0/">termwiz-0.23.0</a><a href="/fork/wezterm/ref/termwiz-0.23.1/">termwiz-0.23.1</a><a class="current" href="/fork/wezterm/ref/termwiz-0.23.2/">termwiz-0.23.2</a><a href="/fork/wezterm/ref/termwiz-0.23.3/">termwiz-0.23.3</a><a href="/fork/wezterm/ref/vtparse-0.7.0/">vtparse-0.7.0</a><a class="all" href="/fork/wezterm/refs">all refs →</a></div></details><nav class="crumbs"><a href="/fork/wezterm/">wezterm</a> / <a href="/fork/wezterm/ref/termwiz-0.23.2/tree/docs/">docs</a> / <a href="/fork/wezterm/ref/termwiz-0.23.2/tree/docs/recipes/">recipes</a> / <span class="cur">passing-data.md</span></nav>
<span class="view-stats"><span>7.2 KiB</span><span>176 lines</span></span><span class="actions"><a class="raw" href="/fork/wezterm/raw/1ddc5b851c4d4e97bfdf753af7080dedcd0282c1/docs/recipes/passing-data.md">raw</a></span></header>
<div class="markdown-view"><input type="radio" name="markdown-view" id="markdown-rendered" checked><label for="markdown-rendered">rendered</label><input type="radio" name="markdown-view" id="markdown-code"><label for="markdown-code">code</label><section class="readme rendered"><h1>Passing Data from a pane to Lua</h1>
<p>After spawning a program into a pane, a terminal emulator has no guaranteed
reliable way to reason about what might be happening inside the pane; the only
official system-provided means of interaction is through a limited PTY
interface that basically provides only input and output streams and a way to
communicate the screen size to the pane.</p>
<p>While wezterm provides a few functions that can help to peek into locally
running processes, those cannot be used with remote processes when you're
ssh'ing to a remote host, for example.</p>
<p>Here are a few options you might consider using, depending on your needs.</p>
<p>We'll start with a very general but powerful mechanism:</p>
<h2>User Vars</h2>
<p>You can use an escape sequence to set a key/value pair in a terminal pane.
These <em>user vars</em> are similar in some ways to environment variables but are
scoped to the terminal pane and cannot be read by applications running in the
pane, only written.</p>
<p>Here's an example of setting the <code>foo</code> user variable to the value <code>bar</code>:</p>
<pre class="language-bash"><a-f>printf</a-f> <a-s>&quot;\033]1337;SetUserVar=%s=%s\007&quot;</a-s> foo <a-eb>`</a-eb><a-f>echo</a-f><a-eb> </a-eb><a-co>-n</a-co><a-eb> bar </a-eb><a-o>|</a-o><a-eb> </a-eb><a-f>base64</a-f><a-eb>`</a-eb></pre>
<p>Note that the value must be base64 encoded.</p>
<p>Setting a user var will generate events in the window that contains
the corresponding pane:</p>
<ul>
<li><a href="/fork/wezterm/ref/termwiz-0.23.2/blob/docs/config/lua/window-events/user-var-changed.md">user-var-changed</a>, which
allows you to directly take action when a var is set/changed.</li>
<li><a href="/fork/wezterm/ref/termwiz-0.23.2/blob/docs/config/lua/window-events/update-status.md">update-status</a> which allows you to update left/right status items</li>
<li>the title and tab bar area will then update and trigger any associated events as part of that update</li>
</ul>
<p>The user var change event will propagate to all connected multiplexer clients.</p>
<p>You can access the complete set of user vars in a given pane by calling
<a href="/fork/wezterm/ref/termwiz-0.23.2/blob/docs/config/lua/pane/get_user_vars.md">pane:get_user_vars()</a>, or by accessing
the <code>user_vars</code> field in a <a href="/fork/wezterm/ref/termwiz-0.23.2/blob/docs/config/lua/PaneInformation.md">PaneInformation</a>
struct.</p>
<p>In this example, an alias is used to set a user var named PROG to something
when running various commands:</p>
<pre class="language-bash"><a-c># This function emits an OSC 1337 sequence to set a user var</a-c>
<a-c># associated with the current terminal pane.</a-c>
<a-c># It requires the `base64` utility to be available in the path.</a-c>
<a-c># This function is included in the wezterm shell integration script, but</a-c>
<a-c># is reproduced here for clarity</a-c>
<a-f>__wezterm_set_user_var</a-f>() {
  <a-k>if</a-k> <a-f>hash</a-f> base64 <a-n>2</a-n><a-o>&gt;</a-o>/dev/null ; <a-k>then</a-k>
    <a-k>if</a-k> [[ -z <a-s>&quot;</a-s><a-eb>${</a-eb><a-pr>TMUX</a-pr><a-eb>}</a-eb><a-s>&quot;</a-s> ]] ; <a-k>then</a-k>
      <a-f>printf</a-f> <a-s>&quot;\033]1337;SetUserVar=%s=%s\007&quot;</a-s> <a-s>&quot;</a-s><a-o>$</a-o><a-pr>1</a-pr><a-s>&quot;</a-s> <a-eb>`</a-eb><a-f>echo</a-f><a-eb> </a-eb><a-co>-n</a-co><a-eb> </a-eb><a-s>&quot;</a-s><a-o>$</a-o><a-pr>2</a-pr><a-s>&quot;</a-s><a-eb> </a-eb><a-o>|</a-o><a-eb> </a-eb><a-f>base64</a-f><a-eb>`</a-eb>
    <a-k>else</a-k>
      <a-c># &lt;https://github.com/tmux/tmux/wiki/FAQ#what-is-the-passthrough-escape-sequence-and-how-do-i-use-it&gt;</a-c>
      <a-c># Note that you ALSO need to add &quot;set -g allow-passthrough on&quot; to your tmux.conf</a-c>
      <a-f>printf</a-f> <a-s>&quot;\033Ptmux;\033\033]1337;SetUserVar=%s=%s\007\033\\&quot;</a-s> <a-s>&quot;</a-s><a-o>$</a-o><a-pr>1</a-pr><a-s>&quot;</a-s> <a-eb>`</a-eb><a-f>echo</a-f><a-eb> </a-eb><a-co>-n</a-co><a-eb> </a-eb><a-s>&quot;</a-s><a-o>$</a-o><a-pr>2</a-pr><a-s>&quot;</a-s><a-eb> </a-eb><a-o>|</a-o><a-eb> </a-eb><a-f>base64</a-f><a-eb>`</a-eb>
    <a-k>fi</a-k>
  <a-k>fi</a-k>
}

<a-k>function</a-k> <a-f>_run_prog</a-f>() {
    <a-c># set PROG to the program being run</a-c>
    <a-f>__wezterm_set_user_var</a-f> <a-s>&quot;PROG&quot;</a-s> <a-s>&quot;</a-s><a-o>$</a-o><a-pr>1</a-pr><a-s>&quot;</a-s>

    <a-c># arrange to clear it when it is done</a-c>
    <a-f>trap</a-f> <a-s>&#39;__wezterm_set_user_var PROG &quot;&quot;&#39;</a-s> EXIT

    <a-c># and now run the corresponding command, taking care to avoid looping</a-c>
    <a-c># with the alias definition</a-c>
    <a-f>command</a-f> <a-s>&quot;</a-s><a-o>$</a-o><a-s>@&quot;</a-s>
}

<a-f>alias</a-f> vim=<a-s>&quot;_run_prog vim&quot;</a-s>
<a-f>alias</a-f> tmux=<a-s>&quot;_run_prog tmux&quot;</a-s>
<a-f>alias</a-f> nvim=<a-s>&quot;_run_prog nvim&quot;</a-s></pre>
<p>Then on the wezterm side, this information can be used when formatting the tab titles:</p>
<pre class="language-lua"><a-k>local</a-k> <a-v>wezterm</a-v> = <a-f>require</a-f> <a-s>&#39;wezterm&#39;</a-s>

<a-v>wezterm</a-v><a-p>.</a-p><a-f>on</a-f><a-p>(</a-p><a-s>&#39;format-tab-title&#39;</a-s><a-p>,</a-p> <a-k>function</a-k><a-p>(</a-p><a-v>tab</a-v><a-p>)</a-p>
  <a-k>local</a-k> <a-v>prog</a-v> = <a-v>tab</a-v><a-p>.</a-p><a-v>active_pane</a-v><a-p>.</a-p><a-v>user_vars</a-v><a-p>.</a-p><a-v>PROG</a-v>
  <a-k>return</a-k> <a-v>tab</a-v><a-p>.</a-p><a-v>active_pane</a-v><a-p>.</a-p><a-v>title</a-v> <a-o>..</a-o> <a-s>&#39; [&#39;</a-s> <a-o>..</a-o> <a-p>(</a-p><a-v>prog</a-v> <a-k>or</a-k> <a-s>&#39;&#39;</a-s><a-p>)</a-p> <a-o>..</a-o> <a-s>&#39;]&#39;</a-s>
<a-k>end</a-k><a-p>)</a-p>

<a-k>return</a-k> <a-cr>{}</a-cr></pre>
<p>If you install the <a href="/fork/wezterm/ref/termwiz-0.23.2/blob/docs/shell-integration.md">wezterm shell integration</a> you
will get a more comprehensive set of user vars set for you automatically.</p>
<p>User vars enable you to very deliberately signal information from your pane to
your wezterm config, and will work across multiplexer connections and even
through tmux (provided that you use the <a href="https://github.com/tmux/tmux/wiki/FAQ#what-is-the-passthrough-escape-sequence-and-how-do-i-use-it">tmux passthrough escape
sequence</a>
to allow it to pass through).</p>
<p>The downside is that you need to take steps to ensure that your shell knows to
emit the appropriate user vars when you need them.</p>
<p>Depending on your needs, there are some alternative ways to reason about
specific information in a pane.</p>
<h2>OSC 0, 1, 2 for setting the Window/Pane Title</h2>
<p>wezterm, like many other terminals, will interpret Operating System Command
(OSC) escape sequences for codes 0, 1 and 2 as updating the title:</p>
<table><thead><tr><th>OSC</th><th>Description</th><th>Action</th><th>Example</th></tr></thead><tbody>
<tr><td>0</td><td>Set Icon Name and Window Title</td><td>Clears Icon Name, sets Window Title.</td><td><code>\x1b]0;title\x1b\\</code></td></tr>
<tr><td>1</td><td>Set Icon Name</td><td>Sets Icon Name, which is used as the Tab title when it is non-empty</td><td><code>\x1b]1;tab-title\x1b\\</code></td></tr>
<tr><td>2</td><td>Set Window Title</td><td>Set Window Title</td><td><code>\x1b]2;window-title\x1b\\</code></td></tr>
</tbody></table>
<p><a href="/fork/wezterm/ref/termwiz-0.23.2/blob/docs/config/lua/pane/get_title.md">pane:get_title()</a> and/or the
<a href="/fork/wezterm/ref/termwiz-0.23.2/blob/docs/config/lua/PaneInformation.md">PaneInformation</a> <code>title</code> field can be used
to retrieve the effective title that has been set for a pane.</p>
<p>It is common practice for shells in many distributions to arrange to set OSC 2
prior to executing a command. wezterm doesn't currently set this up
automatically. Note that wezterm will attempt to determine the foreground
process and substitute its title if the pane is a local pane and no title has
been set by an OSC escape sequence.</p>
<h2>OSC 7 for setting the current working directory</h2>
<p>Emitting OSC 7 will tell wezterm to use a specific URI for the current working
directory associated with a pane:</p>
<pre class="language-bash"><a-f>printf</a-f> <a-s>&quot;\033]7;file://HOSTNAME/CURRENT/DIR\033\\&quot;</a-s></pre>
<p>You may also use <code>wezterm set-working-directory</code> for this if you have <code>wezterm</code>
available.</p>
<p>The value you set via OSC 7 is available
<a href="/fork/wezterm/ref/termwiz-0.23.2/blob/docs/config/lua/pane/get_current_working_dir.md">pane:get_current_working_dir()</a>
and/or the <a href="/fork/wezterm/ref/termwiz-0.23.2/blob/docs/config/lua/PaneInformation.md">PaneInformation</a>
<code>current_working_dir</code> field can be used to retrieve the working directory that
has been set for a pane.  If OSC 7 has never been used in a pane, and that pane
is a local pane, wezterm can attempt to determine the working directory of the
foreground process that is associated with the pane.</p>
<p>Installing the <a href="/fork/wezterm/ref/termwiz-0.23.2/blob/docs/shell-integration.md">wezterm shell integration</a> will
arrange for bash/zsh to set OSC 7 for you.</p>
<h2>Local Process State</h2>
<p>wezterm provides some functions that can attempt to extract information about
processes that are running on the local machine; these will not work with
multiplexer connections of any kind (even unix multiplexers):</p>
<ul>
<li><a href="/fork/wezterm/ref/termwiz-0.23.2/blob/docs/config/lua/pane/get_foreground_process_info.md">pane:get_foreground_process_info()</a> -
returns information about the process hierarchy in a pane</li>
<li><a href="/fork/wezterm/ref/termwiz-0.23.2/blob/docs/config/lua/wezterm.procinfo/get_info_for_pid.md">wezterm.procinfo.get_info_for_pid()</a> -
returns information about the process hierarchy for a given process id</li>
</ul>
<p>There are a couple of other similar/related methods available to the
<a href="../config/lua/pane/index.md">Pane</a> object and in the
<a href="../config/lua/wezterm.procinfo/index.md">wezterm.procinfo</a> module.</p>
<p>Because these local process functions don't require changing your shell
configuration to get them working, they may be the most convenient to use in
your wezterm configuration, but they are limited to local processes only and
may not work as well to determine the correct foreground process when running
on Windows.</p>
</section><div class="code-panel"><pre class="code src language-markdown"><span class="code-line"><a class="ln" id="L1" href="#L1">1</a><span class="code-text"><a-p>#</a-p> <a-tt>Passing Data from a pane to Lua</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L2" href="#L2">2</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L3" href="#L3">3</a><span class="code-text">After spawning a program into a pane, a terminal emulator has no guaranteed</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L4" href="#L4">4</a><span class="code-text">reliable way to reason about what might be happening inside the pane; the only</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L5" href="#L5">5</a><span class="code-text">official system-provided means of interaction is through a limited PTY</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L6" href="#L6">6</a><span class="code-text">interface that basically provides only input and output streams and a way to</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L7" href="#L7">7</a><span class="code-text">communicate the screen size to the pane.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L8" href="#L8">8</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L9" href="#L9">9</a><span class="code-text">While wezterm provides a few functions that can help to peek into locally</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L10" href="#L10">10</a><span class="code-text">running processes, those cannot be used with remote processes when you&#39;re</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L11" href="#L11">11</a><span class="code-text">ssh&#39;ing to a remote host, for example.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L12" href="#L12">12</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L13" href="#L13">13</a><span class="code-text">Here are a few options you might consider using, depending on your needs.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L14" href="#L14">14</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L15" href="#L15">15</a><span class="code-text">We&#39;ll start with a very general but powerful mechanism:</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L16" href="#L16">16</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L17" href="#L17">17</a><span class="code-text"><a-p>##</a-p> <a-tt>User Vars</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L18" href="#L18">18</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L19" href="#L19">19</a><span class="code-text">You can use an escape sequence to set a key/value pair in a terminal pane.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L20" href="#L20">20</a><span class="code-text">These *user vars* are similar in some ways to environment variables but are</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L21" href="#L21">21</a><span class="code-text">scoped to the terminal pane and cannot be read by applications running in the</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L22" href="#L22">22</a><span class="code-text">pane, only written.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L23" href="#L23">23</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L24" href="#L24">24</a><span class="code-text">Here&#39;s an example of setting the `foo` user variable to the value `bar`:</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L25" href="#L25">25</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L26" href="#L26">26</a><span class="code-text"><a-p>```</a-p><a-tl>bash</a-tl></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L27" href="#L27">27</a><span class="code-text"><a-p>printf </a-p><a-s>&quot;\033]1337;SetUserVar=%s=%s\007&quot;</a-s><a-p> foo </a-p><a-eb>`</a-eb><a-f>echo</a-f><a-eb> </a-eb><a-co>-n</a-co><a-eb> bar </a-eb><a-o>|</a-o><a-eb> </a-eb><a-f>base64</a-f><a-eb>`</a-eb></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L28" href="#L28">28</a><span class="code-text"><a-p>```</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L29" href="#L29">29</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L30" href="#L30">30</a><span class="code-text"><a-p>Note that the value must be base64 encoded.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L31" href="#L31">31</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L32" href="#L32">32</a><span class="code-text"><a-p>Setting a user var will generate events in the window that contains</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L33" href="#L33">33</a><span class="code-text"><a-p>the corresponding pane:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L34" href="#L34">34</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L35" href="#L35">35</a><span class="code-text"><a-p>* [user-var-changed](../config/lua/window-events/user-var-changed.md), which</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L36" href="#L36">36</a><span class="code-text"><a-p>  allows you to directly take action when a var is set/changed.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L37" href="#L37">37</a><span class="code-text"><a-p>* [update-status](../config/lua/window-events/update-status.md) which allows you to update left/right status items</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L38" href="#L38">38</a><span class="code-text"><a-p>* the title and tab bar area will then update and trigger any associated events as part of that update</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L39" href="#L39">39</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L40" href="#L40">40</a><span class="code-text"><a-p>The user var change event will propagate to all connected multiplexer clients.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L41" href="#L41">41</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L42" href="#L42">42</a><span class="code-text"><a-p>You can access the complete set of user vars in a given pane by calling</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L43" href="#L43">43</a><span class="code-text"><a-p>[pane:get_user_vars()](../config/lua/pane/get_user_vars.md), or by accessing</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L44" href="#L44">44</a><span class="code-text"><a-p>the `user_vars` field in a [PaneInformation](../config/lua/PaneInformation.md)</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L45" href="#L45">45</a><span class="code-text"><a-p>struct.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L46" href="#L46">46</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L47" href="#L47">47</a><span class="code-text"><a-p>In this example, an alias is used to set a user var named PROG to something</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L48" href="#L48">48</a><span class="code-text"><a-p>when running various commands:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L49" href="#L49">49</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L50" href="#L50">50</a><span class="code-text"><a-p>```</a-p><a-tl>bash</a-tl></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L51" href="#L51">51</a><span class="code-text"><a-p># This function emits an OSC 1337 sequence to set a user var</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L52" href="#L52">52</a><span class="code-text"><a-p># associated with the current terminal pane.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L53" href="#L53">53</a><span class="code-text"><a-p># It requires the `base64` utility to be available in the path.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L54" href="#L54">54</a><span class="code-text"><a-p># This function is included in the wezterm shell integration script, but</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L55" href="#L55">55</a><span class="code-text"><a-p># is reproduced here for clarity</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L56" href="#L56">56</a><span class="code-text"><a-p>__wezterm_set_user_var() {</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L57" href="#L57">57</a><span class="code-text"><a-p>  </a-p><a-k>if</a-k><a-p> </a-p><a-f>hash</a-f><a-p> base64 </a-p><a-n>2</a-n><a-o>&gt;</a-o><a-p>/dev/null ; </a-p><a-k>then</a-k></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L58" href="#L58">58</a><span class="code-text"><a-p>    </a-p><a-k>if</a-k><a-p> [[ -z </a-p><a-s>&quot;</a-s><a-eb>${</a-eb><a-pr>TMUX</a-pr><a-eb>}</a-eb><a-s>&quot;</a-s><a-p> ]] ; </a-p><a-k>then</a-k></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L59" href="#L59">59</a><span class="code-text"><a-p>      </a-p><a-f>printf</a-f><a-p> </a-p><a-s>&quot;\033]1337;SetUserVar=%s=%s\007&quot;</a-s><a-p> </a-p><a-s>&quot;</a-s><a-o>$</a-o><a-pr>1</a-pr><a-s>&quot;</a-s><a-p> </a-p><a-eb>`</a-eb><a-f>echo</a-f><a-eb> </a-eb><a-co>-n</a-co><a-eb> </a-eb><a-s>&quot;</a-s><a-o>$</a-o><a-pr>2</a-pr><a-s>&quot;</a-s><a-eb> </a-eb><a-o>|</a-o><a-eb> </a-eb><a-f>base64</a-f><a-eb>`</a-eb></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L60" href="#L60">60</a><span class="code-text"><a-p>    </a-p><a-k>else</a-k></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L61" href="#L61">61</a><span class="code-text"><a-p>      </a-p><a-c># &lt;https://github.com/tmux/tmux/wiki/FAQ#what-is-the-passthrough-escape-sequence-and-how-do-i-use-it&gt;</a-c></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L62" href="#L62">62</a><span class="code-text"><a-p>      </a-p><a-c># Note that you ALSO need to add &quot;set -g allow-passthrough on&quot; to your tmux.conf</a-c></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L63" href="#L63">63</a><span class="code-text"><a-p>      </a-p><a-f>printf</a-f><a-p> </a-p><a-s>&quot;\033Ptmux;\033\033]1337;SetUserVar=%s=%s\007\033\\&quot;</a-s><a-p> </a-p><a-s>&quot;</a-s><a-o>$</a-o><a-pr>1</a-pr><a-s>&quot;</a-s><a-p> </a-p><a-eb>`</a-eb><a-f>echo</a-f><a-eb> </a-eb><a-co>-n</a-co><a-eb> </a-eb><a-s>&quot;</a-s><a-o>$</a-o><a-pr>2</a-pr><a-s>&quot;</a-s><a-eb> </a-eb><a-o>|</a-o><a-eb> </a-eb><a-f>base64</a-f><a-eb>`</a-eb></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L64" href="#L64">64</a><span class="code-text"><a-p>    </a-p><a-k>fi</a-k></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L65" href="#L65">65</a><span class="code-text"><a-p>  </a-p><a-k>fi</a-k></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L66" href="#L66">66</a><span class="code-text"><a-p>}</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L67" href="#L67">67</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L68" href="#L68">68</a><span class="code-text"><a-p>function </a-p><a-f>_run_prog</a-f><a-p>() {</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L69" href="#L69">69</a><span class="code-text"><a-p>    </a-p><a-c># set PROG to the program being run</a-c></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L70" href="#L70">70</a><span class="code-text"><a-p>    </a-p><a-f>__wezterm_set_user_var</a-f><a-p> </a-p><a-s>&quot;PROG&quot;</a-s><a-p> </a-p><a-s>&quot;</a-s><a-o>$</a-o><a-pr>1</a-pr><a-s>&quot;</a-s></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L71" href="#L71">71</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L72" href="#L72">72</a><span class="code-text"><a-p>    </a-p><a-c># arrange to clear it when it is done</a-c></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L73" href="#L73">73</a><span class="code-text"><a-p>    </a-p><a-f>trap</a-f><a-p> </a-p><a-s>&#39;__wezterm_set_user_var PROG &quot;&quot;&#39;</a-s><a-p> EXIT</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L74" href="#L74">74</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L75" href="#L75">75</a><span class="code-text"><a-p>    </a-p><a-c># and now run the corresponding command, taking care to avoid looping</a-c></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L76" href="#L76">76</a><span class="code-text"><a-p>    </a-p><a-c># with the alias definition</a-c></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L77" href="#L77">77</a><span class="code-text"><a-p>    </a-p><a-f>command</a-f><a-p> </a-p><a-s>&quot;</a-s><a-o>$</a-o><a-s>@&quot;</a-s></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L78" href="#L78">78</a><span class="code-text"><a-p>}</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L79" href="#L79">79</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L80" href="#L80">80</a><span class="code-text"><a-p>alias vim=</a-p><a-s>&quot;_run_prog vim&quot;</a-s></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L81" href="#L81">81</a><span class="code-text"><a-p>alias tmux=</a-p><a-s>&quot;_run_prog tmux&quot;</a-s></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L82" href="#L82">82</a><span class="code-text"><a-p>alias nvim=</a-p><a-s>&quot;_run_prog nvim&quot;</a-s></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L83" href="#L83">83</a><span class="code-text"><a-p>```</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L84" href="#L84">84</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L85" href="#L85">85</a><span class="code-text"><a-p>Then on the wezterm side, this information can be used when formatting the tab titles:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L86" href="#L86">86</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L87" href="#L87">87</a><span class="code-text"><a-p>```</a-p><a-tl>lua</a-tl></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L88" href="#L88">88</a><span class="code-text"><a-p>local </a-p><a-v>wezterm</a-v><a-p> = </a-p><a-f>require</a-f><a-p> </a-p><a-s>&#39;wezterm&#39;</a-s></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L89" href="#L89">89</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L90" href="#L90">90</a><span class="code-text"><a-p>wezterm.</a-p><a-f>on</a-f><a-p>(</a-p><a-s>&#39;format-tab-title&#39;</a-s><a-p>, </a-p><a-k>function</a-k><a-p>(</a-p><a-v>tab</a-v><a-p>)</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L91" href="#L91">91</a><span class="code-text"><a-p>  </a-p><a-k>local</a-k><a-p> </a-p><a-v>prog</a-v><a-p> = </a-p><a-v>tab</a-v><a-p>.</a-p><a-v>active_pane</a-v><a-p>.</a-p><a-v>user_vars</a-v><a-p>.</a-p><a-v>PROG</a-v></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L92" href="#L92">92</a><span class="code-text"><a-p>  </a-p><a-k>return</a-k><a-p> </a-p><a-v>tab</a-v><a-p>.</a-p><a-v>active_pane</a-v><a-p>.</a-p><a-v>title</a-v><a-p> </a-p><a-o>..</a-o><a-p> </a-p><a-s>&#39; [&#39;</a-s><a-p> </a-p><a-o>..</a-o><a-p> (</a-p><a-v>prog</a-v><a-p> </a-p><a-k>or</a-k><a-p> </a-p><a-s>&#39;&#39;</a-s><a-p>) </a-p><a-o>..</a-o><a-p> </a-p><a-s>&#39;]&#39;</a-s></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L93" href="#L93">93</a><span class="code-text"><a-p>end)</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L94" href="#L94">94</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L95" href="#L95">95</a><span class="code-text"><a-p>return </a-p><a-cr>{}</a-cr></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L96" href="#L96">96</a><span class="code-text"><a-p>```</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L97" href="#L97">97</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L98" href="#L98">98</a><span class="code-text"><a-p>If you install the [wezterm shell integration](../shell-integration.md) you</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L99" href="#L99">99</a><span class="code-text"><a-p>will get a more comprehensive set of user vars set for you automatically.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L100" href="#L100">100</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L101" href="#L101">101</a><span class="code-text"><a-p>User vars enable you to very deliberately signal information from your pane to</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L102" href="#L102">102</a><span class="code-text"><a-p>your wezterm config, and will work across multiplexer connections and even</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L103" href="#L103">103</a><span class="code-text"><a-p>through tmux (provided that you use the [tmux passthrough escape</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L104" href="#L104">104</a><span class="code-text"><a-p>sequence](https://github.com/tmux/tmux/wiki/FAQ#what-is-the-passthrough-escape-sequence-and-how-do-i-use-it)</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L105" href="#L105">105</a><span class="code-text"><a-p>to allow it to pass through).</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L106" href="#L106">106</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L107" href="#L107">107</a><span class="code-text"><a-p>The downside is that you need to take steps to ensure that your shell knows to</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L108" href="#L108">108</a><span class="code-text"><a-p>emit the appropriate user vars when you need them.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L109" href="#L109">109</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L110" href="#L110">110</a><span class="code-text"><a-p>Depending on your needs, there are some alternative ways to reason about</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L111" href="#L111">111</a><span class="code-text"><a-p>specific information in a pane.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L112" href="#L112">112</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L113" href="#L113">113</a><span class="code-text"><a-p>## </a-p><a-tt>OSC 0, 1, 2 for setting the Window/Pane Title</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L114" href="#L114">114</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L115" href="#L115">115</a><span class="code-text"><a-p>wezterm, like many other terminals, will interpret Operating System Command</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L116" href="#L116">116</a><span class="code-text"><a-p>(OSC) escape sequences for codes 0, 1 and 2 as updating the title:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L117" href="#L117">117</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L118" href="#L118">118</a><span class="code-text"><a-p>|OSC|Description|Action|Example|</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L119" href="#L119">119</a><span class="code-text"><a-p>|---|-----------|------|-------|</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L120" href="#L120">120</a><span class="code-text"><a-p>|0  |Set Icon Name and Window Title | Clears Icon Name, sets Window Title. | `\x1b]0;title\x1b\\` |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L121" href="#L121">121</a><span class="code-text"><a-p>|1  |Set Icon Name | Sets Icon Name, which is used as the Tab title when it is non-empty | `\x1b]1;tab-title\x1b\\` |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L122" href="#L122">122</a><span class="code-text"><a-p>|2  |Set Window Title | Set Window Title | `\x1b]2;window-title\x1b\\` |</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L123" href="#L123">123</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L124" href="#L124">124</a><span class="code-text"><a-p>[pane:get_title()](../config/lua/pane/get_title.md) and/or the</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L125" href="#L125">125</a><span class="code-text"><a-p>[PaneInformation](../config/lua/PaneInformation.md) `title` field can be used</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L126" href="#L126">126</a><span class="code-text"><a-p>to retrieve the effective title that has been set for a pane.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L127" href="#L127">127</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L128" href="#L128">128</a><span class="code-text"><a-p>It is common practice for shells in many distributions to arrange to set OSC 2</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L129" href="#L129">129</a><span class="code-text"><a-p>prior to executing a command. wezterm doesn&#39;t currently set this up</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L130" href="#L130">130</a><span class="code-text"><a-p>automatically. Note that wezterm will attempt to determine the foreground</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L131" href="#L131">131</a><span class="code-text"><a-p>process and substitute its title if the pane is a local pane and no title has</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L132" href="#L132">132</a><span class="code-text"><a-p>been set by an OSC escape sequence.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L133" href="#L133">133</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L134" href="#L134">134</a><span class="code-text"><a-p>## </a-p><a-tt>OSC 7 for setting the current working directory</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L135" href="#L135">135</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L136" href="#L136">136</a><span class="code-text"><a-p>Emitting OSC 7 will tell wezterm to use a specific URI for the current working</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L137" href="#L137">137</a><span class="code-text"><a-p>directory associated with a pane:</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L138" href="#L138">138</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L139" href="#L139">139</a><span class="code-text"><a-p>```</a-p><a-tl>bash</a-tl></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L140" href="#L140">140</a><span class="code-text"><a-p>printf </a-p><a-s>&quot;\033]7;file://HOSTNAME/CURRENT/DIR\033\\&quot;</a-s></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L141" href="#L141">141</a><span class="code-text"><a-p>```</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L142" href="#L142">142</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L143" href="#L143">143</a><span class="code-text"><a-p>You may also use `wezterm set-working-directory` for this if you have `wezterm`</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L144" href="#L144">144</a><span class="code-text"><a-p>available.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L145" href="#L145">145</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L146" href="#L146">146</a><span class="code-text"><a-p>The value you set via OSC 7 is available</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L147" href="#L147">147</a><span class="code-text"><a-p>[pane:get_current_working_dir()](../config/lua/pane/get_current_working_dir.md)</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L148" href="#L148">148</a><span class="code-text"><a-p>and/or the [PaneInformation](../config/lua/PaneInformation.md)</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L149" href="#L149">149</a><span class="code-text"><a-p>`current_working_dir` field can be used to retrieve the working directory that</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L150" href="#L150">150</a><span class="code-text"><a-p>has been set for a pane.  If OSC 7 has never been used in a pane, and that pane</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L151" href="#L151">151</a><span class="code-text"><a-p>is a local pane, wezterm can attempt to determine the working directory of the</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L152" href="#L152">152</a><span class="code-text"><a-p>foreground process that is associated with the pane.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L153" href="#L153">153</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L154" href="#L154">154</a><span class="code-text"><a-p>Installing the [wezterm shell integration](../shell-integration.md) will</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L155" href="#L155">155</a><span class="code-text"><a-p>arrange for bash/zsh to set OSC 7 for you.</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L156" href="#L156">156</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L157" href="#L157">157</a><span class="code-text"><a-p>## </a-p><a-tt>Local Process State</a-tt></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L158" href="#L158">158</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L159" href="#L159">159</a><span class="code-text"><a-p>wezterm provides some functions that can attempt to extract information about</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L160" href="#L160">160</a><span class="code-text"><a-p>processes that are running on the local machine; these will not work with</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L161" href="#L161">161</a><span class="code-text"><a-p>multiplexer connections of any kind (even unix multiplexers):</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L162" href="#L162">162</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L163" href="#L163">163</a><span class="code-text"><a-p>* [pane:get_foreground_process_info()](../config/lua/pane/get_foreground_process_info.md) -</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L164" href="#L164">164</a><span class="code-text"><a-p>  returns information about the process hierarchy in a pane</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L165" href="#L165">165</a><span class="code-text"><a-p>* [wezterm.procinfo.get_info_for_pid()](../config/lua/wezterm.procinfo/get_info_for_pid.md) -</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L166" href="#L166">166</a><span class="code-text"><a-p>  returns information about the process hierarchy for a given process id</a-p></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L167" href="#L167">167</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L168" href="#L168">168</a><span class="code-text">There are a couple of other similar/related methods available to the</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L169" href="#L169">169</a><span class="code-text">[Pane](../config/lua/pane/index.md) object and in the</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L170" href="#L170">170</a><span class="code-text">[wezterm.procinfo](../config/lua/wezterm.procinfo/index.md) module.</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L171" href="#L171">171</a><span class="code-text"></span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L172" href="#L172">172</a><span class="code-text">Because these local process functions don&#39;t require changing your shell</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L173" href="#L173">173</a><span class="code-text">configuration to get them working, they may be the most convenient to use in</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L174" href="#L174">174</a><span class="code-text">your wezterm configuration, but they are limited to local processes only and</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L175" href="#L175">175</a><span class="code-text">may not work as well to determine the correct foreground process when running</span><span class="code-break">
</span></span><span class="code-line"><a class="ln" id="L176" href="#L176">176</a><span class="code-text">on Windows.</span></span></pre></div></div>
</main>
</body>
</html>
