Skip to content

Instantly share code, notes, and snippets.

@ariel-frischer
Last active April 29, 2024 00:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ariel-frischer/3f73053928264f1370c95cc89631406d to your computer and use it in GitHub Desktop.
Save ariel-frischer/3f73053928264f1370c95cc89631406d to your computer and use it in GitHub Desktop.
FZF usage for kitty go to terminal tabs
!/bin/sh
# Kitty fzf to tab!
# Author: Ariel Frischer
# Add below mapping to your kitty.conf file (usually in ~/.config/kitty/)
# map super+j launch --type=overlay --stdin-source=@screen_scrollback /PATH_OF_THIS_FILE/fzf-kitty-tabs.sh
active_tab="$(
kitty @ ls | jq -r '
.[]
| select(.is_active)
| .tabs[]
| select(.is_active_tab)
'
)"
tab_id="$(jq -r '.id' <<<"${active_tab}")"
tab_layouts="$(jq -r '
. as $tab
| .enabled_layouts[]
| (if . == $tab.layout then "*" else " " end) + " " + .
' <<<"${active_tab}")"
selected_layout="$(fzf --reverse <<<"${tab_layouts}" | cut -c 3-)"
kitty @ goto-layout -m "id:${tab_id}" "${selected_layout}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment