kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.11k stars 972 forks source link

set_tab_title not working in 0.26.0 #5441

Closed djensenius closed 2 years ago

djensenius commented 2 years ago

Describe the bug set_tab_title is not working

To Reproduce I have shortcuts to quickly title tabs: For example:

map kitty_mod+shift+c set_tab_title 

This fails as following:

Failed to parse action

set_tab_title HELLO
'Unknown action: set_tab_title'

Press e to see detailed traceback or any other key to exit
Traceback (most recent call last):
  File "lib/python3.9/kitty/boss.py", line 1304, in combine
  File "lib/python3.9/kitty/options/utils.py", line 945, in resolve_aliases
  File "lib/python3.9/kitty/options/utils.py", line 995, in resolve_aliases_and_parse_actions
  File "lib/python3.9/kitty/options/utils.py", line 921, in parse_key_action
KeyError: 'Unknown action: set_tab_title'

Press Enter or Esc to exit

Further, if I try to interactively set the title, it fails silently.

Screenshots If applicable, add screenshots to help explain your problem.

Environment details

kitty 0.26.0 created by Kovid Goyal
Darwin GitHub.local 22.1.0 Darwin Kernel Version 22.1.0: Mon Aug 15 20:07:13 PDT 2022; root:xnu-8792.40.29.161.2~1/RELEASE_ARM64_T6000 arm64
ProductName:        macOS ProductVersion:       13.0 BuildVersion:      22A5331f
Frozen: True
Paths:
  kitty: /Applications/kitty.app/Contents/MacOS/kitty
  base dir: /Applications/kitty.app/Contents/Resources/kitty
  extensions dir: /Applications/kitty.app/Contents/Resources/Python/lib/kitty-extensions
  system shell: /opt/homebrew/bin/fish
Loaded config files:
  /Users/djensenius/.config/kitty/kitty.conf

Config options different from defaults:
active_tab_title_template  {fmt.fg._83b6af}{fmt.bg.default} ﱣ {index}:{f'{title[:6]}…{title[-6:]}' if title.rindex(title[-1]) + 1 > 13 else title}{' []' if layout_name == 'stack' else ''} 
bell_on_tab                
confirm_os_window_close    0
disable_ligatures          1
font_family                Fira Code
font_size                  13.0
macos_show_window_title_in none
macos_titlebar_color       1
modify_font:
    cell_height 140%
symbol_map:
    U+21b5 - U+21b5 → Hack Nerd Font Mono
    U+23fb - U+23fe → Hack Nerd Font Mono
    U+25b8 - U+25b8 → Hack Nerd Font Mono
    U+2605 - U+2605 → Hack Nerd Font Mono
    U+2630 - U+2630 → Hack Nerd Font Mono
    U+2632 - U+2632 → Hack Nerd Font Mono
    U+2665 - U+2665 → Hack Nerd Font Mono
    U+26a1 - U+26a1 → Hack Nerd Font Mono
    U+2714 - U+2714 → Hack Nerd Font Mono
    U+2b58 - U+2b58 → Hack Nerd Font Mono
    U+e000 - U+e00d → Hack Nerd Font Mono
    U+e0a0 - U+e0a2 → Hack Nerd Font Mono
    U+e0a3 - U+e0a3 → Hack Nerd Font Mono
    U+e0b0 - U+e0b3 → Hack Nerd Font Mono
    U+e0b4 - U+e0c8 → Hack Nerd Font Mono
    U+e0cc - U+e0d2 → Hack Nerd Font Mono
    U+e0d4 - U+e0d4 → Hack Nerd Font Mono
    U+e200 - U+e2a9 → Hack Nerd Font Mono
    U+e300 - U+e3eb → Hack Nerd Font Mono
    U+e5fa - U+e62b → Hack Nerd Font Mono
    U+e615 - U+e615 → Hack Nerd Font Mono
    U+e62b - U+e62b → Hack Nerd Font Mono
    U+e700 - U+e7c5 → Hack Nerd Font Mono
    U+ea60 - U+ebeb → codicon
    U+f000 - U+f2e0 → Hack Nerd Font Mono
    U+f27c - U+f27c → Hack Nerd Font Mono
    U+f300 - U+f313 → Hack Nerd Font Mono
    U+f400 - U+f4a8 → Hack Nerd Font Mono
    U+f500 - U+fd46 → Hack Nerd Font Mono
tab_bar_edge               1
tab_bar_style              custom
tab_fade                   (0, 0, 0, 0)
tab_separator              
tab_title_template         {fmt.fg._415c6d}{fmt.bg.default} ○ {index}:{f'{title[:6]}…{title[-6:]}' if title.rindex(title[-1]) + 1 > 13 else title}{' []' if layout_name == 'stack' else ''} 
Added shortcuts:
    kitty_mod+a →  set_tab_title HELLO
Removed shortcuts:
    kitty_mod+a > 1 →  set_background_opacity 1
    kitty_mod+a > d →  set_background_opacity default
    kitty_mod+a > l →  set_background_opacity -0.1
    kitty_mod+a > m →  set_background_opacity +0.1
