Last active
April 29, 2024 00:18
-
-
Save ariel-frischer/3f73053928264f1370c95cc89631406d to your computer and use it in GitHub Desktop.
FZF usage for kitty go to terminal tabs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
!/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