Code Monkey home page Code Monkey logo

kitty-smart-tab's Introduction

Smart Tab Control for Kitty

Kitty is a fast GPU-based terminal emulator.

This kitten lets you bind keys to either control tabs in Kitty or pass them through to a program running in a Kitty window, depending on whether you, in fact, have any Kitty tabs.

Why would you want that?

You can use Kitty on its own, and have multiple tabs. In this case, you want to bind easy keys such as Alt+10 to switch Kitty tabs.

Alternatively, you can run a terminal multiplexer such as tmux in Kitty, perhaps because you want to preserve your session and access it over SSH. In this case, you want those same keys to switch tmux windows.

Minimum requirements

Kitty 0.24.0 or higher.

Installation

  • Copy or symlink smart_tab.py into your Kitty configuration directory (~/.config/kitty).

  • Edit your kitty.conf to add some key shortcuts.

  • Restart Kitty.

Configuring shortcuts

In all cases, the last argument is a key to send to the active window if the current OS window has only a single tab. If there are two or more tabs, all arguments except the last are executed as a Kitty command.

All the snippets below are only examples. You should choose keys to suit your personal style.

Note that you can use other Kitty commands, but the choice whether to perform the command or send the key to the application will depend on whether you have tabs in the current OS window.

Next tab

map ctrl+page_down  kitty smart_tab.py  next_tab  ctrl+page_down

Previous tab

map ctrl+page_up  kitty smart_tab.py  previous_tab  ctrl+page_up

New tab

map ctrl+shift+t  kitty smart_tab.py  new_tab  alt+shift+t

Note that in this example the key sent to the application is different. This is because terminal emulators typically cannot express a Ctrl+Shift+letter combination.

Close tab

map ctrl+shift+w  kitty smart_tab.py  close_tab  alt+shift+w

Move tab forward

map ctrl+shift+page_down  kitty smart_tab.py  move_tab_forward  ctrl+shift+page_down

Move tab backward

map ctrl+shift+page_up  kitty smart_tab.py  move_tab_backward  ctrl+shift+page_up

Set tab title

map ctrl+shift+f2  kitty smart_tab.py  set_tab_title  ctrl+shift+f2

Go to tab

map alt+1  kitty smart_tab.py  goto_tab 1  alt+1
map alt+2  kitty smart_tab.py  goto_tab 2  alt+2
…
map alt+9  kitty smart_tab.py  goto_tab 9  alt+9
map alt+0  kitty smart_tab.py  goto_tab 10  alt+0

kitty-smart-tab's People

Contributors

yurikhan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

kitty-smart-tab's Issues

How to map tmux default keymap to change windows?

By default, in Tmux to change between windows the shortcut is c-b (c-a in my case) + number.
How can I map this? I tried

map cmd+1 kitten smart_tab.py goto_tab 1 ctrl+a>1

But it gives me:

kitten smart_tab.py goto_tab 1 ctrl+a>1 ord() expected a character, but string of length 3 found

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.