Changed shortcuts:
    kitty_mod+c →  set_tab_title 
    kitty_mod+l →  set_tab_title 
    kitty_mod+t →  set_tab_title

Important environment variables seen by the kitty process:
    PATH                                /Applications/kitty.app/Contents/MacOS:/usr/bin:/bin:/usr/sbin:/sbin
    LANG                                en_CA.UTF-8
    SHELL                               /opt/homebrew/bin/fish
    USER                                djensenius

Additional context

kovidgoyal commented 2 years ago

set_tab_title doesnt take arguments, it's meant for interactive usage only.

map f1 set_tab_title

will work fine. https://sw.kovidgoyal.net/kitty/actions/#action-set_tab_title

kovidgoyal commented 2 years ago

And here I have added support for supplying arguments to this action: https://github.com/kovidgoyal/kitty/commit/5b28aed0b116621c7dad5e0b3fe60ef13399fb4c

djensenius commented 2 years ago

Awesome!!! Thank you!

I'm still seeing it not change my tab title, but that could be another issue in my config.

https://user-images.githubusercontent.com/782512/187228470-b7f792c0-95fe-4756-ace6-93b9764bca44.mov

kovidgoyal commented 2 years ago

You have some custom tab bar I am guessing, first make sure it works with the default tab bar

sdemura commented 2 years ago

I am seeing this issue too. Trying to rename a tab results in a no-op. (The tittle doesn't change)

Kitty 0.26.0 MacOS 12.5

# BEGIN_KITTY_THEME
# Everforest Dark Medium
include current-theme.conf
# END_KITTY_THEME

# Set the value of kitty_mod modifier for all mappings
kitty_mod cmd

# Remove all default mappings.
clear_all_shortcuts yes

# Reload config
map kitty_mod+shift+r load_config_file

# Misc
copy_on_select yes
scrollback_lines 5000

# Fonts
font_family Fira Code Retina
font_size 13.0

# MacOS Options
macos_option_as_alt yes
macos_thicken_font 1.0
macos_titlebar_color background
macos_show_window_title_in none
macos_quit_when_last_window_closed yes

## Keymaps
# move words by alt left/right
map alt+left send_text all \x1b\x62
map alt+right send_text all \x1b\x66

# Change font sizes
map kitty_mod+equal change_font_size all +1.0
map kitty_mod+minus change_font_size all -1.0
map kitty_mod+0 change_font_size all 0

# Clipboard operations
map kitty_mod+c copy_to_clipboard
map kitty_mod+v paste_from_clipboard
map kitty_mod+s paste_from_selection

# easier tab navigation
map kitty_mod+1 goto_tab 1
map kitty_mod+2 goto_tab 2
map kitty_mod+3 goto_tab 3
map kitty_mod+4 goto_tab 4
map kitty_mod+5 goto_tab 5
map kitty_mod+6 goto_tab 6
map kitty_mod+7 goto_tab 7
map kitty_mod+8 goto_tab 8
map kitty_mod+9 goto_tab 999
map kitty_mod+left previous_tab
map kitty_mod+right next_tab

# Tabs
# map kitty_mod+t new_tab
map kitty_mod+t new_tab_with_cwd
map kitty_mod+w close_tab
map kitty_mod+p previous_tab
map kitty_mod+n next_tab
#map kitty_mod+z toggle_layout vertical
map kitty_mod+l next_layout
map kitty_mod+shift+i set_tab_title

# Windows
map ctrl+z next_window
map kitty_mod+enter new_window_with_cwd
map kitty_mod+[ prev_window
map kitty_mod+] next_window

## Resize windows
map kitty_mod+shift+left resize_window narrower 2
map kitty_mod+shift+right resize_window wider 2
map kitty_mod+shift+up resize_window taller 2
map kitty_mod+shift+down resize_window shorter 2

## Navigate windows
map kitty_mod+left neighboring_window left
map kitty_mod+right neighboring_window right
map kitty_mod+up neighboring_window up
map kitty_mod+down neighboring_window down

# Scrolling
map kitty_mod+/ show_scrollback
map kitty_mod+y scroll_line_up
map kitty_mod+e scroll_line_down
map kitty_mod+u scroll_page_up
map kitty_mod+d scroll_page_down
map kitty_mod+shift+g scroll_end
map kitty_mod+g scroll_home

# Tab Configuration
tab_bar_edge top
tab_bar_style powerline
tab_powerline_style slanted
kovidgoyal commented 2 years ago

Then I need a way to reproduce. Bisect your kitty.conf and post a minimal version that reproduces.

kovidgoyal commented 2 years ago

I tried it with your full config and it works for me, pressing super+shift+i and typing in a new tab title, the title in the tab bar changes, as expected.

djensenius commented 2 years ago

https://gist.github.com/djensenius/56e5826695be722913a20c54c967e81e

Here is one without custom tabs. It does not rename the tab, just keeps the path as the title. I'm on macOS.

kovidgoyal commented 2 years ago

ah, macOS. You are probably suffering from a side-effect of #5439.

TO confirm start kitty from another terminal as

LANG=en_US.UTF-8 /Applications/kitty.app/Contents/MacOS/kitty

and it should work

djensenius commented 2 years ago

Aha! That did indeed work!