mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-04-26 22:21:16 -03:00
Some modern terminals allow creating tabs in a single window; this functionality has a lot of overlap with what a window manager already provides, so I'm not sure if it's a good idea. Regardless, a lot of people still use terminal tabs (or even multiple levels of tabs via tmux!), so let's add a fish-native way to set the tab title independent of the window title. Closes #2692
57 lines
1.2 KiB
ReStructuredText
57 lines
1.2 KiB
ReStructuredText
Synopsis
|
|
--------
|
|
|
|
.. synopsis::
|
|
|
|
fish_title
|
|
fish_tab_title
|
|
|
|
::
|
|
|
|
function fish_title
|
|
...
|
|
end
|
|
|
|
|
|
function fish_tab_title
|
|
...
|
|
end
|
|
|
|
|
|
Description
|
|
-----------
|
|
|
|
The ``fish_title`` function is executed before and after a new command is executed or put into the foreground and the output is used as a titlebar message.
|
|
|
|
The first argument to ``fish_title`` contains the most recently executed foreground command as a string, if any.
|
|
|
|
This requires that your terminal supports :ref:`programmable titles <term-compat-osc-0>` and the feature is turned on.
|
|
|
|
To disable setting the title, use an empty function (see below).
|
|
|
|
To set the terminal tab title to something other than the terminal window title,
|
|
define the ``fish_tab_title`` function, which works like ``fish_title`` but overrides that one.
|
|
|
|
Example
|
|
-------
|
|
|
|
A simple title::
|
|
|
|
function fish_title
|
|
set -q argv[1]; or set argv fish
|
|
# Looks like ~/d/fish: git log
|
|
# or /e/apt: fish
|
|
echo (fish_prompt_pwd_dir_length=1 prompt_pwd): $argv;
|
|
end
|
|
|
|
Do not change the title::
|
|
|
|
function fish_title
|
|
end
|
|
|
|
Change the tab title only::
|
|
|
|
function fish_tab_title
|
|
echo fish $fish_pid
|
|
end
|