2 Commits
Author SHA1 Message Date
BlackAngelTV 1f112063df fix(clipboard): make the default history shortcuts effective
kitty_mod already includes shift, so kitty_mod+shift+v resolved to the same
chord as paste_from_clipboard and the mapping did nothing. Use the free alt
combinations and regenerate the option types so the bindings are part of the
default configuration.
2026-11-11 21:39:51 +01:00
BlackAngelTV 58d768fbb2 fix(build): generate the config for builtin option parsers
auto_reload_config is parsed with the builtin float, which the generator
rejected because it only accepted Python functions, so regenerating the option
types after any change to the defaults was impossible.
2026-11-11 21:39:51 +01:00
5 changed files with 16 additions and 11 deletions

No files matched your search

+4 -4
View File
@@ -285,14 +285,14 @@ written by a program that marks its request as private (by passing a ``pw``
field in an *OSC 5522* write request) is never recorded, and neither is anything
copied to the primary selection. Images and other non-text data are ignored.
Both actions have a default shortcut: :kbd:`kitty_mod+shift+v` opens the
history and :kbd:`kitty_mod+shift+f` asks for a fuzzy query before showing the
Both actions have a default shortcut: :kbd:`kitty_mod+alt+v` opens the
history and :kbd:`kitty_mod+alt+f` asks for a fuzzy query before showing the
list. To use different keys, add for example to :file:`kitty.conf`:
.. code-block:: conf
map kitty_mod+shift+h paste_from_clipboard_history
map kitty_mod+shift+g search_clipboard_history
map kitty_mod+alt+h paste_from_clipboard_history
map kitty_mod+alt+g search_clipboard_history
The size of the history is fixed at 50 entries, 64 KiB per entry and 1 MiB in
total, so that a few large copies cannot use an unbounded amount of memory.
+4 -4
View File
@@ -86,7 +86,7 @@ def generate_class(defn: Definition, loc: str) -> tuple[str, str]:
if isinstance(option, MultiOption):
mval: dict[str, dict[str, Any]] = {'macos': {}, 'linux': {}, '': {}}
func, typ = option_type_data(option)
assert isinstance(func, types.FunctionType)
assert callable(func), getattr(func, '__name__', func)
for val in option:
if val.add_to_default:
gr = mval[val.only]
@@ -115,7 +115,7 @@ def generate_class(defn: Definition, loc: str) -> tuple[str, str]:
func = str
elif defn.has_color_table and option.is_color_table_color:
func, typ = option_type_data(option)
assert isinstance(func, types.FunctionType)
assert callable(func), getattr(func, '__name__', func)
t(f' ans[{option.name!r}] = {func.__name__}(val)')
tc_imports.add((func.__module__, func.__name__))
cnum = int(option.name[5:])
@@ -130,7 +130,7 @@ def generate_class(defn: Definition, loc: str) -> tuple[str, str]:
params = dict(inspect.signature(func).parameters)
except Exception:
params = {}
assert isinstance(func, types.FunctionType)
assert callable(func), getattr(func, '__name__', func)
if 'dict_with_parse_results' in params:
t(f' {func.__name__}(val, ans)')
else:
@@ -188,7 +188,7 @@ def generate_class(defn: Definition, loc: str) -> tuple[str, str]:
for aname, action in defn.actions.items():
option_names.add(aname)
action_parsers[aname] = func = action.parser_func
assert isinstance(func, types.FunctionType)
assert callable(func), getattr(func, '__name__', func)
th = get_type_hints(func)
rettype = th['return']
typ = option_type_as_str(rettype)
+2 -2
View File
@@ -3958,11 +3958,11 @@ map(
map(
'Paste from clipboard history',
'paste_from_clipboard_history --allow-fallback=shifted,ascii kitty_mod+shift+v paste_from_clipboard_history',
'paste_from_clipboard_history --allow-fallback=shifted,ascii kitty_mod+alt+v paste_from_clipboard_history',
)
map(
'Search the clipboard history',
'search_clipboard_history --allow-fallback=shifted,ascii kitty_mod+shift+f search_clipboard_history',
'search_clipboard_history --allow-fallback=shifted,ascii kitty_mod+alt+f search_clipboard_history',
)
map(
+1
View File
@@ -4,6 +4,7 @@
#include "to-c.h"
static void
convert_from_python_font_size(PyObject *val, Options *opts) {
opts->font_size = PyFloat_AsDouble(val);
+5 -1
View File
@@ -902,6 +902,10 @@ defaults.map = [
KeyDefinition(trigger=SingleKey(mods=256, key=115), options=KeyMapOptions(when_focus_on='', new_mode='', mode='', on_unknown='beep', on_action='keep', timeout=None, allow_fallback=(KeyFallbackType.shifted, KeyFallbackType.alternate)), definition='paste_from_selection'),
# paste_from_selection
KeyDefinition(trigger=SingleKey(mods=1, key=57348), definition='paste_from_selection'),
# paste_from_clipboard_history
KeyDefinition(trigger=SingleKey(mods=258, key=118), options=KeyMapOptions(when_focus_on='', new_mode='', mode='', on_unknown='beep', on_action='keep', timeout=None, allow_fallback=(KeyFallbackType.shifted, KeyFallbackType.alternate)), definition='paste_from_clipboard_history'),
# search_clipboard_history
KeyDefinition(trigger=SingleKey(mods=258, key=102), options=KeyMapOptions(when_focus_on='', new_mode='', mode='', on_unknown='beep', on_action='keep', timeout=None, allow_fallback=(KeyFallbackType.shifted, KeyFallbackType.alternate)), definition='search_clipboard_history'),
# pass_selection_to_program
KeyDefinition(trigger=SingleKey(mods=256, key=111), options=KeyMapOptions(when_focus_on='', new_mode='', mode='', on_unknown='beep', on_action='keep', timeout=None, allow_fallback=(KeyFallbackType.shifted, KeyFallbackType.alternate)), definition='pass_selection_to_program'),
# scroll_line_up
@@ -1029,7 +1033,7 @@ defaults.map = [
# command_palette
KeyDefinition(trigger=SingleKey(mods=256, key=57366), definition='command_palette'),
# file_manager
KeyDefinition(trigger=SingleKey(mods=5, key=101), definition='launch --type=window-dock --dock-edge=right --dock-size=60 kitten file-manager'),
KeyDefinition(trigger=SingleKey(mods=5, key=101), definition='launch --type=window-dock --dock-edge=left --dock-size=60 kitten file-manager'),
# toggle_fullscreen
KeyDefinition(trigger=SingleKey(mods=256, key=57374), definition='toggle_fullscreen'),
# toggle_maximized