Skip to content

Adds basic support for the kitty terminal emulator#1849

Open
MajorDallas wants to merge 245 commits intotalonhub:mainfrom
MajorDallas:kitty_app
Open

Adds basic support for the kitty terminal emulator#1849
MajorDallas wants to merge 245 commits intotalonhub:mainfrom
MajorDallas:kitty_app

Conversation

@MajorDallas
Copy link
Copy Markdown

No description provided.

@AndreasArvidsson
Copy link
Copy Markdown
Collaborator

Thank you for your first pull request! Unfortunately it's not enough to just write all the commands in the Talon file you need to do quite a lot of the work in python as well. You can have a look at the Talon wiki or ask on slack. If you want to I would be happy to do a session on discord.
Take care!

Comment thread core/homophones/homophones.csv Outdated
Comment thread apps/kitty/kitty.talon Outdated
Comment thread apps/kitty/kitty.talon Outdated
Comment thread apps/kitty/kitty.talon Outdated
Comment thread apps/kitty/kitty.talon Outdated
Comment thread apps/kitty/kitty.talon Outdated
@BlueDrink9
Copy link
Copy Markdown
Contributor

https://github.com/BlueDrink9/bluedrink9-talon/blob/959cea0d0672db42ee7d45c667aaed502c63e27f/apps/kitty.py#L1
I use this for basic copying and pasting, although there is a bunch of other stuff in there that I have not updated and doesn't work for kitty

Comment thread apps/kitty/kitty.py Outdated
@MajorDallas
Copy link
Copy Markdown
Author

https://github.com/BlueDrink9/bluedrink9-talon/blob/959cea0d0672db42ee7d45c667aaed502c63e27f/apps/kitty.py#L1 I use this for basic copying and pasting, although there is a bunch of other stuff in there that I have not updated and doesn't work for kitty

Glad to see I'm not alone in the intersection of Talon users and kitty users 😁

Somehow I've gotten by for years without knowing kitty had a shortcut to jump to a tab by number. I guess I'm not surprised, and I tried it real quick on mine only to find that readline eats ctrl-alt-<number>... but it also seems it might not be bound by default, anyway? The combo ctrl-alt seems to have collisions much more frequently than others, especially in GNOME3, which uses that combo for many of its window management shortcuts. Kinda getting off-topic, but I've been hoping/looking for a Talon context that captures the window manager on Linux systems..?

@MajorDallas
Copy link
Copy Markdown
Author

Not that I want more complexity, but I keep wondering how best to bind some features I use a lot. Probably my most-used is ctrl-shift-h to open the entire scrollback buffer in $PAGER. I sorta added that as the EditActions.find method, but I keep thinking a whole new namespace might be a good approach, eg.

kitten history: key(user.kitty_terminal_mod + "-h")
kitten eye cat [<user.text>]: insert("kitten icat " + text or "")
# etc...

Any thoughts on that possibility?

I don't think I'm so ambitious, but I wonder what could be done by writing a new kitten just for Talon...

@BlueDrink9
Copy link
Copy Markdown
Contributor

BlueDrink9 commented May 20, 2025

Yeah, to be clear, I don't use any of the advanced kitty features like tabs or its splits, so that file that I shared is untested for everything except copy and paste. It was just copied from Windows Terminal. I do use scrollback pager but rarely enough that I haven't mapped it; I just say the keyboard shortcut

There is no reason that you couldn't have the edit specific actions being overridden for Kitty and then a whole set of other actions with Kitty specific names. That's a fairly common pattern across other apps. You are by no means restricted to only the common edit actions.

A kitten is a very interesting idea. Kitty also supports remote process control, which would take care of some of the awkward difficulties handling escape sequences, alt, etc.

Comment thread apps/kitty/kitty.talon Outdated
* Adds implementations for nearly every split command
* Adds some kitty-specific commands
* Adds settings to set up RPC
* Retains keypress-based actions as a fallback method for interacting with kitty if the
  user hasn't set up RPC
* Extracts core functionality from KittyCmdMap into CmdMap to support polymorphic enums.
* Fixes incorrect formatting of 'text' in the 'kitten <user.text>' command
* Alphabetically sorts items within sections in the .talon file
* Adds 'tab switch' and 'tab choose' commands, by analogy with their split counterparts
* Fixes a bad copy/paste/modify in the `tab_next` action

