Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapping key presses to remote control send-text command fails #3147

Closed
felixge opened this issue Dec 7, 2020 · 4 comments
Closed

Mapping key presses to remote control send-text command fails #3147

felixge opened this issue Dec 7, 2020 · 4 comments
Labels

Comments

@felixge
Copy link

felixge commented Dec 7, 2020

Describe the bug

I'm trying to map a key to send-text. But when invoking the key I get the following error:

remote_control mapping failed

'NoneType' object has no attribute 'partition'

To Reproduce

Steps to reproduce the behavior:

  1. Edit kitty.conf
allow_remote_control yes
map ctrl+enter remote_control send-text hi
  1. Relaunch kitty
  2. Hit ctrl+enter
  3. Observe the error shown above.

Expected behavior

The text hi should appear in the active window.

Environment details

OS: Mac OS 10.15.7

$ kitty --debug-config --config kitty.conf 
kitty 0.19.2 created by Kovid Goyal
Darwin felix-mbp-2089.local 19.6.0 Darwin Kernel Version 19.6.0: Thu Oct 29 22:56:45 PDT 2020; root:xnu-6153.141.2.2~1/RELEASE_X86_64 x86_64
ProductName:	Mac OS X ProductVersion:	10.15.7 BuildVersion:	19H15
Loaded config files: kitty.conf

Config options different from defaults:
allow_remote_control y
Added shortcuts:
	control+enter KeyAction(func='remote_control', args=['set-spacing', 'margin=30'])

Additional context

I can reproduce the issue kitty --config kitty.conf that contains only the 2 lines of config shown above.

This issue seems to be specific to send-text. The following config works as expected:

allow_remote_control yes
map ctrl+enter remote_control set-spacing margin=30

Thanks for all your work on kitty, it's greatly appreciated!

@felixge felixge added the bug label Dec 7, 2020
@kovidgoyal
Copy link
Owner

If you want to send text do it directly like this:

map ctrl+enter send_text all hi

@felixge
Copy link
Author

felixge commented Dec 7, 2020

Thanks for the fast response @kovidgoyal! That fixes the example in this issue.

However, I had simplified the example to make the issue easier to understand. I'm actually trying to send this text to a specific window, i.e. --match num:1. I'm unable to figure out how to make this work via send_text (it's different from the remote control send-text, right?).

Edit: For the sake of completeness, my final goal is to send "up arrow + enter" to window 1 (essentially letting me re-run the last bash command). So the full config I was going for is this:

map ctrl+enter send-text --match num:1 \x1b\x5b\x41\n

But that ran into the partition error I reported here.

@kovidgoyal kovidgoyal reopened this Dec 7, 2020
@kovidgoyal
Copy link
Owner

And note you dont need allow_remote_control when creating mappings with remote_control. And just for fun, if you want to do this using plain send_text you would do:

map whatever combine : first_window : send_text all hi : nth_window -1

@felixge
Copy link
Author

felixge commented Dec 7, 2020

@kovidgoyal thank you so much for the fix, I'll try it when the next release comes out. And thank you even more for showing me how to use the combine feature! I was able to make my shortcut work like this:

# repeat last command executed in second window by sending <arrow up> + <enter>
map ctrl+enter combine : second_window : send_text all \x1b\x5b\x41\n : previous_window

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants