298 Commits

Author SHA1 Message Date
Kovid Goyal
3e0850a864 Fix failing test 2026-05-17 08:52:28 +05:30
Kovid Goyal
e455b29a85 Ensure tmpdir used for remote drag is deleted on kitty exit 2026-04-14 11:27:55 +05:30
copilot-swe-agent[bot]
519fd49ce6 Fix bugs in t=k remote drag implementation and add comprehensive tests
Bug fixes in dnd.c:
- mktempdir_in_cache: add missing 'return ans' after successful strdup
- mktempdir_in_cache (utils.py): use O_RDONLY instead of O_RDWR for directories
- remote_items allocation: use mi.num_uris instead of ds.num_mimes
- Off-by-one: uri_item_idx > changed to >= for bounds checks
- Off-by-one: entry_num > changed to >= for bounds checks
- populate_dir_entries: fix missing last entry after final null separator
- add_payload directory finalization: create directory on disk with mkdirat
- get_errno_name: add EFBIG, EISDIR, ENOSPC error codes

Test infrastructure:
- Add dnd_test_force_drag_dropped() to simulate DROPPED state
- Make notify_drag_data_ready() succeed in test mode

Comprehensive t=k tests added:
- Single file, empty file, single symlink transfer
- Chunked file transfer with m=1
- Single directory with children
- Directory with symlinks
- Multiple URIs
- Deep directory trees (breadth-first and depth-first, 3+ levels)
- Mixed file/dir/symlink at top level
- Completion signal
- Error handling (client errors, invalid state)
- DoS limits (REMOTE_DRAG_LIMIT, PRESENT_DATA_CAP)
- Invalid input (bad base64, too large chunks, invalid indices/handles)
- URI list with comments
- Multiple chunks for directory listing

Agent-Logs-Url: https://github.com/kovidgoyal/kitty/sessions/9da0bff7-6a1a-490f-a4c5-8cb328e056ce

Co-authored-by: kovidgoyal <1308621+kovidgoyal@users.noreply.github.com>
2026-04-13 15:54:34 +00:00
Kovid Goyal
4942ac98a1 More work on DnD protocol 2026-04-13 19:40:23 +05:30
Kovid Goyal
811b4fa127 Fix #9083 2025-10-08 10:02:51 +05:30
Kovid Goyal
726c693edf Avoid reading shell env twice to get editor
Its cached, but still...
2025-10-07 22:27:57 +05:30
Kovid Goyal
a9f80fe05b Allow easily injecting env vars from the login shell config into the env in which kitty runs child processes
Fixes #9042
2025-10-07 22:23:31 +05:30
Kovid Goyal
fcccadc8f3 Make reading resolved shell env more robust
We pass -0 to env so that it works even for env vars that have newlines
in them.
2025-10-07 21:44:01 +05:30
Kovid Goyal
d52f2e7981 Rewrite rendering pipeline
This was needed to fix various corner cases when doing blending of colors
in linear space. The new architecture has the same performance as the
old in the common case of opaque rendering with no UI layers or images.

In the case of only positive z-index images there is a performance
decrease as the OS Window is now rendered to a offscreen texture and
then blitted to screen. However, in the future when we move to Vulkan or
I can figure out how to get Wayland to accept buffers with colors in
linear space, this performance penalty can be removed. The performance
penalty was not significant on my system but this is highly GPU
dependent. Modern GPUs are supposedly optimised for rendering to
offscreen buffers, so we will see. The awrit project might be a good
test case.

Now either we have 1-shot rendering for the case of opaque with only ext
or all the various pieces are rendered in successive draw calls into an
offscreen buffer that is blitted to the output buffer after all drawing
is done.

Fixes #8869
2025-08-11 00:47:02 +05:30
Kovid Goyal
d548a6fcf4 rename typing module to avoid conflicts with stdlib typing 2025-04-28 09:20:10 +05:30
Kovid Goyal
639ad3e8a6 Make shlex code re-useable in launcher 2025-04-25 09:35:42 +05:30
Kovid Goyal
9296bc3060 Speed up --detach
Also DRYer as well as more robust since single instance cleanup, binding
etc. happen in single process.
2025-04-24 08:13:58 +05:30
Kovid Goyal
867ec83bed Fix use of single instance with detach 2025-04-24 07:17:55 +05:30
Kovid Goyal
559e8449c5 Allow redirecting to a log file in --detach mode 2025-04-24 06:46:46 +05:30
Kovid Goyal
c1b6b4494a Implement starting kitty hidden
Fixes #3466
2025-04-23 08:50:02 +05:30
Andrew Marshall
5c0b7297fe Fix exception when /etc/paths{,.d} is not readable on macOS
It may be present but not readable. This may occur when executing in a
sandbox that does not permit access.
2025-04-22 15:42:12 -04:00
Kovid Goyal
da1626090a Update codebase to Python 3.10 using pyupgrade 2025-02-03 10:56:50 +05:30
Kovid Goyal
c07037b558 ... 2025-01-05 12:58:34 +05:30
Kovid Goyal
334adf9c1a Ensure temp files and other resources are cleaned up even if kitty crashes or is SIGKILLed 2025-01-05 12:51:59 +05:30
Kovid Goyal
a410d38966 Remove unused code 2025-01-05 11:07:55 +05:30
Kovid Goyal
41308a0b91 Remove unused code 2024-09-12 20:33:41 +05:30
Kovid Goyal
913ce58fe3 Make shlex_split always return a token
Matches behavior of split() so is therefore more intuitive
2024-09-02 17:30:18 +05:30
Kovid Goyal
d363513884 Fix listen_on with IPv6 address 2024-08-27 18:42:51 +05:30
Kovid Goyal
57ba0f4d87 Add a note about X11 specificity of preshow_callback 2024-08-27 10:39:52 +05:30
Kovid Goyal
f1d0d0949b Run pyupgrade to update the codebase to python 3.9
Gets rid of a lot of typing ugliness by using type annotations on
builtin types
2024-07-31 07:55:27 +05:30
Kovid Goyal
8201f0dd0e Move caching implementation to Python
Less code, more performant since the cache is used from Python.
And we can make the Go code a pure image format conversion filter.
2024-07-23 13:37:53 +05:30
Kovid Goyal
4c0ead129e Support older python 2024-07-23 06:23:48 +05:30
Kovid Goyal
d08dcd92c7 Python wrapper to use image to RGBA Go code 2024-07-22 22:39:12 +05:30
Kovid Goyal
d31c48092a Move function used only in one place to that place 2024-07-22 13:42:59 +05:30
Kovid Goyal
b5cf999da9 Make kitty --single-instance fast
No longer pay the overhead of starting the Python interpreter
just to write a message to the single instance socket. This reduces
the time for kitty --single-instance (for second and later instances)
from 70ms to 3ms an almost 25x improvement.

Needs testing on macOS and also porting of the +open handling.
2024-06-23 15:45:41 +05:30
Kovid Goyal
098ed41716 Add support for ANSI-C quoted strings to shlex 2024-05-09 11:46:23 +05:30
Kovid Goyal
8fc96c5bd7 Make the debug logging functions consistent
They now all output the same format of:
[time since program start] msg
2024-04-08 12:53:55 +05:30
Kovid Goyal
ede332fecf Use our monotonic everywhere
Gives nicer times relative to process start time than the python stdlib
monotonic
2024-03-26 13:26:18 +05:30
Kovid Goyal
1d5c7d662e log error when failing to parse URL 2024-02-25 09:57:44 +05:30
Kovid Goyal
6205fb32fd Refactor VT parser for more speed
No longer copy bytes into a separate buffer, instead parse them in place
in the read buffer
2024-02-25 09:57:23 +05:30
Kovid Goyal
52025ff030 misc parser and test fixes 2024-02-25 09:57:22 +05:30
Kovid Goyal
3c4f2aa1b8 shlex.split -> shlex_split 2023-12-02 15:17:08 +05:30
Kovid Goyal
b0ba4b4a42 Fast and robust implementation of shlex.split
Also returns position of words in src string which we will need for
keymap parsing.
2023-12-02 14:57:02 +05:30
Kovid Goyal
77292a16d6 Make shebangs consistent
Follow PEP 0394 and use /usr/bin/env python so that the python in the
users venv is respected. Not that the kitty python files are meant to be
executed standalone anyway, but, whatever.

Fixes #6810
2023-11-11 08:32:05 +05:30
Kovid Goyal
169315d33d Improve paste sanitization
Replace C0 chars with their graphical equivalents and \n with \eE
which has the same visual effect. C1 chars are replaced by reverse
question mark.
2023-11-04 07:23:59 +05:30
Kovid Goyal
defa2e29ac Always ask for confirmation when pasting text with control codes in it 2023-10-20 13:02:28 +05:30
Kovid Goyal
56963c693e When pasting in bracketed paste mode and the cursor is at a shell prompt, strip out C0 control codes
Some shells incorrectly interpret these allowing escape from bracketed paste mode. Thanks to David Leadbetter for discovering.
2023-10-20 12:17:13 +05:30
Kovid Goyal
0c0c6b732f ... 2023-09-24 13:14:26 +05:30
Kovid Goyal
76c6f91685 Expand environment variables in the shell option
See #6511 for discussion
2023-09-24 08:28:42 +05:30
Kovid Goyal
37938573ca When running a shell for `--hold set the env variable KITTY_HOLD=1` to allow users to customize what happens
For instance the user could have

[ "$KITTY_HOLD" = "1" ] && exec kitten __hold_till_enter__

in their shell rc files to get back the previous Press enter or esc to
quit behavior.
2023-08-30 14:18:11 +05:30
Kovid Goyal
06c5a1357b Nicer error message for invalid listen on values
Fixes #6535
2023-08-08 16:45:54 +05:30
Kovid Goyal
4c18cae3a0 ... 2023-07-27 17:23:18 +05:30
Kovid Goyal
2dfad8e854 Allow matching on user vars 2023-07-27 16:54:50 +05:30
Ben Blank
b1f557d98b X11: Add support for custom window icon 2023-07-16 09:35:40 -07:00
Kovid Goyal
bc72c3eadc Add helix to the list of editors to search for 2023-07-02 07:49:21 +05:30