... I am spending way more time on this than I ever intended to. But, I learned a lot
about two of the most important tools in my day-to-day work!
Comment thread apps/kitty/kitty.py Outdated
Comment thread apps/kitty/kitty.py Outdated
Comment thread apps/kitty/kitty.py Outdated
Essentially, these are any command that might be targetted by a `map`
directive in kitty.conf.
"""
return subprocess.run(
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lunixbochs We're not quite sure about this subprocess/rpc implementation. How do you feel about putting stuff like this in Talon community?

https://sw.kovidgoyal.net/kitty/remote-control/

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The best alternative is implementing the JSON-based RPC protocol and sending data to a socket. Thankfully, the protocol is fairly simple, particularly since I'm only interested in the subset concerned with "mappable actions," and it was easy to model with another dataclass. I haven't yet tested it, as I wanted to see what the concerns are with using subprocess before investing much more effort in that approach in case it turns out that either RPC approach presents the same problems.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other alternative would be leaving it as is, but rather than merging kitty support into community, have it as a separate plugin.

Personally, I very much hope that kitty RPC support does land. This looks fantastic. My config is quite complex and most of the mappings aren't in the main file anyway and I also don't have maps to a lot of things because I could never be bothered to learn all of the keyboard shortcuts. With voice it would open up a lot of options.

If I get time, I will take this for a test drive.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Andreas, what is the actual concern? The use of subprocess? The kitten? I do something very similar in my bspwm plugin

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not my concern really, but the reason that the rpc protocol to vscode is file based is to my knowledge that sockets wasn't considered secure enough. We just wanted to verify with aegis that this implementation is acceptable. Personally I have no problems with it.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fwiw, kitty has support for encrypting the JSON-based RPC protocol and requiring a password from clients that send data over the socket. Enabling the password has been a TODO since fairly early on, but I've not got around to it yet.

MajorDallas and others added 3 commits May 30, 2025 18:46
* Moves a lot of the "business logic" into a separate module to keep `kitty.py` focused
  on Talon commands
* Removes `HintsKittenCmdMap` in favor of using `dataclass`-based enum members
* Adds `MapDirective` dataclass to model the map directives parsed from kitty.conf
* Merges non-default mappings over `KittyCmdMap` by creating a new `CmdMap` enum at
  runtime from a `ChainMap` constructed from the parsed config and the known defaults
* snake_cases `KITTY_MOD()`
* Moves tag declarations back to .talon file

The parser is not perfect: it can't adequately handle mappings to directives that take
arguments yet.
* Adds "scaffolding" for JSON RPC protocol
  * This is incomplete, but it doesn't interfere with Talon
@BlueDrink9
Copy link
Copy Markdown
Contributor

I've checked this out locally, going to play with the rpc commands

BlueDrink9 and others added 5 commits March 24, 2026 16:35
Migrate the line comment action to use a snippet
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
There does not seem to be an else if statement in the language, so I did
not try to migrate that action.
I was not sure what to do about the fact that a switch statement is
called a case statement in the language, so changing the code state case
action to do what that action usually does would not reflect what things
are named in this language.
There is an issue with actions conflicting with commands with the elixir
setup, so I migrated the actions but left the commands alone.
I followed the structure in the existing talon file of explicitly
defining state commands.
I am not familiar enough with the language to know how to properly
handle the import actions, which are currently unusable anyways because
they do not correspond to action definitions.

---------

Co-authored-by: Andreas Arvidsson <andreas.arvidsson87@gmail.com>
Start migrating c and csharp to use snippets but leave code dealing with
user settings unchanged.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Andreas Arvidsson <andreas.arvidsson87@gmail.com>
FireChickenProductivity and others added 30 commits March 24, 2026 16:35
This enables "state true" and "state false" in .talon files.
`help customize` now shows the files you can open with the `customize`
command. I named the help command after the corresponding command
instead of the actual list name to make it easier to remember.
Co-authored-by: Nicholas Riley <com-github@sabi.net>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sleep: 
<img width="78" height="47" alt="image"
src="https://github.com/user-attachments/assets/4bd5a62f-53a7-4126-b31d-b27d241592ec"
/>
Deep sleep:
<img width="137" height="82" alt="image"
src="https://github.com/user-attachments/assets/8657e8ef-fa88-44a3-9ace-0645c67214a9"
/>

I can tell the difference, but I am not sure if a deeper shade of gray
is ideal. Black and white are already taken.
Adds and improves a number of go snippets

Adds a new snippet of reverseForLoop, which likely could be implemented
for other languages as well. In my repository I also have it implemented
for C++/C but I wasn't sure if I should keep that as a separate change?

---------

Co-authored-by: Andreas Arvidsson <andreas.arvidsson87@gmail.com>
Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
Make active context detection consistent in the help system. This change
makes the cached active context list match the commands that `help
active` will show. While I was here, I simplified the
`refresh_context_command_map` function a little.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Nicholas Riley <com-github@sabi.net>
I seperated the user.code_keyword and the user.code_type lists into
talon-list files.
I added a missing keyword (var).
I fixed the types list, which seemed to be built from a copy of the C
types, however not all of those types exist in go
I also added the user.code_keywords tag so that the previously defined
keywords could actually be used in go
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Adds a bunch of wrapper scopes and wrapper statements to snippets
Implements a couple of missing snippets as well
Could be something that is replicated in languages but for now just
implemented in go

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
fixes: talonhub#2109

I could only reproduce the linked issue on Talon version 0.4.0. Looking
at the code, I would expect this to also fail on the Talon beta, but for
some reason it doesn't.
Add spacing for keywords as needed  
Add missing keywords based upon this list:
https://go101.org/article/keywords-and-identifiers.html
Add some missing functions to the common golang list

---------

Co-authored-by: Nicholas Riley <com-github@sabi.net>
The only reason we did not add this already was because of bugs that are
now fixed.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
While it is technically possible to use different programming languages
in Jupyter notebooks, I suppose the most common use case is to use
Python. Hence, I would add this here until we find the way to do a more
fine grained language detection inside Jupyter notebooks (e.g. for the
Jupyter extension for VSCode)
---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Nicholas Riley <com-github@sabi.net>
Simplify the continuous scrolling code with better state management.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
<!--pre-commit.ci start-->
updates:
- [github.com/pycqa/isort: 7.0.0 →
8.0.0](PyCQA/isort@7.0.0...8.0.0)
<!--pre-commit.ci end-->

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This implements the remaining focus commands for `i3wm`. On `i3wm` the
default behavior when a window from a different workspace requests focus
is to set the "urgent" marker without actually focusing the window.
Thus, the actions for i3wm need to call a separate action to focus the
latest urgent window. This makes the draft editor commands work on
`i3wm`.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
<!--pre-commit.ci start-->
updates:
- [github.com/pycqa/isort: 8.0.0 →
8.0.1](PyCQA/isort@8.0.0...8.0.1)
<!--pre-commit.ci end-->

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Also a tiny correction to the vimscript comment - add the missing space
after "

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Nicholas Riley <com-github@sabi.net>
Co-authored-by: Andreas Arvidsson <andreas.arvidsson87@gmail.com>
Display a message by default when breaking changes is updated. This
offers a command for never seeing the message again and for opening the
breaking changes file.

<img width="363" height="170" alt="image"
src="https://github.com/user-attachments/assets/4ef00394-27bf-4430-918c-258424a4f7ab"
/>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
<!--pre-commit.ci start-->
updates:
- [github.com/psf/black-pre-commit-mirror: 26.1.0 →
26.3.0](psf/black-pre-commit-mirror@26.1.0...26.3.0)
<!--pre-commit.ci end-->

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Implements some compound edit commands to readline. ie can do clear word
left, clear way left, etc

It also implements copy word left and cut word left but this uses
readline's clipboard rather than the desktops. I think this is the only
way of doing it but might be unexpected.

I also added readline support to the gnome terminal, to enable these
commands in there

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
<!--pre-commit.ci start-->
updates:
- [github.com/psf/black-pre-commit-mirror: 26.3.0 →
26.3.1](psf/black-pre-commit-mirror@26.3.0...26.3.1)
<!--pre-commit.ci end-->

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
I don't think this usage  is intentional
Removes todo comments, which are now documented here: talonhub#2143

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
…mall (talonhub#2159)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.