Compare commits

...

1227 Commits

Author SHA1 Message Date
Kovid Goyal
04807453ec version 0.24.1 2022-01-06 10:40:59 +05:30
Kovid Goyal
1b7582e85c Merge branch 'patch-1' of https://github.com/Silent-Crafter/kitty 2022-01-06 10:03:45 +05:30
Silent Crafter
e106562ef1 Bash: for loop array iteration fix
the array iteration wasn't implemented correctly for KITTY_SHELL_INTEGRATION variable. the i variable in for loop wasn't iterating through all the elements of that array
2022-01-06 09:52:59 +05:30
Kovid Goyal
d3a20f00d6 Add a comment explaining where we use PS2 marks 2022-01-06 09:25:41 +05:30
Kovid Goyal
de5443a4db Add a reference to the discussion of using custom tab bar themes to the docs 2022-01-06 09:16:22 +05:30
Kovid Goyal
e8b19e08fa Fix non-renderable combining chars causing some text to not be rendered on Linux
The test for non-renderable chars was broken and the variation selectors
were not included in the test. Fixes #4444
2022-01-05 22:33:53 +05:30
Kovid Goyal
a574081012 Merge branch 'zsh-integration' of https://github.com/romkatv/kitty 2022-01-05 21:29:30 +05:30
Roman Perepelitsa
4f06ce9d72 Once again start embedding marks in PS2 on zsh 2022-01-05 16:36:00 +01:00
Kovid Goyal
6713580455 Explicitly turn off aliases in a more functions
Not really needed, but I like to be explicit
2022-01-05 21:04:27 +05:30
Kovid Goyal
86f6c946b3 Merge branch 'zsh-integration-aliases' of https://github.com/romkatv/kitty 2022-01-05 20:49:08 +05:30
Roman Perepelitsa
9194d1db6b Disable aliases when patching functions in zsh integration 2022-01-05 16:16:18 +01:00
Kovid Goyal
420a1b018a Fix #4448 2022-01-05 20:14:23 +05:30
Roman Perepelitsa
8009b85073 Make writing to the TTY more robust in zsh integration
See https://github.com/kovidgoyal/kitty/issues/4440.
2022-01-05 09:55:19 +01:00
Kovid Goyal
2a58af2be9 Ignore all errors rendering /etc/issue 2022-01-05 14:04:56 +05:30
Roman Perepelitsa
4decac26f6 Fix a typo in _ksi_debug_print 2022-01-05 09:22:00 +01:00
Roman Perepelitsa
a6b74f190f Revert "Get _ksi_debug_print working again"
This reverts commit ff63e58f95.
2022-01-05 09:20:33 +01:00
Kovid Goyal
bfbe60c90e Update changelog 2022-01-05 09:05:20 +05:30
Kovid Goyal
384b2f8462 Add roundtrip and cursor positioning tests for all three zero width chars 2022-01-05 08:57:14 +05:30
Kovid Goyal
d875615c03 Fix a regression in the handling of some combining characters such as zero width joiners
Fixes #4439
2022-01-05 08:50:55 +05:30
Kovid Goyal
9aefcfe56f Make --hold a bit more robust 2022-01-05 08:14:22 +05:30
Kovid Goyal
266e70222f Avoid hooking LE widgets at all when using no-cursor 2022-01-05 07:46:20 +05:30
Kovid Goyal
d4639e2aea Merge branch 'zsh-integration' of https://github.com/romkatv/kitty 2022-01-05 07:40:10 +05:30
Roman Perepelitsa
ca8975891b Replace add-zle-hook-widget with a series of hacks in zsh integration 2022-01-04 19:56:57 +01:00
Kovid Goyal
bed3d2eb50 Fix #4434 2022-01-04 23:38:58 +05:30
Kovid Goyal
78495a7f64 spelling 2022-01-04 20:35:21 +05:30
Kovid Goyal
f66914f7bb ... 2022-01-04 20:29:53 +05:30
Kovid Goyal
58e1f6ee1f Use ctermid() for tty_name 2022-01-04 20:25:16 +05:30
Kovid Goyal
0625035202 oops forgot to re-order second tab group 2022-01-04 20:18:49 +05:30
Kovid Goyal
f8fc272f58 Make loading IssueData more robust
Fixes #4424
2022-01-04 19:57:23 +05:30
Kovid Goyal
6d61de8a8f Merge branch 'fladson/fix-documentation-typo' of https://github.com/fladson/kitty 2022-01-04 19:52:27 +05:30
Kovid Goyal
4c08709df1 Use same orders for all tab groups 2022-01-04 19:49:55 +05:30
Fladson Gomes
58a28da94d Fix documentation typo 2022-01-04 14:46:25 +01:00
Kovid Goyal
26b976d17d Merge branch 'fix-mouse-scroll' of https://github.com/page-down/kitty 2022-01-04 18:01:30 +05:30
pagedown
3141fc3f05 Update mouse cursor position when scrolling without OS window focus 2022-01-04 19:39:36 +08:00
Kovid Goyal
a45d6c8b55 Fix #4421 2022-01-04 16:21:00 +05:30
Kovid Goyal
dadf496a68 remove leftover debug print 2022-01-04 12:01:23 +05:30
Kovid Goyal
dae8ae33f0 hints kitten: Fix matching of filenames enclosed in quotes or brackets not stripping the surrounding quotes properly. Fixes #4419 2022-01-04 10:58:31 +05:30
Kovid Goyal
b6254e4a67 version 0.24.0 2022-01-04 08:21:17 +05:30
Kovid Goyal
53431c7ba8 Merge branch 'refactor' of https://github.com/page-down/kitty 2022-01-03 14:31:16 +05:30
pagedown
afa0bb4c1d Avoid using the same variable name in different scopes
Variable names such as a and b are also used in the MIN and MAX macros.
2022-01-03 16:11:20 +08:00
pagedown
9ae2579dcb The window width and height are always greater than zero here 2022-01-03 16:05:24 +08:00
Kovid Goyal
37fe98fdec Fix failure on older python 2022-01-02 09:39:05 +05:30
Kovid Goyal
fe91b74ba7 ... 2022-01-02 09:38:14 +05:30
Kovid Goyal
0fcc446298 Avoid extra type checking import of re 2022-01-02 09:26:52 +05:30
Kovid Goyal
e228f5105e Merge branch 'refactor' of https://github.com/page-down/kitty 2022-01-02 09:23:25 +05:30
Kovid Goyal
719760fd7b Remove unused UNUSED 2022-01-02 09:19:40 +05:30
Kovid Goyal
d3e87bcd4f Another shadowed global variable 2022-01-02 09:04:26 +05:30
Kovid Goyal
be771456e1 Dont shadow global variable name 2022-01-02 08:59:34 +05:30
Kovid Goyal
8514782ad2 Remove unused code
icat already scales images to fit the screen in process_image() so dont
have to consider the case of the image being wider than the screen in
set_cursor()
2022-01-02 08:56:17 +05:30
pagedown
a3e9e0f010 Use the already imported subprocess 2022-01-01 21:29:46 +08:00
pagedown
15615a4cd1 Avoid defining variables with the same name that already exist
Avoid using existing parameter names for local variables.
Avoid using variable names from upper level for nested loops.
Avoid local variables hiding existing global variables.
2022-01-01 21:29:32 +08:00
pagedown
7246fb347c Remove the unused function 2022-01-01 21:29:06 +08:00
pagedown
f1b6fb397b Remove redundant variable assignment 2022-01-01 21:28:55 +08:00
pagedown
49fbeb9a56 Remove the always true conditions
Unsigned integers are always greater than or equal to zero.
The else branch is always the opposite.
2022-01-01 21:27:01 +08:00
Kovid Goyal
f17d71454a ... 2021-12-31 22:51:16 +05:30
Kovid Goyal
59ea7485e4 Fix loading of kitty completions broken by unfunctioning of kitty-integration 2021-12-31 22:49:09 +05:30
Kovid Goyal
ff63e58f95 Get _ksi_debug_print working again 2021-12-31 22:38:39 +05:30
Kovid Goyal
79ec8b60b9 Fix visual select window sometimes showing stale window titles 2021-12-31 21:08:20 +05:30
Kovid Goyal
846c774ac2 DRYer 2021-12-31 20:58:06 +05:30
Kovid Goyal
940e311c74 Add a section to the changelog showcasing major recent new features 2021-12-31 20:38:50 +05:30
Kovid Goyal
251667a30e ... 2021-12-31 09:44:00 +05:30
Kovid Goyal
e45697f78a Fix a regression that broke rendering of unicode regional indicators
At some point, unicode regional indicators became combining chars in the
unicode standard, which broke the handling of them in draw_codepoint().
The fix has the added advantage of improving performance in the common
case by only checking for combining chars. The flag check happens only
if the first check matches.

Fixes #4407
2021-12-31 09:28:47 +05:30
Kovid Goyal
ea63efa522 Merge branch 'refactor-dry' of https://github.com/page-down/kitty 2021-12-31 06:42:46 +05:30
pagedown
60839cdb47 DRYer: Use gl_size to convert coordinates 2021-12-31 09:04:47 +08:00
Kovid Goyal
a867b4444d Clamp border rects to pixels
This uses the same co-ord calculation for border rects as for text
cells. DRYer and avoids borders and blank rects being drawn at haf pixel
offsets.
2021-12-31 06:20:57 +05:30
Kovid Goyal
072fe91518 ... 2021-12-30 20:44:30 +05:30
Kovid Goyal
07e6171dc5 DRYer 2021-12-30 20:32:17 +05:30
Kovid Goyal
9a80fcee37 Ensure sizes for window number decorations are correct 2021-12-30 19:05:06 +05:30
Kovid Goyal
7731a558f0 Merge branch 'fix-shell.nix-on-macOS-arm' of https://github.com/Luflosi/kitty 2021-12-30 17:50:19 +05:30
Luflosi
7ea4c1e47f shell.nix: add dependency needed on Apple silicon
shell.nix is missing a depencency on the UserNotifications framework on macOS with Apple silicon. Unfortunately we can't just unconditionally include this dependency because Nixpkgs uses a different macOS SDK version for macOS on an Intel processor compared to macOS on Apple silicon. The older SDK version 10.12 on Intel does not have the UserNotifications framework, which would lead to an "attribute missing" error when trying to execute `nix-shell`. The condition can be dropped when the macOS SDK version for Intel processors is finally updated. See https://github.com/NixOS/nixpkgs/issues/101229 for progress on that.
See https://github.com/NixOS/nixpkgs/pull/137512 for more context.
Closes https://github.com/kovidgoyal/kitty/issues/4352.
2021-12-28 15:35:16 +01:00
Kovid Goyal
f6b748712c Clamp positions of window numbers/titles to nearest pixel
Avoids jaggies in rendering
2021-12-26 11:05:16 +05:30
Kovid Goyal
93abedd93f Replace the screenshot on the landing page with a video 2021-12-24 13:26:34 +05:30
Kovid Goyal
872cd7b2d5 Fix unfunctioning ofkitty-integration in docs
It has to be unfunctioned after being run once
2021-12-24 10:26:02 +05:30
Kovid Goyal
a7e03f9c63 Merge branch 'docs' of https://github.com/page-down/kitty 2021-12-24 10:23:46 +05:30
pagedown
f53dfb27e2 Docs: Add macOS mouse wheel scrolling and title bar options changes 2021-12-24 12:37:54 +08:00
pagedown
36b4e0edd2 Docs: Also fixed the input issue in toggling non-traditional fullscreen 2021-12-24 12:29:08 +08:00
pagedown
9081947751 Docs: Prefer semi-bold on macOS only 2021-12-24 12:11:02 +08:00
pagedown
f58013f2c6 Docs: Cross-platform IME integration improvements 2021-12-24 12:06:41 +08:00
pagedown
ae35507f80 Use the lowercase kitty 2021-12-24 12:02:54 +08:00
pagedown
73ff508b51 Docs: unfunction kitty-integration 2021-12-24 11:46:08 +08:00
pagedown
b0ccf74029 Docs: Replace Unicode left single quote with ASCII single quote 2021-12-24 11:44:58 +08:00
Kovid Goyal
6046dc8598 Merge branch 'zsh-integration' of https://github.com/romkatv/kitty 2021-12-24 07:55:07 +05:30
Roman Perepelitsa
9bba38bd11 Unfunction kitty-integration in zsh 2021-12-23 19:09:09 +01:00
Kovid Goyal
59505d17d5 Update docs for new zsh integration code 2021-12-23 20:40:46 +05:30
Kovid Goyal
bcecc61b67 Merge branch 'zsh-integration' of https://github.com/romkatv/kitty 2021-12-23 20:06:44 +05:30
Kovid Goyal
f9af273150 Try to convince mypy to play nice 2021-12-23 10:18:42 +05:30
Kovid Goyal
8699f90fa4 Now have sphinx types on dev machine 2021-12-23 10:13:16 +05:30
Kovid Goyal
0a9ba1bc08 ... 2021-12-23 08:11:16 +05:30
Roman Perepelitsa
37741ac808 Add a comment within zsh integration related to cursor shape changes 2021-12-22 15:04:31 +01:00
Roman Perepelitsa
6d790237c3 Rewrite zsh integration
Note:

- Very lightly tested.
- Docs not updated.
2021-12-22 14:04:40 +01:00
Kovid Goyal
70d5a5134f Log a nicer error message when failing to read cwd of a process 2021-12-22 16:22:33 +05:30
Kovid Goyal
ee166c5555 Retry the Linux ARM build as it is pretty flaky 2021-12-22 07:45:10 +05:30
Kovid Goyal
b965fb4806 Launcher: Fix UB when failing to launch because resolving the EXE fails 2021-12-22 07:32:28 +05:30
Kovid Goyal
e49b20bfa7 Merge branch 'feat-titlebar-opt-err' of https://github.com/page-down/kitty 2021-12-21 15:25:57 +05:30
pagedown
8abfb50aed Ignore invalid title bar color 2021-12-21 17:51:00 +08:00
Kovid Goyal
10e0077a6f Merge branch 'feat-macos-titlebar-opt' of https://github.com/page-down/kitty 2021-12-21 13:40:52 +05:30
pagedown
278477b387 Add light and dark to the macOS title bar option 2021-12-21 15:14:08 +08:00
Kovid Goyal
58b7fb41d9 Update how it works for zsh integration
In light of the recent changes by @romkatv
2021-12-21 10:44:45 +05:30
Kovid Goyal
f71e0a6ee8 ... 2021-12-21 10:39:06 +05:30
Kovid Goyal
b59e42c9cc Fix animations getting paused when switching to alternate screen and back 2021-12-21 08:24:43 +05:30
Kovid Goyal
57888af4ea Merge branch 'zsh-integration' of https://github.com/romkatv/kitty 2021-12-20 20:11:52 +05:30
Kovid Goyal
90f2ba474c Fix icat for GIF images broken 2021-12-20 17:54:55 +05:30
Roman Perepelitsa
09d025d88f Minor robustness improvements to zsh shell integration 2021-12-20 13:20:38 +01:00
Kovid Goyal
e18ac4f0f5 ... 2021-12-20 10:47:33 +05:30
Kovid Goyal
63ab35ec7c Add a note about patched NERD fonts to the FAQ entry on fonts 2021-12-20 08:19:42 +05:30
Kovid Goyal
d65ed5993c New bypy CLI for export 2021-12-19 22:42:36 +05:30
Kovid Goyal
6436dfaf14 Bump the bundled libxml2 version 2021-12-19 22:05:06 +05:30
Kovid Goyal
0c4bd96f87 Merge branch 'fix-mouse-scroll' of https://github.com/page-down/kitty 2021-12-17 22:15:55 +05:30
pagedown
6afabf7e2a Fix mouse scrolling kitty window without OS window focus 2021-12-17 23:57:38 +08:00
Kovid Goyal
a4d4cf5819 Fix #4367 2021-12-17 17:35:13 +05:30
Kovid Goyal
1be7425186 Another mypy 0.920 fix 2021-12-17 06:15:10 +05:30
Kovid Goyal
8f0825bc5c Various fixes for mypy 0.920 2021-12-17 05:56:19 +05:30
Kovid Goyal
6a657eec33 New CLI for bypy 2021-12-16 20:37:46 +05:30
Kovid Goyal
ae952605d3 Note about exe_search_path in launch docs 2021-12-16 19:48:17 +05:30
Kovid Goyal
81753706d3 oops 2021-12-15 20:30:11 +05:30
Kovid Goyal
4120be3e2d Allow using "tab" colors in the title template
Fixes #4360
2021-12-15 20:09:23 +05:30
Kovid Goyal
832f73fde9 Fix incorrect example in tab template docs
Should be fmt.bg.default not fmt.bg.normal
Fixes #4360
2021-12-15 19:37:17 +05:30
Kovid Goyal
99d06f0714 See if 0 makes Apple happy 2021-12-15 13:14:02 +05:30
Kovid Goyal
e973c45968 Fix build on XCode 13.1
Apple go on making it harder and harder to support multiple
versions of their pathetic operating system in one code base.

kIOMainPortDefault is the "non-deprecated" replacement for
kIOMasterPortDefault. However, it is now marked as being available only
on macOS 12 and later so it refuses to build in a codebase designed to
run on earlier versions of macOS. Le bubbling sigh.

According to https://developer.apple.com/documentation/iokit/kiomasterportdefault?language=objc
passing NULL has the same effect and avoids the stupid warning.
Hopefully this will work till Apple decides to spend their trillion
dollars doing more stupid shit.
2021-12-15 12:57:46 +05:30
Kovid Goyal
4dbf0c89c3 Suppress warning about sphinx_inline_tabs not being marked for parallel reads 2021-12-15 12:11:32 +05:30
Kovid Goyal
1f264ffec5 Fix push/pop of colors not updating colors on screen until a dynamic color is also changed.
Fixes #4351
2021-12-13 11:17:54 +05:30
Kovid Goyal
547e4a3d7e Merge branch 'fix-fullscreen' of https://github.com/page-down/kitty 2021-12-13 08:38:06 +05:30
pagedown
d0fa0516f5 macOS: Fix keyboard input not working after toggling full screen 2021-12-13 08:58:52 +08:00
Kovid Goyal
2c13005e0f Shutdown the Linux VMs after building 2021-12-12 12:42:29 +05:30
Kovid Goyal
b52990cb39 Merge branch 'docs-enable-kbd-xform' of https://github.com/page-down/kitty 2021-12-12 08:07:09 +05:30
pagedown
0a1390a7f6 Docs: Enable kbd transform when building dirhtml with sphinx 2021-12-12 00:06:28 +08:00
Kovid Goyal
5084f843c9 Merge branch 'fix-rc-scroll-win' of https://github.com/page-down/kitty 2021-12-11 12:40:18 +05:30
pagedown
42b5b1cbf7 Fix remote control scroll-window argument parsing 2021-12-11 14:47:57 +08:00
Kovid Goyal
832f7a862b Merge branch 'docs-kittens' of https://github.com/page-down/kitty 2021-12-10 18:06:05 +05:30
pagedown
0d4a62ccb5 Fix unicode-input docs redirect 2021-12-10 20:29:09 +08:00
Kovid Goyal
3d98501e57 Move custom kitten back
Its not the most interesting thing to read and hence should not be at
the top.
2021-12-10 17:23:12 +05:30
Kovid Goyal
a4fff7abe3 Merge branch 'docs-kittens' of https://github.com/page-down/kitty 2021-12-10 17:22:42 +05:30
Kovid Goyal
f51779d93a Forgot to build ARM binary in publish 2021-12-10 17:12:17 +05:30
pagedown
121d86fb1c Docs: Put custom kitten docs at the top instead of in the middle 2021-12-10 17:35:10 +08:00
pagedown
5956639082 Add unicode-input docs redirect 2021-12-10 17:34:39 +08:00
pagedown
7e449dec4f Docs: Use underscores in kitten document filenames 2021-12-10 17:30:51 +08:00
Kovid Goyal
a938b01246 Build binaries for Linux ARM64 2021-12-10 12:49:58 +05:30
Kovid Goyal
a4cd10c6fb ... 2021-12-10 12:29:49 +05:30
Kovid Goyal
5fd17b4b99 Merge branch 'docs-shortcuts' of https://github.com/page-down/kitty 2021-12-10 12:18:09 +05:30
pagedown
8ae0ae2c93 Docs: use the action name of the shortcut in several places 2021-12-10 14:36:16 +08:00
pagedown
59957a913a List kitten names in the kitten default shortcuts list 2021-12-10 14:33:29 +08:00
Kovid Goyal
49d284cd16 Merge branch 'fix-dbg-dump-lines' of https://github.com/page-down/kitty 2021-12-10 10:32:54 +05:30
pagedown
dedbd14ace Fix action dump_lines_with_attrs 2021-12-10 12:22:21 +08:00
Kovid Goyal
2c6d888b3d ... 2021-12-10 07:36:09 +05:30
Kovid Goyal
9b0a5d6465 Merge branch 'abs-conf-path' of https://github.com/page-down/kitty 2021-12-10 07:32:36 +05:30
Kovid Goyal
32c4f4ccaa location for linux installers has changed with recent bypy changes 2021-12-10 07:23:12 +05:30
Kovid Goyal
8e435dff16 Update the version of Ubuntu the kitty binaries are built on to Bionic
The upgrade was needed as I couldn't get Xenial to boot in the QEMU VM.
In any case Bionic is now three years old and comes with GLIBC 2.27
released on 2018-02-01 which will be almost four years old when the next
version of kitty is released.
2021-12-09 22:28:11 +05:30
pagedown
98e44a8907 Unify resolution of absolute paths or config dir paths 2021-12-09 20:43:07 +08:00
Kovid Goyal
060362bee2 Fix #4332 2021-12-09 13:26:47 +05:30
Kovid Goyal
6bfe9bfe9a Merge branch 'fix-action-paste' of https://github.com/page-down/kitty 2021-12-09 12:52:03 +05:30
pagedown
b4f7cd94a1 Fix paste mappable action 2021-12-09 15:02:27 +08:00
Kovid Goyal
74f21ec774 Add an issue reference 2021-12-09 12:18:48 +05:30
Kovid Goyal
5899e06b6b Merge branch 'fix-docs-scroll' of https://github.com/page-down/kitty 2021-12-09 12:14:06 +05:30
Kovid Goyal
5f744368dd A new option exe_search_path to modify the locations kitty searches for executables to run 2021-12-09 12:13:26 +05:30
pagedown
a4a9290577 Docs: fix conflicts caused by smooth scrolling in Chrome 2021-12-09 14:31:54 +08:00
Kovid Goyal
77b15bf73f ... 2021-12-09 11:51:10 +05:30
Kovid Goyal
f41584c83b Ignore virtual-machines.conf used to specify build VM locations 2021-12-09 11:44:21 +05:30
Kovid Goyal
892b8c03eb Cleanup previous PR 2021-12-09 11:44:13 +05:30
Kovid Goyal
ecdf901c19 Merge branch 'feat-path-search' of https://github.com/page-down/kitty 2021-12-09 11:41:37 +05:30
pagedown
5d1f58427e ... 2021-12-09 11:57:17 +08:00
pagedown
02a7316342 Use the unified PATH search function 2021-12-09 11:32:30 +08:00
Kovid Goyal
3d59e4eac1 Add links to other implementations of the keyboard protocol 2021-12-09 07:18:12 +05:30
Kovid Goyal
50ce698524 oops 2021-12-08 22:21:15 +05:30
Kovid Goyal
32768e7939 Unify the PATH searching algorithm for launch and running children 2021-12-08 20:10:34 +05:30
Kovid Goyal
62dbc1129c When setting the OS Window title strip out CSI escape codes
Fixes #4325
2021-12-08 16:04:23 +05:30
Kovid Goyal
3d0d987984 Merge branch 'docs-url' of https://github.com/page-down/kitty 2021-12-08 15:18:20 +05:30
pagedown
2c78a22270 Docs: generate relative url with link text in document 2021-12-08 17:20:52 +08:00
pagedown
4a7ae0f524 Docs: use pygments styles official website url 2021-12-08 17:20:13 +08:00
Kovid Goyal
bc25e5a8a2 DRYer 2021-12-07 15:52:06 +05:30
Kovid Goyal
4af2526f54 Add a few more default responses for confirmations 2021-12-06 17:41:03 +05:30
Kovid Goyal
8f688fb33b When confirming close restore global state if the ask kitten is aborted without output
Fixes #4320
2021-12-06 17:25:27 +05:30
Kovid Goyal
6e351cd945 Restore ability to use foreground color unchanged for selections 2021-12-06 05:23:41 +05:30
Kovid Goyal
2d66e37dcb Fix selection_forground=none not being respected 2021-12-05 22:00:43 +05:30
Kovid Goyal
2da25d9187 Fix #4318 2021-12-05 20:50:28 +05:30
Kovid Goyal
11badac95d Ensure cell start position is clamped to a pixel 2021-12-05 18:26:25 +05:30
Kovid Goyal
b4024bf7f2 DRYer 2021-12-05 18:21:00 +05:30
Kovid Goyal
759feac95b Make the gl pixel clamping functions more widely available 2021-12-05 18:16:36 +05:30
Kovid Goyal
33de23d01d Remove unused code 2021-12-05 18:03:37 +05:30
Kovid Goyal
3f0ecbb241 Use the new async response framework when setting background/logo images via RC. Avoids having to use --no-response 2021-12-05 18:02:09 +05:30
Kovid Goyal
e91c008357 ... 2021-12-05 17:42:54 +05:30
Kovid Goyal
7a2003c371 Allow ~/ expansion when specify image paths for @ set-(background|logo) 2021-12-05 17:16:17 +05:30
Kovid Goyal
a7eb9850b7 clamp logo position to nearest pixel 2021-12-05 15:53:20 +05:30
Kovid Goyal
f01446ff25 ... 2021-12-05 13:26:06 +05:30
Kovid Goyal
525a32be51 better conversion of logo width/height to gl values
Map the naive value back to an integer using the same algorithm as for
the scissor test and adjust the value if they dont match
2021-12-05 13:21:04 +05:30
Kovid Goyal
73386bd67f Use scissor limits as pixel extents in cell render data
More accurate since that is the actual content area
2021-12-05 13:04:43 +05:30
Kovid Goyal
d1cf88e942 Make the window geometry in pixels available in CellRenderData 2021-12-05 12:29:33 +05:30
Kovid Goyal
c11da595ef Move calculation of window render data into native code
There was no reason to do it in python
2021-12-05 12:21:24 +05:30
Kovid Goyal
2546afb7aa Use a struct to pass around cell render data 2021-12-05 11:57:22 +05:30
Kovid Goyal
56edb5cdbe Merge branch 'feat-nth-os-window' of https://github.com/page-down/kitty 2021-12-05 10:12:16 +05:30
Kovid Goyal
bca3179a6d Forgot that draw_cells() is called with a NULL window when drawing the tab bar
Fixes #4317
2021-12-05 07:44:51 +05:30
pagedown
1f3d86a434 Add a new mappable action nth_os_window to focus OS window 2021-12-04 20:45:01 +08:00
Kovid Goyal
0456399ce5 Fix leak when changing window logo 2021-12-04 14:01:05 +05:30
Kovid Goyal
799881af2d free then clear hash tables 2021-12-04 13:57:25 +05:30
Kovid Goyal
14047588ae Remote control command to set window logo 2021-12-04 13:55:13 +05:30
Kovid Goyal
9d9840a6d8 ... 2021-12-04 12:53:16 +05:30
Kovid Goyal
b36d8d6469 Fix logo rendering under wayland, which requires premult 2021-12-04 12:50:48 +05:30
Kovid Goyal
254ba401d4 Allow specifying window logos in the launch command 2021-12-04 12:37:14 +05:30
Kovid Goyal
3035ba08c3 Interpret relative logo paths relative to conf dir 2021-12-04 07:34:30 +05:30
Kovid Goyal
16201ac873 Use a logo for the kitty shell window 2021-12-03 20:25:07 +05:30
Kovid Goyal
42a2493286 Fade the window logo by a configurable amount 2021-12-03 18:05:59 +05:30
Kovid Goyal
6f48dda8b9 Fix storage of window logos
Store by id not pointer since the pointers are not stable. And use two
hash maps by path and by id for fast lookup.
2021-12-03 17:43:45 +05:30
Kovid Goyal
b8b495ac31 Fix text not rendered when showing window logo 2021-12-03 13:54:28 +05:30
Kovid Goyal
bd1276d079 Update window logos on config reload 2021-12-03 13:47:14 +05:30
Kovid Goyal
bfb87854df Python API to change window logo 2021-12-03 13:38:42 +05:30
Kovid Goyal
f4aba9fc41 Update changelog with new window_logo setting 2021-12-03 13:23:49 +05:30
Kovid Goyal
757c7900d9 Dont draw the window logo during a live resize 2021-12-03 13:20:57 +05:30
Kovid Goyal
3d2877eeb9 More work on per window logo 2021-12-03 13:19:10 +05:30
Kovid Goyal
e04919098f Start work on a per window logo 2021-12-02 11:14:17 +05:30
Kovid Goyal
5d05aeaace ... 2021-12-02 07:28:27 +05:30
Kovid Goyal
142b6fcc00 Use symbolic names 2021-12-01 22:57:02 +05:30
Kovid Goyal
91c0f4e2d9 Document more tmux breakage 2021-12-01 22:38:23 +05:30
Kovid Goyal
89a93af1d5 GitHub says checkouting out HEAD^2 for merge commits is no longer needed for CodeQL 2021-12-01 20:20:58 +05:30
Kovid Goyal
ef07e2941c Fix clamping of background image 2021-12-01 20:12:31 +05:30
Kovid Goyal
0c3a8dadf6 bg uniforms should be reset when options are reloaded 2021-12-01 16:43:15 +05:30
Kovid Goyal
6425715daf Merge branch 'docs-opt-values' of https://github.com/page-down/kitty 2021-12-01 14:11:12 +05:30
pagedown
be110fb38c Docs: wrap long document lines 2021-12-01 15:46:16 +08:00
pagedown
d743206b8c Docs: add valid option values 2021-12-01 15:03:35 +08:00
Kovid Goyal
af7a104f5b Fix typo causing actions to be run multiple times with combine 2021-12-01 10:39:02 +05:30
Kovid Goyal
c0b73986cb Fix #4302 2021-11-30 20:47:16 +05:30
Kovid Goyal
c48049a3bb Merge branch 'docs' of https://github.com/page-down/kitty 2021-11-30 16:59:48 +05:30
pagedown
1cb6250f14 Remove duplicate imports 2021-11-30 18:54:44 +08:00
pagedown
8ed6ee97b2 Docs: replace http url with https, use ripgrep project url and fix typo 2021-11-30 18:53:58 +08:00
pagedown
1d88371604 Docs: separate and wrap each choices 2021-11-30 18:41:20 +08:00
pagedown
8685558a2a Docs: fix remote control launch command description 2021-11-30 18:35:36 +08:00
Kovid Goyal
d372b27ccd Ensure active window is updated when taking over a tab 2021-11-30 14:28:50 +05:30
Kovid Goyal
88410e032f Merge branch 'fix-rc-detach' of https://github.com/page-down/kitty 2021-11-30 12:07:04 +05:30
pagedown
622885853d Fix remote control detach-tab detach-window 2021-11-30 12:38:19 +08:00
Kovid Goyal
0d3c7a64e2 ... 2021-11-30 07:45:49 +05:30
Kovid Goyal
0c274a9a0b Parse actions on demand
This removes the startup cost of parsing hundreds of default actions
when action_alias or kitten_alias are used. Although the cost is on the
order of 1ms, this design feels cleaner and gives nicer debug config
output.
2021-11-29 21:51:42 +05:30
Kovid Goyal
0e5f51f195 Add a note about not copying the kitty binary out of the installation folder 2021-11-29 21:45:30 +05:30
Kovid Goyal
49369d6279 Preserve definition location when resolving 2021-11-29 19:38:38 +05:30
Kovid Goyal
bd288bd18f Linux: Fix release event for the final key in a compose sequence not being reported. Fixes #4285 2021-11-29 19:26:16 +05:30
Kovid Goyal
cdb1138465 ... 2021-11-29 12:42:02 +05:30
Kovid Goyal
c8c6f8691f Store the shell_integration option as a set 2021-11-29 12:41:25 +05:30
Kovid Goyal
9441cf15c3 Move the bash integration script into its own dir
This matches the other shells and might be useful someday
if bash ever gets a way for the invoking process to inject code
into it.

Also use KITTY_INSTALLATION_DIR when loading the bash integration code.
2021-11-29 12:30:10 +05:30
Kovid Goyal
276ed7263c Forgot to use env rather than os.environ when checking for ZDOTDIR 2021-11-29 12:22:33 +05:30
Kovid Goyal
6b38ca3bd2 add verification for parsing shell_integration 2021-11-29 12:04:19 +05:30
Kovid Goyal
c7bf54807e Fix capitalization 2021-11-29 11:49:58 +05:30
Kovid Goyal
b28811846a Fix on creation IME update not being applied because render data was not yet set 2021-11-28 22:57:09 +05:30
Kovid Goyal
5561aa1d37 Allow forcing IME update 2021-11-28 22:53:45 +05:30
Kovid Goyal
8c0111cb08 Merge branch 'issue4292' of https://github.com/ctrlcctrlv/kitty 2021-11-28 22:38:56 +05:30
Fredrick Brennan
0dc8bd5520 Make the GPU selection FAQ item not require root 2021-11-28 11:59:26 -05:00
Kovid Goyal
acdf06bf5d Tell cocoa the previous character range is invalid when updating IME position
Without this IME popup position is sometimes incorrect, for instance, at
startup
2021-11-28 22:11:21 +05:30
Kovid Goyal
5e78b1c23e Merge branch 'fix-ime' of https://github.com/page-down/kitty 2021-11-28 21:21:35 +05:30
pagedown
088b7cde4f Update IME status when window lost focus 2021-11-28 23:09:35 +08:00
Kovid Goyal
6a8aeb2501 Merge branch 'fix-cmd-output' of https://github.com/page-down/kitty 2021-11-28 19:41:52 +05:30
pagedown
9c326397d0 Update the last visited command output position after unscrolling 2021-11-28 21:59:58 +08:00
Kovid Goyal
28d89bdd53 Cleanup previous PR 2021-11-28 19:03:52 +05:30
Kovid Goyal
69ba419afd Merge branch 'issue4292' of https://github.com/ctrlcctrlv/kitty 2021-11-28 18:57:25 +05:30
Fredrick Brennan
afbaa36fd3 Document GPU power saving affecting kitty startup 2021-11-28 08:10:45 -05:00
Kovid Goyal
346ea8c8a0 Forgot to ad dmethod in previous commit 2021-11-28 12:01:09 +05:30
Kovid Goyal
4448444d4b Fix #4289 2021-11-28 11:47:25 +05:30
Kovid Goyal
daefb926d9 Fix zsh kitty completion when the matching style includes anchor based matchers
Debian apparently adds these by default.
2021-11-28 11:02:03 +05:30
Kovid Goyal
0a5c73dee4 Ignore errors when getting screen size for zsh completion output serialization 2021-11-28 10:35:44 +05:30
Kovid Goyal
cb09ae3e84 ... 2021-11-28 10:23:32 +05:30
Kovid Goyal
3d76c916a5 Simplify zsh shell integration code
Use the add-zsh-hook and add-zle-hook-widget functions
2021-11-28 08:45:53 +05:30
Kovid Goyal
0a5ffe9b73 Add a note about _ksi_first_run 2021-11-28 08:14:16 +05:30
Kovid Goyal
325603bf41 Shell integration zsh: Handle the case when a function that breaks prompt marking is installed after _ksi_precmd
We now install the real precmd hook only in the first run of the precmd
hook. This ensures that our precmd and preexec hooks are run last,
unless something else uses this trick, which is unlikely, and at that
point, the user is on their own.

Also ensure that the integration script is run only once even if the
user tries to source it twice with setting of KITTY_SHELL_INTEGRATION
each time.
2021-11-27 12:24:19 +05:30
Kovid Goyal
3e3744753d DRYer 2021-11-27 11:13:26 +05:30
Kovid Goyal
5bc2fa187c Change the order of file checks since .zshrc is most likely to exist 2021-11-27 10:27:51 +05:30
Kovid Goyal
0a9005f5ce Allow zsh-newuser-install to run
Shell integration wont be turned on for an unconfigured zsh
2021-11-27 10:21:39 +05:30
Kovid Goyal
5d491b8067 Fix include path for new kitty.zsh location 2021-11-27 08:03:43 +05:30
Kovid Goyal
16b4a4fa80 Forgot to change test for new zsh shell integration code 2021-11-27 07:49:32 +05:30
Kovid Goyal
f6e0eb4005 Shell integration: Dont modify ~/.zshrc
Instead use the ZDOTDIR env var to load the shell integration code
2021-11-27 07:19:59 +05:30
Kovid Goyal
a3370a1d18 Document the delta transmission protocol 2021-11-26 15:08:18 +05:30
Kovid Goyal
2770a853f6 Merge branch 'docs-kbd' of https://github.com/page-down/kitty 2021-11-26 07:54:47 +05:30
pagedown
bd4399b5fc ... 2021-11-26 09:26:07 +08:00
Kovid Goyal
432df2089c Merge pull request #4277 from kovidgoyal/imgbot
[ImgBot] Optimize images
2021-11-25 11:14:43 +05:30
ImgBotApp
d9d922546f [ImgBot] Optimize images
*Total -- 1,755.23kb -> 1,446.79kb (17.57%)

/logo/kitty.svg -- 8.90kb -> 5.57kb (37.39%)
/docs/screenshots/transfer.png -- 31.21kb -> 22.24kb (28.73%)
/docs/screenshots/themes.png -- 139.72kb -> 110.23kb (21.1%)
/logo/beam-cursor@2x.png -- 1.47kb -> 1.19kb (18.76%)
/docs/screenshots/screenshot.png -- 1,178.10kb -> 958.20kb (18.67%)
/docs/screenshots/remote_file.png -- 54.77kb -> 45.50kb (16.93%)
/docs/screenshots/hints_mode.png -- 61.53kb -> 52.64kb (14.45%)
/docs/screenshots/unicode.png -- 87.86kb -> 75.63kb (13.92%)
/docs/screenshots/panel.png -- 11.81kb -> 10.49kb (11.21%)
/docs/screenshots/diff.png -- 131.05kb -> 118.51kb (9.57%)
/docs/screenshots/splits.png -- 42.34kb -> 40.15kb (5.17%)
/logo/kitty-framed.svg -- 6.49kb -> 6.45kb (0.59%)

Signed-off-by: ImgBotApp <ImgBotHelp@gmail.com>
2021-11-25 05:39:11 +00:00
Kovid Goyal
00167cd9ab Merge branch 'docs-kbd' of https://github.com/page-down/kitty 2021-11-25 10:58:29 +05:30
pagedown
1692516955 ... 2021-11-25 13:24:46 +08:00
Kovid Goyal
0bcf73f980 ... 2021-11-25 10:35:53 +05:30
Kovid Goyal
e68914f46b Rationalize usage of :kbd: 2021-11-25 10:34:25 +05:30
Kovid Goyal
fd331480fc ... 2021-11-25 10:11:12 +05:30
Kovid Goyal
ccf4a0e5e5 Merge branch 'docs-modifier-keys' of https://github.com/page-down/kitty 2021-11-25 10:10:47 +05:30
pagedown
77aa3e7e11 Use Unicode characters for modifier keys 2021-11-25 12:00:36 +08:00
pagedown
716d588ba9 Add command modifier key full name and unicode for ctrl and shift 2021-11-25 11:57:26 +08:00
Kovid Goyal
83041b1c97 Fix #4273 2021-11-25 08:02:49 +05:30
Kovid Goyal
e6311edf53 ... 2021-11-24 19:52:22 +05:30
Kovid Goyal
617316e8d9 Linux: Use copy_file_range for defrag of the disk cache which should give even better performance on filesystems that support it 2021-11-24 19:42:00 +05:30
Kovid Goyal
bd21b79959 Only malloc the buffer for fast file copy when needed 2021-11-24 18:20:37 +05:30
Kovid Goyal
732ff7ee58 Move copy between files into its own module 2021-11-24 16:42:52 +05:30
Kovid Goyal
f081d6a421 Fix #4270 2021-11-24 16:37:27 +05:30
Kovid Goyal
3592a94517 Document the handling of links in the file transfer protocol 2021-11-24 09:03:59 +05:30
Kovid Goyal
e5de16bb01 Use fid_abs prefix for absolute symlinks 2021-11-24 08:41:16 +05:30
Kovid Goyal
a62e831932 Clear prompt markings when erasing the display
Fixes prompt detection failing after ctrl+l
2021-11-24 08:17:04 +05:30
Kovid Goyal
b35dd5a869 Mention updated packager notes in changelog 2021-11-24 08:05:10 +05:30
Kovid Goyal
ec28bd93c3 Minor updates to file transfer protocol docs 2021-11-23 22:29:30 +05:30
Kovid Goyal
c44b5bb03f Allow aliases to apply to default shortcuts as well
The extra reparse costs 0.5ms at startup on my machine and is only incurred if
at least one alias is actually defined.
2021-11-23 20:24:12 +05:30
Kovid Goyal
313add715c Use original definition for no-op 2021-11-23 19:51:25 +05:30
Kovid Goyal
56ea741126 Nicer repr for key definitions 2021-11-23 18:19:34 +05:30
Kovid Goyal
9dbdd58311 Avoid spurious exception printed to stderr when terminating a key sequence with an invalid key 2021-11-23 16:29:10 +05:30
Kovid Goyal
2ca13e886a Avoid cyclic infinite recursion
Note that this means that any alias is only expanded once per action
2021-11-23 15:36:58 +05:30
Kovid Goyal
314efe4f68 Ignore empty alias 2021-11-23 15:10:59 +05:30
Kovid Goyal
ebd2de042d Merge branch 'docs-conf-fmt' of https://github.com/page-down/kitty 2021-11-23 15:07:28 +05:30
Kovid Goyal
c46c551fee ... 2021-11-23 15:07:03 +05:30
Kovid Goyal
cecca854c0 Forgot to port parsing of open actions to use the new action_alias infra 2021-11-23 15:02:19 +05:30
Kovid Goyal
d7df4fa5dc Leave kitten_alias documented 2021-11-23 14:48:45 +05:30
pagedown
3651a101d0 Append long_text only if at least one documented option exists 2021-11-23 17:15:58 +08:00
Kovid Goyal
a97a05b1ec Allow action_alias to work with any action 2021-11-23 14:43:36 +05:30
Kovid Goyal
ee2520e036 Also prevent infinite recursion in kitten_alias 2021-11-23 07:53:40 +05:30
Kovid Goyal
88150b2012 Dont document kitten_alias as it is deprecated 2021-11-22 23:04:59 +05:30
Kovid Goyal
9161c71b51 Show the user an error message when pressing a key results in an exception 2021-11-22 23:01:44 +05:30
Kovid Goyal
d7f569b341 Add a test for recursion 2021-11-22 22:54:21 +05:30
Kovid Goyal
5dfa02b45f Better fix for infinite recursion 2021-11-22 22:44:41 +05:30
Kovid Goyal
45e629c56b Avoid infinite recursion for action_alias 2021-11-22 22:43:06 +05:30
Kovid Goyal
ee437ca2d7 Add a note about kitten invocation 2021-11-22 22:38:56 +05:30
Kovid Goyal
0293d957b2 When using combine to perform multiple actions, perform subsequent actions on event loop ticks, so that they can operate on the result of the previous action
This brings combine into line with open_actions
2021-11-22 22:20:28 +05:30
Kovid Goyal
89069407d2 Make action_alias recursive 2021-11-22 22:15:04 +05:30
Kovid Goyal
495b29bf21 Make nth_window focus the last window for numbers larger than the number of windows
Fix #4262
2021-11-22 22:02:07 +05:30
Kovid Goyal
ec5165d958 Fix action_alias not working when used with arguments 2021-11-22 21:41:55 +05:30
Kovid Goyal
1da8ad3839 Fix some type errors 2021-11-22 21:16:09 +05:30
Kovid Goyal
e97afb3433 Make the repr of SingleKey shorter 2021-11-22 20:40:42 +05:30
Kovid Goyal
a824a45602 Merge branch 'docs-conf-fmt' of https://github.com/page-down/kitty 2021-11-22 20:17:47 +05:30
pagedown
20e546b496 Formatting config options that are not added to default 2021-11-22 22:39:19 +08:00
Kovid Goyal
bf8e18441a Map action URLs automatically for all actions 2021-11-22 20:05:27 +05:30
Kovid Goyal
c5af9613fd Fix building of docs 2021-11-22 20:02:18 +05:30
Kovid Goyal
9ce807069a Replace kitten_alias with action_alias in docs 2021-11-22 19:57:54 +05:30
Kovid Goyal
aa4fa4cc85 Allow defining aliases for more general actions, not just kittens
Fixes #4260
2021-11-22 19:52:43 +05:30
Kovid Goyal
727c69ffdd Mark :code: in CLI help output 2021-11-21 22:44:43 +05:30
Kovid Goyal
b7a28afe7e missed a couple of options 2021-11-21 22:41:30 +05:30
Kovid Goyal
12bcee3b78 Fix #4258 2021-11-21 22:39:36 +05:30
Kovid Goyal
f3376601f2 Mark various options in text correctly 2021-11-21 22:37:11 +05:30
Kovid Goyal
ecea1ba241 ... 2021-11-21 10:05:47 +05:30
Kovid Goyal
81467c2e7e ... 2021-11-20 07:36:52 +05:30
Kovid Goyal
889f2fce6d Avoid deprecation warning from Apple
Apparently Apple invent half-assed language extensions like @available
and then dont implement them properly
2021-11-20 06:08:30 +05:30
Kovid Goyal
ae6318cb5a Forgot to add definitions of the notification constants for old SDKs 2021-11-20 04:58:53 +05:30
Kovid Goyal
19e653ef1b Fix building on older macOS SDKs 2021-11-20 04:42:01 +05:30
Kovid Goyal
d6949a7a3c ... 2021-11-19 22:52:57 +05:30
Kovid Goyal
5050a01856 Update shell integration features list 2021-11-19 22:51:40 +05:30
Kovid Goyal
564f865a63 Fix the :italic: role used for CLI docs not being rendered correctly in the HTML docs 2021-11-19 14:28:05 +05:30
Kovid Goyal
c1cb196365 Set the media role when playing the bell sound to "event"
Fixes #4256
2021-11-19 14:14:50 +05:30
Kovid Goyal
ca0fcada42 Merge branch 'feat-macos-notif-snd' of https://github.com/page-down/kitty 2021-11-19 12:33:34 +05:30
pagedown
8e87b639fa Use macOS 11.0 version number 2021-11-19 14:41:19 +08:00
pagedown
fccba24f0b Allow macOS notification to play sound 2021-11-19 14:41:18 +08:00
Kovid Goyal
62e32ea108 More clarification on windows' file permissions 2021-11-19 10:10:14 +05:30
Kovid Goyal
b17fe747fc Document the representation of file metadata 2021-11-19 10:02:52 +05:30
Kovid Goyal
ccc2d7d2da Document file compression 2021-11-19 09:21:09 +05:30
Kovid Goyal
a528b45d60 More transfer protocol docs 2021-11-19 09:09:01 +05:30
Kovid Goyal
0c84285473 Note chunk size in both modes 2021-11-18 23:04:07 +05:30
Kovid Goyal
1df7400ad5 And an example serialization 2021-11-18 23:01:35 +05:30
Kovid Goyal
1cb65438fe ... 2021-11-18 22:54:55 +05:30
Kovid Goyal
cd5dd131d5 Explain shortening of key names during serialization 2021-11-18 22:54:35 +05:30
Kovid Goyal
f0e8ab8f31 Drop support for python 3.6
It is being EOLed next month (https://www.python.org/dev/peps/pep-0494/)
which is when I expect the next kitty release as well
2021-11-18 22:44:41 +05:30
Kovid Goyal
bfdb09d29f ... 2021-11-18 22:34:58 +05:30
Kovid Goyal
a81e5dd8a5 More documentation of the file transfer protocol 2021-11-18 22:33:25 +05:30
Kovid Goyal
ddb1fcf430 Forgot to end receive sessions 2021-11-18 22:31:05 +05:30
Kovid Goyal
646726b385 ... 2021-11-18 21:23:20 +05:30
Kovid Goyal
d47a80c8e8 Document the escape code format for the file transmission protocol 2021-11-18 21:19:56 +05:30
Kovid Goyal
5f4e326985 Start work on documenting the file transfer protocol 2021-11-18 20:33:06 +05:30
Kovid Goyal
18e747babf Merge branch 'ibus_move_overlay_linefeed' of https://github.com/martinetd/kitty 2021-11-18 12:29:28 +05:30
Kovid Goyal
a3ec988d07 Old python compat 2021-11-18 12:28:03 +05:30
Dominique Martinet
b992a448b1 screen_linefeed: add missing MOVE_OVERLAY_LINE_WITH_CURSOR
fixes ibus positioning problem when shell outputs text with pre-edit
overlay open as per suggestion in this comment:
https://github.com/kovidgoyal/kitty/issues/1000#issuecomment-972550266
2021-11-18 14:31:57 +09:00
Kovid Goyal
c29f50b0d6 Use shorter field names when serializing file transmission commands to reduce overhead 2021-11-18 10:55:57 +05:30
Kovid Goyal
d30ba9654f Nicer formatting of mappings in the comment conf file 2021-11-18 09:21:24 +05:30
Kovid Goyal
3e3dc26e3f Dont duplicate help text 2021-11-18 08:50:43 +05:30
Kovid Goyal
a78138ab61 Add a reference to ctrl+shift+right click in the overview 2021-11-18 08:42:30 +05:30
Kovid Goyal
8fd5f184b7 Merge branch 'feat-cmd-output-mouse-pager' of https://github.com/page-down/kitty 2021-11-18 08:27:11 +05:30
pagedown
fe075ea795 Unset the last visited command output position 2021-11-17 23:00:27 +08:00
pagedown
37b6677608 ... 2021-11-17 22:34:45 +08:00
pagedown
b91809eaa4 Allows to open the command output in pager by mouse click 2021-11-17 22:25:49 +08:00
Kovid Goyal
ca214ffe78 transfer receive: ensure open files are closed 2021-11-17 15:45:13 +05:30
Kovid Goyal
715925795f Ignore errors in various finalizers during exit
This was needed for tui loop to exit cleanly when terminal i/o breaks
2021-11-17 15:43:26 +05:30
Kovid Goyal
17a48f6b9f TUI: exit cleanly when I/O to terminal fails 2021-11-17 15:33:23 +05:30
Kovid Goyal
5c7a1d1b05 Fix typo 2021-11-17 15:19:17 +05:30
Kovid Goyal
46e51811e8 Dont rise an exception in patchfile close()
This allows partial transfers, by overwriting the dest file with the
tempfile even if the transfer was not completed
2021-11-17 14:34:14 +05:30
Kovid Goyal
34df7f6bc8 More docs on file transfer 2021-11-17 14:29:06 +05:30
Kovid Goyal
e8331b23d9 More file transfer docs 2021-11-17 14:12:10 +05:30
Kovid Goyal
1a92f99831 ... 2021-11-17 13:55:33 +05:30
Kovid Goyal
6c95828e6e Add a screenshot of the transfer kitten 2021-11-17 13:26:22 +05:30
Kovid Goyal
14142c320a fix incorrect repeat counts 2021-11-17 13:24:35 +05:30
Kovid Goyal
727260e69b ... 2021-11-17 13:16:50 +05:30
Kovid Goyal
ad804cc01e Redraw progress bar on resize 2021-11-17 13:04:07 +05:30
Kovid Goyal
dab51d33f5 ... 2021-11-17 12:40:06 +05:30
Kovid Goyal
77d7a6180f unicode input kitten: Also allow using ctrl+number to switch tabs and pressing any modifier with the function keys 2021-11-17 12:17:46 +05:30
Kovid Goyal
185669ec72 Use a shorter random id for transfers
Reduces overhead and we dont actually need protection against malicious
actors, only accidental collisions
2021-11-17 11:47:46 +05:30
Kovid Goyal
e68debc94e Handle blocking io errors when writing all to an fd 2021-11-17 11:45:15 +05:30
Kovid Goyal
18ed56b639 Handle all failed using rsync while waiting for path confirmation 2021-11-17 11:28:19 +05:30
Kovid Goyal
dc2bac0068 Only print rsync stats if some data was transferred 2021-11-17 11:18:31 +05:30
Kovid Goyal
005ab58b15 Fix single file transfer path name mapping for receive 2021-11-17 11:07:50 +05:30
Kovid Goyal
c0ff12a7de ... 2021-11-17 10:46:33 +05:30
Kovid Goyal
b11b04ef67 Start documenting the file transfer kitten 2021-11-17 10:33:37 +05:30
Kovid Goyal
c8aba303e8 Merge branch 'docs-ksi' of https://github.com/page-down/kitty 2021-11-16 22:25:18 +05:30
pagedown
555efa4b70 Docs: scrolling to the last jumped position 2021-11-17 00:31:03 +08:00
Kovid Goyal
da3c6945ae There is no need to modify metadata.json when submitting a new theme as that is done by the gen-metadata.py script when merging 2021-11-16 21:46:46 +05:30
Kovid Goyal
12c8fe32d5 Merge branch 'doc/contributing-themes' of https://github.com/erincerys/kitty 2021-11-16 21:42:54 +05:30
Kovid Goyal
053d9df0fe ... 2021-11-16 21:41:21 +05:30
Kovid Goyal
595ab448be Merge branch 'doc/build-deps' of https://github.com/erincerys/kitty 2021-11-16 21:39:50 +05:30
Kovid Goyal
86fec106e0 Document the new ways to browse command output 2021-11-16 21:37:08 +05:30
erin
b9b50bf7b4 Improve doc on building from source
- Reformat build-time dependency list for readability
- Add build-time package dep of librsync-dev
2021-11-16 07:58:02 -08:00
erin
9abd5bf743 Improve theming doc's contriubting section
- Add link to metadata file
- Add link to working with pull requests
- Elaborate on the minutiae of steps involved
2021-11-16 07:52:21 -08:00
Kovid Goyal
31bf212a60 Merge branch 'feat-cmd-output-mouse-sel' of https://github.com/page-down/kitty 2021-11-16 21:21:26 +05:30
Kovid Goyal
624ef272fd Merge branch 'nvim_move_overlay_line' of https://github.com/pjm0616/kitty 2021-11-16 21:18:28 +05:30
Park, Jeongmin
7c59afbca9 Also move overlay line for CSI ECH,DCH
Without this Neovim banner might not be properly cleared when overlay
text is active.
2021-11-17 00:27:13 +09:00
Kovid Goyal
67a92d7dc2 Fix iterating over nested directories of depth > 1 2021-11-16 20:50:09 +05:30
pagedown
369f4125e1 ... 2021-11-16 20:56:57 +08:00
pagedown
aebf654e15 Add command output mouse selection 2021-11-16 18:15:53 +08:00
Kovid Goyal
d936ede790 Finish up rsync for file receives 2021-11-16 15:10:37 +05:30
Kovid Goyal
cd4ded6132 More type checkable code 2021-11-16 14:33:37 +05:30
Kovid Goyal
1603b4b522 More work on rsync based receive 2021-11-16 14:21:42 +05:30
Kovid Goyal
0eac514e52 More rsync integration work 2021-11-16 13:06:16 +05:30
Kovid Goyal
63399fe975 Start work on rsync integration for receiving files 2021-11-16 10:58:32 +05:30
Kovid Goyal
bc03b4dff6 Add a screenshot of the themes kitten 2021-11-15 19:16:24 +05:30
Kovid Goyal
cb2a99bd0e Merge branch 'def-conf-shortcuts' of https://github.com/page-down/kitty 2021-11-15 17:15:44 +05:30
Kovid Goyal
2cc3922108 Resizing the screen does not cause multiple consecutive output start anymore 2021-11-15 15:17:34 +05:30
Kovid Goyal
e771e1ea8a Do not call range_line_() with unsafe parameters in find_cmd_output 2021-11-15 15:17:34 +05:30
Kovid Goyal
6afaec1d62 Use a single function for getting command output 2021-11-15 15:17:34 +05:30
Kovid Goyal
80b5f31256 Cleanup handling of types of kitten input 2021-11-15 15:17:34 +05:30
Kovid Goyal
c96e6822e1 Dont rely on historybuf->count being a constant
This may become dynamically resizable someday
2021-11-15 15:17:34 +05:30
pagedown
e4781b8af0 ... 2021-11-15 15:17:34 +05:30
pagedown
f3dd2a8bfd Get the first command output on screen and the last scrolled one 2021-11-15 15:17:33 +05:30
pagedown
9fe9c74021 Save the last jumped prompt position 2021-11-15 15:17:33 +05:30
pagedown
09c6c3e804 Unify modifier keys ordering ctrl+shift+alt/opt+cmd, and names 2021-11-15 17:38:07 +08:00
pagedown
f5023e3269 Unify option key names, abbreviations, and ordering 2021-11-15 17:26:37 +08:00
pagedown
2db7f559e3 Add the option key abbreviation opt 2021-11-15 17:22:20 +08:00
pagedown
b696d3f960 Include all default shortcuts in the commented config 2021-11-15 17:05:45 +08:00
Kovid Goyal
bc454b4417 Fix --long-opt= completion for bash as well 2021-11-14 13:35:36 +05:30
Kovid Goyal
aa6a800d1a Fix completion for --long-opt= form on zsh 2021-11-14 13:28:09 +05:30
Kovid Goyal
536d6e00d9 Further simplify logic for PUA space ligatures 2021-11-14 12:47:54 +05:30
Kovid Goyal
725a04b321 Fix #4236 2021-11-14 12:42:08 +05:30
Kovid Goyal
3ff8cc58e1 Ignore invalid unicode condepoints in command lines 2021-11-14 11:59:02 +05:30
Kovid Goyal
4fc8267264 Fix #4235 2021-11-14 10:23:42 +05:30
Kovid Goyal
0965fc45f2 macOS: Fix keyboard input not working after toggling traditional fullscreen till the window is clicked in 2021-11-13 14:20:18 +05:30
Kovid Goyal
181178b0ea macOS: use a consistent technique to get window size
This fixes an issue where restoring from traditional fullscreen to a
maximized state was resulting in an incorrectly sized frame buffer. Now
all framebuffer and window size calculation happens in the same way in
all the various glfw codepaths that do it.
2021-11-13 13:42:12 +05:30
Kovid Goyal
95e6e80921 Restore maximized window state when returning from fullscreen 2021-11-13 12:22:52 +05:30
Kovid Goyal
f36b71350d Use an anonymous struct for before_fullscreen 2021-11-13 12:15:27 +05:30
Kovid Goyal
3483722475 Remove pointless code 2021-11-13 12:13:28 +05:30
Kovid Goyal
56e63baf5a macOS: manually trigger windowDidResize when fullscreening
Fixes #4230
Fixes #4229
2021-11-13 11:49:55 +05:30
Kovid Goyal
0830e66e76 broadcast kitten: Show a "fake" cursor in all windows being broadcast too
Fixes #4225
2021-11-12 22:59:20 +05:30
Kovid Goyal
74a5d3a25e allow multiple close and removal actions 2021-11-12 21:16:21 +05:30
Kovid Goyal
4fb29e1b6b Infrastructure to render the unfocused cursor in multiple windows 2021-11-12 20:42:37 +05:30
Kovid Goyal
2c4f616213 Make it easier to reuse collect_cursor_info() 2021-11-12 20:31:29 +05:30
Kovid Goyal
75afe7cd33 Also move overlay line when handling SGR 2021-11-12 19:56:44 +05:30
Kovid Goyal
80eb78033f Better name for macro
What it actually does is move the overlay line to the new cursor location
2021-11-12 19:51:28 +05:30
Kovid Goyal
68013e8fe7 Move overlay line for a few more commands 2021-11-12 19:38:54 +05:30
Kovid Goyal
7fe32301c4 Use __func__ instead of manually specifying function names 2021-11-12 19:23:09 +05:30
Kovid Goyal
41ddc7d33f DRYer 2021-11-12 18:26:18 +05:30
Kovid Goyal
eff5840645 overlay line should move even when using REP 2021-11-12 18:03:37 +05:30
Kovid Goyal
ddf0242f56 Add a changelog entry for IME changes 2021-11-12 17:58:05 +05:30
Kovid Goyal
eae5c65d3e Also move overlay when getting backspace from child
zsh for some reason sends this when you send it a word. Fixes #4219
2021-11-12 17:56:04 +05:30
Kovid Goyal
c85b545f8d Add a debug print when receiving text from child while overlay is active 2021-11-12 17:43:01 +05:30
Kovid Goyal
f24dc80c49 Send IME events in the correct sequence when cocoa both inserts text and marks new text in response to the same key event 2021-11-12 17:27:37 +05:30
Kovid Goyal
9a9de0038c Remove unused code 2021-11-12 15:10:33 +05:30
Kovid Goyal
35626d3929 Update IME position when overlay line is moved on input from child process 2021-11-12 15:07:25 +05:30
Kovid Goyal
c8f26dd968 When text is received from the terminal program and the overlay line is active move the overlay line after drawing the text
This ensures the overlay line follows the current cursor position
2021-11-12 15:03:24 +05:30
Kovid Goyal
7e5cb50925 macOS: Also update IME position when new window is focused 2021-11-12 09:22:36 +05:30
Kovid Goyal
ffa755c723 macOS: Ensure IME position is correct on startup 2021-11-12 09:18:34 +05:30
Kovid Goyal
a060bf7223 Also unmark text on pressing esc
As with backspace, without this the preedit text is not cleared when the
IME is canceled by esc
2021-11-12 08:52:32 +05:30
Kovid Goyal
4ab5d97e9b macOS: Fix IME position incorrect after moving OS window 2021-11-12 08:51:03 +05:30
Kovid Goyal
81babd29e7 DRYer 2021-11-11 22:53:24 +05:30
Kovid Goyal
fac76ddedd DRYer 2021-11-11 22:41:59 +05:30
Kovid Goyal
f34cc1861a Clear marked text when text is inserted
This is apparently what Cocoa expects. Fixes committing pre-edit text no
longer working.
2021-11-11 22:35:02 +05:30
Kovid Goyal
bd4ed38a3c Dump more informatin about what cocoa does when processing key events 2021-11-11 22:32:30 +05:30
Kovid Goyal
8644fed534 Only unmark on backspace key 2021-11-11 22:05:39 +05:30
Kovid Goyal
ca9fdadf3c Dont clear marked text on every keyDown event
Let the input system do it for us. That wy we can hopefully use calls to
unmarkText as a signal to commit the pre-edit text.

Hopefully not clearing the marked text on key down doesnt break anything
else.
2021-11-11 21:14:53 +05:30
Kovid Goyal
228364e317 oops 2021-11-11 20:53:14 +05:30
Kovid Goyal
e65aee4533 Cleanup calls to unmarkText 2021-11-11 20:44:43 +05:30
Kovid Goyal
a1ca607f35 More work on file transmission 2021-11-11 20:05:54 +05:30
Kovid Goyal
efbf156f82 Add a note about mintty support of unscroll 2021-11-11 16:53:59 +05:30
Kovid Goyal
a2533e9a46 Render the progress bar for file receives 2021-11-11 16:32:06 +05:30
Kovid Goyal
09742af92b Forgot to remove some debug prints 2021-11-11 14:42:11 +05:30
Kovid Goyal
880de53d59 When remembering OS window sizes for full screen windows use the size before the window became fullscreen
Fixes #4221
2021-11-11 14:34:02 +05:30
Kovid Goyal
91a24dd2eb oops 2021-11-11 13:56:18 +05:30
Kovid Goyal
60e91b018a Wrap the glfw is fullscreen API 2021-11-11 12:46:13 +05:30
Kovid Goyal
9be37f7d2d cocoa is weird 2021-11-11 12:45:03 +05:30
Kovid Goyal
be79fc1c92 Save before fullscreen sizes even when using normal fullscreen on macOS 2021-11-11 12:40:56 +05:30
Kovid Goyal
502960bfeb Forgot to update the GLFW wrappers 2021-11-11 12:34:57 +05:30
Kovid Goyal
d95a00df73 GLFW API to check if window is fullscreen 2021-11-11 12:33:12 +05:30
Kovid Goyal
b3a9c1a100 Better error message when KITTY_LISTEN_ON is invalid 2021-11-10 08:27:45 +05:30
Kovid Goyal
4318d2d7d0 Cleanup previous PR
Doesnt need a separate changelog entry as its covered by the entry for
focus_visible_window
2021-11-09 22:23:48 +05:30
Kovid Goyal
c3ff888981 Merge branch 'feat-vis-sel-custom-chars' of https://github.com/page-down/kitty 2021-11-09 22:10:00 +05:30
Kovid Goyal
7c85616dcf Add a note about arguments to layout_action rotate 2021-11-09 21:33:55 +05:30
pagedown
353a48d913 Allows to configure the characters for visual window select 2021-11-09 21:05:31 +08:00
Kovid Goyal
4e736e83a3 Also release excess memory from pagerhist buffer when clearing 2021-11-09 10:21:47 +05:30
Kovid Goyal
57583d6b00 When clearing scrollback release used memory beyond ~2000 lines 2021-11-09 10:14:52 +05:30
Kovid Goyal
98dcb32a0c Dedicated function to free a segment 2021-11-09 10:07:14 +05:30
Kovid Goyal
fba5e3a46d Add note for packagers to create kitty shell integration package for servers 2021-11-08 11:56:08 +05:30
Kovid Goyal
2122304515 Only run manual shell integration is KITTY_INSTALLATION_DIR is set
Also add a note about how to get it to work with SSH.
2021-11-08 11:50:21 +05:30
Kovid Goyal
80dbebf0ad Remove unused code 2021-11-08 11:43:14 +05:30
Kovid Goyal
0c160eab7b Avoid needing to exec kitty to get manual shell integration 2021-11-08 11:37:50 +05:30
Kovid Goyal
4841502959 Use a single kitty invocation for manual shell integration 2021-11-08 11:27:10 +05:30
Kovid Goyal
8218df82f2 Add function to get path to integration script for the current shell
Makes setting up manual shell integration much easier. Also clean up
integration docs.
2021-11-08 11:11:16 +05:30
Kovid Goyal
fadc1b539b Merge branch 'docs-ksi-fish' of https://github.com/page-down/kitty 2021-11-08 10:24:49 +05:30
pagedown
c8162324ed ... 2021-11-08 11:36:40 +08:00
pagedown
2c46378886 Add how the fish shell integration works and how to configure it manually 2021-11-08 11:26:15 +08:00
Kovid Goyal
cf7e43fa26 Simplify nested if 2021-11-07 19:23:31 +05:30
Kovid Goyal
b5e8b5a124 Allow users to modify XDG_DATA_DIRS in the fish rc files
The only downside of this new technique is that it is no
longer possible to set XDG_DATA_DIRS to an empty var in kitty.conf
Since an empty XDG_DATA_DIRS breaks lots fo things, I dont think that
is a big concern.
2021-11-07 18:59:50 +05:30
Kovid Goyal
6fa0a21b3c Cancel visual select when its OS Window or Tab is closed 2021-11-07 18:12:50 +05:30
Kovid Goyal
c43637f6cc Dont copy prompt start bits to multiple lines when resizing the screen
This makes it unnecessary to modify the prompt marking protocol to
distinguish consecutive prompts without output in between
2021-11-07 18:00:06 +05:30
Kovid Goyal
f48a430493 Use --global when re-exporting XDG_DATA_DIRS 2021-11-07 10:31:57 +05:30
Kovid Goyal
a1eb341817 ... 2021-11-07 10:25:13 +05:30
Kovid Goyal
cc2419911c shell environ modification should only happen for actual shell processes 2021-11-07 10:22:37 +05:30
Kovid Goyal
2f5d3b073d Ignore exceptions in the environment modifier 2021-11-07 10:13:09 +05:30
Kovid Goyal
4c0a7a9566 KSI should be set even when no-rc is specified 2021-11-07 10:10:19 +05:30
Kovid Goyal
35514e0cc3 Dont change XDG_DATA_DIRS for child processes in fish shell integration
Fixes #4199
2021-11-07 10:06:18 +05:30
Kovid Goyal
0f23edeec3 Fix breakage caused by Color no longer being iterable 2021-11-07 07:15:55 +05:30
Kovid Goyal
69e54cb9c1 More work on file transfer 2021-11-06 20:11:11 +05:30
Kovid Goyal
60b8023928 Ensure transfer is canceled on error 2021-11-06 12:59:13 +05:30
Kovid Goyal
8099ae44d7 create fid_map after collecting files not before 2021-11-06 12:54:20 +05:30
Kovid Goyal
46f88494e3 Merge branch 'feat-sel-win-reactivate-prev-tab' of https://github.com/page-down/kitty 2021-11-06 11:44:40 +05:30
Kovid Goyal
4818ac0750 More consistent method naming 2021-11-06 11:35:08 +05:30
Kovid Goyal
d96429e6b8 When handling mouse events in visual select mode cancel the visual select if the original tab is not active any more 2021-11-06 11:34:22 +05:30
Kovid Goyal
9cda076c93 Fix restoring of OS window title after visual selection 2021-11-06 11:28:56 +05:30
Kovid Goyal
d30c761b3b A new mappable action to close windows with a confirmation
Fixes #4195
2021-11-06 11:09:41 +05:30
Kovid Goyal
49a0e8e242 Move close_window from Tab to Boss
We might eventually implement OS Window level floating windows
and the close_window action actually used the Boss method anyway
2021-11-06 10:45:07 +05:30
Kovid Goyal
8630c7a700 Fix canceling the select window overlay not calling the callback in stack layout 2021-11-06 10:28:34 +05:30
Kovid Goyal
905fbeec14 Fix cancelling visual select not working in stack layout 2021-11-06 10:25:10 +05:30
Kovid Goyal
e1ec8dfe4f Merge branch 'docs-confirm-os-win-close' of https://github.com/page-down/kitty 2021-11-06 09:38:40 +05:30
pagedown
93558f75f2 Docs: Explicitly clarify the scope of confirm_os_window_close in effect 2021-11-06 10:19:47 +08:00
pagedown
7a66c1a01c Allow select-window to reactivate previously activated tab 2021-11-06 09:32:36 +08:00
Kovid Goyal
9f7b975064 Handle timeout errors in the shell 2021-11-05 23:53:29 +05:30
Kovid Goyal
8e8a0d2df6 Fix rel path logic when transferring symlinks 2021-11-05 21:39:07 +05:30
Kovid Goyal
d9f4fadf2d More work on file transfer 2021-11-05 21:33:47 +05:30
Kovid Goyal
3f3fe6b178 Merge branch 'minor-tweaks' of https://github.com/page-down/kitty 2021-11-05 17:16:12 +05:30
pagedown
2e95cd7a62 Docs: Describes the priority order of auto bold fonts 2021-11-05 18:15:29 +08:00
pagedown
9be7345ba6 Capitalize menu item and adjust the order of menu items following the convention 2021-11-05 18:15:29 +08:00
Kovid Goyal
950edb1110 Fix symlink transmission 2021-11-05 13:18:58 +05:30
Kovid Goyal
c4b3723372 More work on file transfer 2021-11-05 13:10:04 +05:30
Kovid Goyal
119841a2c4 Respect --no-response in the kitty shell 2021-11-04 19:07:07 +05:30
Kovid Goyal
2df6f9cdda Fix select-window in the kitty shell 2021-11-04 18:56:20 +05:30
Kovid Goyal
55868da9d3 DRYer 2021-11-04 18:01:54 +05:30
Kovid Goyal
460373803d Merge branch 'fix-get-colors' of https://github.com/page-down/kitty 2021-11-04 18:01:13 +05:30
pagedown
abf9cce6bf When the color is set to none get-colors should not return a color value 2021-11-04 18:27:55 +08:00
Kovid Goyal
d9c400ac32 Forgot to recalculate height_gl leading to vertically stretched characters for window numbers 2021-11-04 08:53:17 +05:30
Kovid Goyal
377607730c Forgot to set the x-axis origin when rendering the glyph, causing right side cut-off 2021-11-03 20:57:05 +05:30
Kovid Goyal
6da5a8073c Wayland: Apparently Java doesnt even set text/plain as a mimetype when copying text. Instead it uses UTF8_STRING and STRING.
So check for those as well. Am guessing whoever wrote this code in Java
just copied their old X11 shit without checking the specs. See #4183
2021-11-03 20:46:33 +05:30
Kovid Goyal
68ad513dd5 Merge branch 'fix-set-colors-err-msg' of https://github.com/page-down/kitty 2021-11-03 11:42:52 +05:30
pagedown
40ff78b1c8 Handle set colors exceptions 2021-11-03 12:55:05 +08:00
Kovid Goyal
477baf390b DRYer 2021-11-03 09:32:49 +05:30
Kovid Goyal
76834c0975 Merge branch 'feat-visual-bell-color' of https://github.com/page-down/kitty 2021-11-03 09:13:27 +05:30
pagedown
a3b7a88e9c ... 2021-11-03 10:17:55 +08:00
pagedown
ce36b09593 Visible bell color falls back to default fg when selection bg is none 2021-11-03 10:07:57 +08:00
Kovid Goyal
ebaac70b27 Fix #4183 (paste in wyland with mime type text/plain) 2021-11-03 07:00:06 +05:30
pagedown
b4a6ed8d8f Allows the visual bell color to be configured 2021-11-02 19:38:36 +08:00
Kovid Goyal
7c161f2d78 Check for actual executable when prepending the path 2021-11-02 15:36:03 +05:30
Kovid Goyal
39dcfb4e5d Auto generate the list of all color config keys 2021-11-02 15:16:55 +05:30
Kovid Goyal
34d87b7a72 Another stab at PATH manipulation 2021-11-02 14:43:20 +05:30
Kovid Goyal
f2d2cfec8f ... 2021-11-02 13:54:51 +05:30
Kovid Goyal
46625d207b Cleanup PATH manipulations 2021-11-02 08:57:44 +05:30
Kovid Goyal
f35112378f Merge branch 'dont-rely-on-nanosecond-resolution' of https://github.com/Luflosi/kitty 2021-11-02 07:53:12 +05:30
Luflosi
bb5ded4e65 Don't rely on nanosecond resolution when testing mtime transmission
Commit 85cea78b3c missed a couple instances where the mtime was not a multiple of 1µs.
See https://github.com/kovidgoyal/kitty/issues/4175.
2021-11-01 21:06:23 +01:00
Kovid Goyal
b2f406f021 put kitty in PATH before setting default env 2021-11-01 21:37:13 +05:30
Kovid Goyal
7821e2508c Cleanup previous PR 2021-11-01 20:52:55 +05:30
Kovid Goyal
3e6cfe3275 Merge branch 'fix-kitty-env-path' of https://github.com/page-down/kitty 2021-11-01 20:41:50 +05:30
Kovid Goyal
588313b9ac Dont re-render window chars unless needed 2021-11-01 20:38:19 +05:30
pagedown
50e4811e6d Make sure kitty is first in the PATH and not repeatedly added when it already exists 2021-11-01 22:37:31 +08:00
pagedown
c182f95684 Make --override parameter compatible with 'env VAR=' syntax 2021-11-01 22:37:30 +08:00
Kovid Goyal
c241524663 Implement rending of visual select chars on macOS 2021-11-01 15:34:38 +05:30
Kovid Goyal
9517c3500d Allow visually selecting upto 36 windows
Also dont draw the window title if the window is too small
2021-11-01 10:46:54 +05:30
Kovid Goyal
1b8978fede Implement rendering of ASCII char with FreeType 2021-11-01 10:17:26 +05:30
Kovid Goyal
5796cbc040 Remove the seven segment shader 2021-11-01 08:42:02 +05:30
Kovid Goyal
49726384f7 Start work on rendering visual select numbers using fonts instead of seven segment display 2021-11-01 08:40:03 +05:30
Kovid Goyal
e7386735f4 Make code to load alpha mask texture re-useable 2021-11-01 07:29:04 +05:30
Kovid Goyal
ddfa653197 resizing size text should be drawn with the current foreground color 2021-11-01 07:19:17 +05:30
Kovid Goyal
fffee1049f Function to get an alpha mask for a single char from freetype 2021-11-01 06:52:24 +05:30
Kovid Goyal
cc502163cb Use slots number for visual selection 2021-10-31 21:20:16 +05:30
Kovid Goyal
d53d92b890 Proper handling of async responses to peers 2021-10-31 21:09:24 +05:30
Kovid Goyal
218582ced8 More work on file transfer 2021-10-31 20:05:48 +05:30
Kovid Goyal
bc1c19b4f7 Merge branch 'fix-pager-cur-pos' of https://github.com/page-down/kitty 2021-10-31 19:18:29 +05:30
Kovid Goyal
85cea78b3c Use 13000 when testing mtime transmission as there exist some systems with a 1000ns resolution. See #4175 2021-10-31 19:13:55 +05:30
pagedown
7a9027a147 Do not report cursor position when the cursor is scrolled off the screen 2021-10-31 21:17:38 +08:00
Kovid Goyal
66db3f9764 Also sanitize various XDG* env vars when running the test suite 2021-10-31 16:21:33 +05:30
Kovid Goyal
7e84343f16 Merge branch 'remove-unused-code' of https://github.com/Luflosi/kitty 2021-10-31 16:18:37 +05:30
Luflosi
e82e57a30c Remove unused code
Since 99d9cb0b0d runs all tests with HOME set to a temporary directory, this code setting the cache directory to a temporary directory is no longer needed. `cache_dir()` will choose a directory in the home directory if neither KITTY_CACHE_DIRECTORY or XDG_CACHE_HOME are set.
2021-10-31 11:42:55 +01:00
Kovid Goyal
336c7ddca8 DRYer 2021-10-31 15:41:19 +05:30
Kovid Goyal
4ffcbc8274 Wake up talk loop when not sending response to peer 2021-10-31 15:22:22 +05:30
Kovid Goyal
22673ebd90 ... 2021-10-31 14:06:02 +05:30
Kovid Goyal
b1c0398bba Avoid unnecessary CPU churn when reading from stdin for @ send-text 2021-10-31 14:04:07 +05:30
Kovid Goyal
6310517ff2 @ send-text: Fix reading from stdin when RC is over a socket 2021-10-31 13:55:11 +05:30
Kovid Goyal
4ff3d6a645 More work on file transfer 2021-10-31 13:12:23 +05:30
Kovid Goyal
23570cc5f7 ... 2021-10-31 11:55:00 +05:30
Kovid Goyal
dc09a5183a Exclude the currently active window when visually selecting 2021-10-31 11:37:38 +05:30
Kovid Goyal
8458b9e7d6 Allow specifying a title for @ select-window 2021-10-31 11:08:28 +05:30
Kovid Goyal
51900996ea When selecting in stack dont exclude the active window 2021-10-31 11:05:00 +05:30
Kovid Goyal
663da130ae Show the choose msg in the OS Window title bar during a visual select 2021-10-31 11:01:34 +05:30
Kovid Goyal
c8b1724ecf Function to change OS Window title from python 2021-10-31 10:56:36 +05:30
Kovid Goyal
c289af8f07 When initiating a visual select make sure its tab is the active tab 2021-10-31 10:45:59 +05:30
Kovid Goyal
da7fa53b1a Consolidate visual select cleanup in one place
Also ensure callback is called even when only a single window is present
and when selecting in stack
2021-10-31 10:36:23 +05:30
Kovid Goyal
d160db1bcd ... 2021-10-31 10:20:27 +05:30
Kovid Goyal
a788cd9f64 Also clear the current visual select when selecting in stack layout 2021-10-31 10:15:06 +05:30
Kovid Goyal
6997e36670 ... 2021-10-31 10:11:50 +05:30
Kovid Goyal
1893b3ce0f Store visual select in flight information in a single object 2021-10-31 10:10:20 +05:30
Kovid Goyal
576abecf7d oops forgot to call cancel current visual select when starting a new one 2021-10-31 09:54:28 +05:30
Kovid Goyal
b9b799533b Eh, mypy doesnt let me ignore requests on CI 2021-10-31 09:40:03 +05:30
Kovid Goyal
70a01955b8 Fix timeout of @ select-window not canceling the visual select 2021-10-31 09:38:55 +05:30
Kovid Goyal
5f9409a91d Fix visual select failing if triggerred when there is already an active visual select 2021-10-31 09:32:12 +05:30
Kovid Goyal
32805ca968 More work on file transfer 2021-10-31 09:28:20 +05:30
Kovid Goyal
8dfb0c6675 Dont bother with type checking requests in the publish script 2021-10-31 09:25:39 +05:30
Kovid Goyal
7428d42c16 Restore environ after running tests 2021-10-31 09:20:06 +05:30
Kovid Goyal
99d9cb0b0d Run tests with HOME set to a tempdir 2021-10-31 08:20:46 +05:30
Kovid Goyal
80ab60f1b6 Merge branch 'fix-clang-warning' of https://github.com/Luflosi/kitty 2021-10-30 20:30:27 +05:30
Luflosi
a1d24028b8 Fix Clang warning
Without this, kitty fails to compile:
```
glfw/cocoa_init.m:462:14: error: case value not in enumerated type
      'NSEventModifierFlags' (aka 'enum NSEventModifierFlags')
      [-Werror,-Wswitch]
        case (NSEventModifierFlagShift | NSEventModifierFlagOption):
             ^
glfw/cocoa_init.m:465:14: error: case value not in enumerated type
      'NSEventModifierFlags' (aka 'enum NSEventModifierFlags')
      [-Werror,-Wswitch]
        case (NSEventModifierFlagShift | NSEventModifierFlagCommand):
             ^
```
I thought about changing the type of the `modifierFlags` function parameter from `NSEventModifierFlags` to `NSUInteger` since `NSEventModifierFlags` is defined as an enum according to https://developer.apple.com/documentation/appkit/nseventmodifierflags?language=objc and is technically not the proper type for a bit field. But since Apple themselves define `modifierFlags` as `NSEventModifierFlags` according to https://developer.apple.com/documentation/appkit/nsevent/1534405-modifierflags?language=objc, I think the fix in this commit is better.
This warning was introduced with commit f9944e6140.
2021-10-30 16:25:20 +02:00
Kovid Goyal
d03f4dbc98 More work on file transfer 2021-10-30 16:54:27 +05:30
Kovid Goyal
f1573654b9 Update changelog for previous PR 2021-10-30 15:16:11 +05:30
Kovid Goyal
e703103fa8 Merge branch 'bgimage-options' of https://github.com/itepechi/kitty into bg 2021-10-30 15:04:41 +05:30
Kovid Goyal
6241369b6c Cancel an async request on timeout so no spurious data is sent to the tty 2021-10-30 14:46:48 +05:30
Kovid Goyal
2a637e4220 Simplify sending of async response 2021-10-30 14:10:09 +05:30
Kovid Goyal
816360c275 A new remote control command to visually select a window
Fixes #4165
2021-10-30 13:56:48 +05:30
Kovid Goyal
c541d7e349 Document --self in the launch rc protocol 2021-10-30 12:36:58 +05:30
Kovid Goyal
df70d8661a Pass the peer id to commands 2021-10-30 12:29:27 +05:30
Kovid Goyal
c3daa969fa Allow individual commands to control the response timeout 2021-10-30 12:20:37 +05:30
Kovid Goyal
66a7c3bc4d Simplify handling of --no-response 2021-10-30 12:15:37 +05:30
Kovid Goyal
3553b3ce3d Pass the peer id to python for potentially async replies 2021-10-30 08:31:13 +05:30
itepechi
9289c2de69 Refactor background_image_anchor for cleaner code 2021-10-30 04:34:33 +09:00
itepechi
dac1612cb0 Calculate background image position on the GPU 2021-10-30 04:34:33 +09:00
itepechi
87d79c7415 Change the naming of directions in option background_image_anchor for consistency
Replaced cardinal directions with "relative" directions.
2021-10-30 04:34:33 +09:00
itepechi
86d7aaa03a Add clamped to option background_image_layout 2021-10-30 04:34:33 +09:00
itepechi
cae31ab336 Read/Write bganchor directly from the options' state
Slight performance improvement, maybe?
Also, `kitty/graphics.h` has been reverted to the original version;
this version would be better in that aspect too.
2021-10-30 04:34:32 +09:00
itepechi
2aa01c58a1 Add option background_image_anchor to configure bgimage position 2021-10-30 04:34:32 +09:00
Kovid Goyal
ee852cf5fc More work on file transmission 2021-10-29 21:52:49 +05:30
Kovid Goyal
5eb87b9f10 Micro-optimizations of fish sheel integration script
By @page-down
2021-10-29 21:51:48 +05:30
Kovid Goyal
820a893d75 More work on file transfer 2021-10-29 15:01:31 +05:30
Kovid Goyal
ce823e4b08 Fix incorrect scissoring for window resize counter
It uses draw_graphics, which uses a scissor, but the scissor was set by
the last call to draw_cells() which is not called during a resize,
leaving us with an incorrect scissor.

Fixes #4160
2021-10-28 21:45:15 +05:30
Kovid Goyal
21830048c9 Fix reading session from STDIN not working when used with --single-instance
Fixes #4155
2021-10-28 17:00:54 +05:30
Kovid Goyal
1251f9ec80 Keep the list of nullable colors up to date automatically 2021-10-28 15:21:42 +05:30
Kovid Goyal
4839cbe9d0 ... 2021-10-28 15:04:36 +05:30
Kovid Goyal
702bfccfa2 Allow reverse video for the mouse selection
Fixes #646
2021-10-28 15:01:48 +05:30
Kovid Goyal
28386cc496 Fix nulling selection_fg not working 2021-10-28 14:38:35 +05:30
Kovid Goyal
0c1a7347db Mark another nullable color 2021-10-28 14:38:09 +05:30
Kovid Goyal
c06a03ab96 Avoid very low contrast colors for reverse video cursor 2021-10-28 14:14:38 +05:30
Kovid Goyal
93dbcab10a Refactor code to get cell colors 2021-10-28 13:35:30 +05:30
Kovid Goyal
5f12fbc2ee Convenient aliases 2021-10-28 11:18:16 +05:30
Kovid Goyal
2443dc135c Use a faster implementation of the Color type
Now implemented in C
2021-10-28 11:15:13 +05:30
Kovid Goyal
40c046f86b ooops 2021-10-28 08:17:16 +05:30
Kovid Goyal
aee5c317f6 ... 2021-10-28 08:12:35 +05:30
Kovid Goyal
0fdafd8398 Allow rendering the cursor with reverse video
Also clean up handling of dynamic global colors.
TODO: Implement none for selection_fg
TODO: Add some tests
TODO: Check that changing colors via remote control works

Fixes #126
2021-10-28 00:21:12 +05:30
Kovid Goyal
3ca3c67828 Remove unused code 2021-10-27 17:15:45 +05:30
Kovid Goyal
336bc2c0e6 Update include path for fish integration script 2021-10-27 16:54:54 +05:30
Kovid Goyal
d3a3f99848 Use an env var for fish shell integration
Less intrusive (in some ways) than adding symlinks to ~/.config/fish
Exploits the fact that fish loads scripts from XDG_DATA_DIRS on startup.
Thanks to @page-down for noticing
2021-10-27 14:59:11 +05:30
Kovid Goyal
d31935b8eb Old python compat 2021-10-27 14:23:07 +05:30
Kovid Goyal
13928d4d35 When showing last command output and similar cursor less text with the scrollback pager set CURSOR_LINE and CURSOR_COLUMN to 0 2021-10-27 14:20:33 +05:30
Kovid Goyal
212af78032 Turn on strict checks for mypy 2021-10-27 14:00:38 +05:30
Kovid Goyal
60472fcee3 Add more type annotations 2021-10-27 14:00:29 +05:30
Kovid Goyal
c899eb4ee3 Add more type annotations 2021-10-27 13:44:12 +05:30
Kovid Goyal
d090db380f Add more type annotations 2021-10-27 13:26:18 +05:30
Kovid Goyal
a26f041964 Add more type annotations 2021-10-27 12:31:10 +05:30
Kovid Goyal
b22bda3cba Add more type annotations 2021-10-27 11:36:34 +05:30
Kovid Goyal
69e903a4c4 Add more type annotations 2021-10-27 11:13:28 +05:30
Kovid Goyal
6f19fd5912 Add more type annotations 2021-10-27 10:50:24 +05:30
Kovid Goyal
9c2f96f7eb Add more type annotations 2021-10-27 08:45:45 +05:30
Kovid Goyal
4494ddd8ff mypy: Turn on return value checks
Its a shame GvR is married to "return None"
https://github.com/python/mypy/issues/7511
2021-10-26 22:39:14 +05:30
Kovid Goyal
5cb36a4632 More work on file transfer 2021-10-26 22:05:38 +05:30
Kovid Goyal
9b7342b231 Mark output before running command
This will help with shell integration erasing the prompt if there is a
resize caused by the command
2021-10-25 20:40:55 +05:30
Kovid Goyal
01ebc8f15a Use a space as content placeholder when resizing 2021-10-25 20:05:26 +05:30
Kovid Goyal
472baf7337 DRYer 2021-10-25 18:12:48 +05:30
Kovid Goyal
c381716ecf Specify we need alpha as well 2021-10-25 17:15:46 +05:30
Kovid Goyal
0e08c6c660 Fix a one pixel line not being drawn at the bottom edge of the fat and tall layouts 2021-10-25 15:28:49 +05:30
Kovid Goyal
6da79ab614 Reset draw data default bg when background is changed 2021-10-25 12:40:36 +05:30
Kovid Goyal
a44a3195ab Ensure border rects are updated when patching colors 2021-10-25 12:37:29 +05:30
Kovid Goyal
f78feb5abf Allow very long middle clicks to close tabs 2021-10-25 12:23:54 +05:30
Kovid Goyal
4385acd3c6 A new option to set the tab bar margin color independently 2021-10-25 12:21:46 +05:30
Kovid Goyal
c0927a3643 Fix rendering of tab bar right margin 2021-10-25 11:39:04 +05:30
Kovid Goyal
37692119e1 Close tab on middle click release not press
Fixes the problem of close causing the tabbar to disappear which could
cause the subsequent release to be delivered to the remaining kitty
window
2021-10-25 10:56:10 +05:30
Kovid Goyal
0f193141af Add support for OSC 777 based desktop notifications
Might as well, since we also support OSC 9, so why not yet another
poorly designed legacy scheme.
2021-10-25 10:46:00 +05:30
Kovid Goyal
24d5fc5f15 Add changelog entries for all the tab bar changes 2021-10-25 10:27:59 +05:30
Kovid Goyal
1ab8d58bf7 Ensure right margin is drawn 2021-10-25 10:27:47 +05:30
Kovid Goyal
691bf75b35 Fix tab bar not being redrawn when colors changed by set-colors
Fixes #4152
2021-10-25 10:17:48 +05:30
Kovid Goyal
63e23d7fe3 Fix set-colors unable to set tab_bar_background to none 2021-10-25 10:04:25 +05:30
Kovid Goyal
23d0db5458 ... 2021-10-25 09:17:29 +05:30
Kovid Goyal
71c62664cd Fix tab bar background not being update in the shader when using set-colors 2021-10-25 09:11:23 +05:30
Kovid Goyal
c9faf5dd59 Extra update_blank_colors() call is not needed 2021-10-25 09:02:08 +05:30
Kovid Goyal
baf080f147 Tab bar left margin should be drawn in the same background color as the other margins 2021-10-25 09:00:49 +05:30
Kovid Goyal
0e29ee9299 ... 2021-10-25 08:48:28 +05:30
Kovid Goyal
d52e5fab1e Merge branch 'master' of https://github.com/python-pitfalls/kitty 2021-10-25 08:43:08 +05:30
Naelson Douglas
9f442eb7e4 removed a consider-using-in pitfall case 2021-10-25 00:04:23 -03:00
Kovid Goyal
0d94ca5399 Better fix for closing non-active tab 2021-10-25 08:11:50 +05:30
Kovid Goyal
13b900faf7 Activate tab before closing on middle click
Also fix compilation on macOS
2021-10-25 07:50:05 +05:30
Kovid Goyal
32ad75c5ab Workaround mypy bug 2021-10-24 23:03:33 +05:30
Kovid Goyal
7a45653575 ... 2021-10-24 22:59:50 +05:30
Kovid Goyal
b316e97a4f Allow middle clicking on a tab to close it
Fixes #4151
2021-10-24 22:56:30 +05:30
Kovid Goyal
6c7420f4e7 Add a comment explaining why we do 1,1,1,0 2021-10-24 13:40:18 +05:30
Kovid Goyal
80a357623d Linux X11: Add support for 10bit colors
Fixes #4150
2021-10-24 13:19:05 +05:30
Kovid Goyal
0a4dfa8fd2 macOS: Prevent resizing of fullscreen OS windows as it leads to visual artifacts 2021-10-24 12:38:44 +05:30
Kovid Goyal
4604558d35 Add some more docs for cursor_shape 2021-10-24 08:22:01 +05:30
Kovid Goyal
089ab9ee9f Use a pre zsh 5.5 syntax for assoc arrays 2021-10-24 08:16:44 +05:30
Kovid Goyal
4fb804efc6 ... 2021-10-23 18:55:55 +05:30
Kovid Goyal
5b2ba448b6 Only modify .zshrc to add shell integration if it already exists 2021-10-23 18:54:59 +05:30
Kovid Goyal
899b5078eb bash integration: fix newline replace in PS1 2021-10-23 18:48:45 +05:30
Kovid Goyal
edd423aad6 macOS; Fix restoring from fullscreen when resize increments are enabled 2021-10-23 13:06:47 +05:30
Kovid Goyal
518e0f4e21 oops 2021-10-22 12:52:57 +05:30
Kovid Goyal
7546e53c23 ... 2021-10-22 12:47:32 +05:30
Kovid Goyal
0f9944190d Shell integration: Better fix for multi-line prompts in bash
Also fix bash redrawing only the last PS2 prompt
2021-10-22 12:19:03 +05:30
Kovid Goyal
18aca275c8 Only libedit doesn't redraw GNU readline does 2021-10-22 12:08:06 +05:30
Kovid Goyal
6d02ef59f8 Shell integration: Fix PS2 support
zsh only redraws the prompt from the last PS2 on a multiline prompt.
Take this into account.
2021-10-22 12:02:21 +05:30
Kovid Goyal
729cea88f3 More sophisticated OSC 133 parsing with support for secondary prompts 2021-10-22 11:54:54 +05:30
Kovid Goyal
9b957a1fdb handle shlex exceptions gracefully 2021-10-22 05:12:12 +05:30
Kovid Goyal
e18b0cd4c8 When a window is moved but not resized, ensure the OS Window is re-rendered 2021-10-22 04:15:47 +05:30
Kovid Goyal
b51be8382f Transmit home directory when sending so filenames can be resolved
Also only send metadata if permission granted by user
2021-10-21 20:06:53 +05:30
Kovid Goyal
a95a1f1158 Specify languages for CodeQL 2021-10-21 19:43:52 +05:30
Kovid Goyal
be8fc47c5f Also report enabled_layouts in kitty @ ls 2021-10-21 16:41:05 +05:30
Kovid Goyal
4fd76b09d9 kitty @ ls: Also report layout options 2021-10-21 13:44:06 +05:30
Kovid Goyal
6546c1da9b run pyupgrade to upgrade the codebase to python3.6 2021-10-21 12:43:55 +05:30
Kovid Goyal
8f0b3983ee Apparently only importlib_resources has actually deprecated contents() 2021-10-20 11:15:51 +05:30
Kovid Goyal
7f2ce045ab Handle deprecation of importlib.resources APIs 2021-10-19 09:14:58 +05:30
Kovid Goyal
38f1fe7742 Make --override parsing a little more forgiving
Handle option values with = in them even if the user uses a space
as a separator rather than an =
2021-10-18 22:44:10 +05:30
Kovid Goyal
a099d2364d kitty should not quit if an invalid set_colors mapping is configured 2021-10-18 21:20:48 +05:30
Kovid Goyal
5f91084968 More work on file transfer 2021-10-18 13:02:37 +05:30
Kovid Goyal
cb9321e925 handle comma separated layout lists as well 2021-10-17 18:34:02 +05:30
Kovid Goyal
716ff187f9 kitty @ set-enabled-layouts
Fixes #4129
2021-10-17 18:30:34 +05:30
Kovid Goyal
16365f2014 When creating tabs via @ launch with the --match option create the tab in the OS Window containing the result of the match rather than the active OS Window
Fixes #4126
2021-10-17 13:27:52 +05:30
Kovid Goyal
0fa03da18c ... 2021-10-17 12:54:55 +05:30
Kovid Goyal
a4a7d49bed A new swap_with_window mappable action
Allows visual selection of a window to swap with the current window
2021-10-17 12:52:08 +05:30
Kovid Goyal
0de319fc73 Refactor visual window select infrastructure to make it reuseable 2021-10-17 12:38:03 +05:30
Kovid Goyal
c06823dd47 Function to swap active window with another 2021-10-17 11:42:02 +05:30
Kovid Goyal
f9944e6140 Pass through more modifier+tab variants 2021-10-17 11:31:54 +05:30
Kovid Goyal
426815f7ab Silence CodeQL warning 2021-10-17 10:32:25 +05:30
Kovid Goyal
2a842e36a1 Finish up title rendering for CoreText 2021-10-17 08:26:35 +05:30
Kovid Goyal
90dfabc644 Use realpath() when reporting kitty_exe 2021-10-17 06:30:26 +05:30
Kovid Goyal
f302c2ae39 Binary builds: If a symlink to the correct kitty executable is already in PATH, dont add the binary bin dir to PATH 2021-10-17 06:29:01 +05:30
Kovid Goyal
93aee3946f Partial work on macOS title rendering 2021-10-16 19:12:38 +05:30
Kovid Goyal
4b7de5d802 Add an alias for --keep-focus 2021-10-16 19:02:15 +05:30
Kovid Goyal
78c63e6a18 Show window titles during visual select
Still has to be implemented on macOS
2021-10-15 14:19:56 +05:30
Kovid Goyal
dcda2bff69 Handle more than 10 windows when doing a visual switch 2021-10-15 14:05:54 +05:30
Kovid Goyal
372c4da8f9 When drawing cells make the window object available 2021-10-15 10:25:11 +05:30
Kovid Goyal
a95025752a DRYer 2021-10-15 09:56:22 +05:30
Kovid Goyal
a16ffcdde2 Handle mouse clicks when displaying focus window overlay 2021-10-15 09:55:15 +05:30
Kovid Goyal
3c2e521dd7 Make blending of foreground more efficient
Avoids an unnecessary reversal of premultiplication when rendering
interleaved.  Also fixes rendering on wayland which for some reason was
using a different blend function than X11. Fixes #4120
2021-10-14 21:31:20 +05:30
Kovid Goyal
f28d9bcd8c Change sybolic constant for insert key 2021-10-14 21:05:21 +05:30
Kovid Goyal
c6039fc399 Also passthrough Insert and Shift+Insert which cocoa seems to intercept 2021-10-14 20:27:22 +05:30
Kovid Goyal
706494016c More work on file transmission 2021-10-14 18:29:02 +05:30
Kovid Goyal
a653233050 Fix #4117 2021-10-14 14:31:11 +05:30
Kovid Goyal
ed5accd702 Add some common readline bindings to the line editor 2021-10-14 14:29:44 +05:30
Kovid Goyal
3a247be758 cleanups 2021-10-14 14:07:02 +05:30
Kovid Goyal
d417aedde0 Allow use of numpad for window select overlay 2021-10-14 12:14:11 +05:30
Kovid Goyal
967aaad482 ... 2021-10-14 10:07:54 +05:30
Kovid Goyal
9c4942b190 Ensure mouse cursor shape is correct
Previously, the shape was only set on focus in events and when hovering
urls. However, on macOS there are no focus events generated when the
mouse moves between the window and the titlebar/menubar, thus causing
incorrect mouse shape.

Fix #4118
2021-10-14 10:05:44 +05:30
Kovid Goyal
67fd07a92a ... 2021-10-14 09:57:35 +05:30
Kovid Goyal
533b0ed591 A new mappable action select_window_in_tab to select a window in the current tab to switch to, by window title
Also when using the focus_visible_window action in a layout that shows
only a single window such as the stack layout, use this facility
automatically.
2021-10-14 09:19:22 +05:30
Kovid Goyal
3f1a0baa84 DRYer 2021-10-14 08:57:55 +05:30
Kovid Goyal
8057c420d9 Fix resize-os-window slightly incorrect on high DPI
Caused by premature clamping of a floating point number
2021-10-12 19:40:02 +05:30
Kovid Goyal
a3717436b6 macOS: Fix resize_in_steps not working correctly on high DPI screens
See #4114
2021-10-12 14:39:06 +05:30
Kovid Goyal
7852e0b618 Clarify docs 2021-10-12 12:54:51 +05:30
Kovid Goyal
5afb16ab8d A new remote control command to change tab color
Fixes #1287
2021-10-12 12:48:25 +05:30
Kovid Goyal
8187ec2cef ... 2021-10-12 12:32:15 +05:30
Kovid Goyal
d55d8ac091 ... 2021-10-12 10:40:25 +05:30
Kovid Goyal
e13c34c2b8 Use a bar cursor for LineEdit 2021-10-12 09:13:06 +05:30
Kovid Goyal
8630c8830a Implement shell integration for the kitty shell 2021-10-12 09:05:53 +05:30
Kovid Goyal
da3f34603a DRYer 2021-10-12 07:41:52 +05:30
Kovid Goyal
97a8ff3478 Fix #4113 2021-10-12 07:35:11 +05:30
Kovid Goyal
2548896656 Dont visually focus select if only one window present 2021-10-11 20:37:59 +05:30
Kovid Goyal
572df007df Add a default shortcut for visually focusing windows
Fixes #4110
2021-10-11 20:28:58 +05:30
Kovid Goyal
440640bbbc A mappable action to visually select the window to focus with the keyboard 2021-10-11 20:18:35 +05:30
Kovid Goyal
563b7ad2d0 Linux binary builds: Fix Pygments not being included 2021-10-11 20:00:56 +05:30
Kovid Goyal
b180702c97 clarify language 2021-10-11 19:06:38 +05:30
Kovid Goyal
c3f4e734f1 API to set screen window number 2021-10-11 18:00:18 +05:30
Kovid Goyal
61a56a0561 macOS: Fix very first keypress after window creation being sent as a repeat instead of a press event
Now the dummy event on input source changed is sent with no key and only
after an actual change instead of on startup as well.
2021-10-11 12:30:42 +05:30
Kovid Goyal
820fb6dda9 Pass through all esc + modifier combinations since they arent generally used in macOS 2021-10-11 11:27:24 +05:30
Kovid Goyal
85db87a121 A shader to draw a single seven segment number over a kitty window 2021-10-11 11:13:29 +05:30
Kovid Goyal
dc11b76bea Restrict the overridden cocoa global shortcuts 2021-10-11 06:46:59 +05:30
Kovid Goyal
2b9408c217 macOS: Fix ctrl or cmd with Esc or Function keys not working
Fixes #4109
2021-10-10 21:39:20 +05:30
Kovid Goyal
5e033773dd More work on transfer sending 2021-10-10 13:04:47 +05:30
Kovid Goyal
855681200f ... 2021-10-08 15:51:45 +05:30
Kovid Goyal
456564f377 Small text clarification for rendering strategy 2021-10-07 18:31:18 +05:30
Kovid Goyal
828e16b45d ... 2021-10-07 13:59:19 +05:30
Kovid Goyal
9289ebf9c9 Old python compat 2021-10-07 13:51:55 +05:30
Kovid Goyal
f4b6cc6628 Forgot the key the is_gcc cache by cc 2021-10-07 13:43:12 +05:30
Kovid Goyal
853f7cc59a Make handling of CC more robust
Allows multi-command compilers and makes detection of gcc more robust.
Fixes #4102
2021-10-07 13:35:56 +05:30
Kovid Goyal
5841776c65 Add the BEGIN key to terminfo
Fixes #4101
2021-10-07 13:15:06 +05:30
Kovid Goyal
fbf47f75d5 Fix soft hyphens not being preserved when round tripping text through the terminal
Also roundtrip all characters in the Cf category.

Characters with the DI (Default Ignorable) property are now
preserved but not rendered and treated as zero-width
as per the unicode standard.
See https://www.unicode.org/faq/unsup_char.html
2021-10-07 12:44:22 +05:30
Kovid Goyal
1b42f69119 Allow specifying extra lib dirs as well
Also use the extra include and lib dirs when detecting librsync
2021-10-06 10:23:01 +05:30
Kovid Goyal
a1b532334e Alias for --extra-include-dirs 2021-10-06 08:08:44 +05:30
Kovid Goyal
edac0e8023 Check for utmpx.h instead of __unix__
There is no reliable macro to test for UNIX
2021-10-05 11:58:09 +05:30
Kovid Goyal
498d3d5906 More cleanups 2021-10-05 11:58:06 +05:30
Kovid Goyal
57152a8e29 Fix utmp test 2021-10-05 11:41:18 +05:30
Kovid Goyal
35d4e2d4e0 Clean up previous PR 2021-10-05 11:36:29 +05:30
Kovid Goyal
fe42b15ec6 Merge branch 'master' of https://github.com/mattfbacon/kitty 2021-10-05 11:15:12 +05:30
Matt Fellenz
1d4a86594b Add tests for UTMP methods 2021-10-04 20:49:48 -07:00
Matt Fellenz
072e583835 Properly evaluate /etc/issue placeholders 2021-10-04 20:49:48 -07:00
Kovid Goyal
463133abbe Fix #4095 2021-10-05 07:20:40 +05:30
Kovid Goyal
34d6c69b2a fix forgotten import 2021-10-04 21:40:07 +05:30
Kovid Goyal
14d36e3727 Stub for receive in the transfer kitten 2021-10-04 21:31:02 +05:30
Kovid Goyal
ed95f7dfa0 Add a note about discarding key presses 2021-10-04 21:30:11 +05:30
Kovid Goyal
f93a10da48 Add a heart 2021-10-04 14:23:42 +05:30
Kovid Goyal
31e623afb3 Add support for Unicode 14
Fixes #3542
2021-10-04 14:00:35 +05:30
Kovid Goyal
2080b3d7fa Print out rsync stats 2021-10-03 13:40:53 +05:30
Kovid Goyal
a8e06a67c2 Better message when transferring rsync signatures 2021-10-03 13:29:50 +05:30
Kovid Goyal
42a79cb269 ... 2021-10-03 13:08:46 +05:30
Kovid Goyal
1ba9cd6138 Avoid progress messages with no actual progress 2021-10-03 13:06:38 +05:30
Kovid Goyal
37f3328147 Fix patching failing when decompressor produces no output 2021-10-03 12:57:32 +05:30
Kovid Goyal
df1ecad7e9 Fix failing test
Ignore progress messages in the tests
2021-10-03 12:01:41 +05:30
Kovid Goyal
5699c3ae7d Dont spin report done files 2021-10-03 11:58:24 +05:30
Kovid Goyal
1877a02378 Dont count dirs in transfer stats 2021-10-03 11:30:08 +05:30
Kovid Goyal
e9f344c53f Improve progress reporting for individual files 2021-10-03 11:26:49 +05:30
Kovid Goyal
d15763f2ad Dont show transfer stats for non regular files 2021-10-03 11:16:07 +05:30
Kovid Goyal
76eab44f53 Have the receiving side send progress updates
This is both more accurate and works for rsync based transfers, where we
dont know the total size to transmit because of the streaming nature of
the rsync protocol.
2021-10-03 11:04:46 +05:30
Kovid Goyal
3a373a200c Add a tell() method to PatchFile to track how much has been written 2021-10-03 10:18:28 +05:30
Kovid Goyal
f6e518d2f9 DRYer 2021-10-02 12:06:56 +05:30
Kovid Goyal
14f9f64bce Fix chunking of signature for transmission 2021-10-02 11:47:29 +05:30
Kovid Goyal
c79a0108a1 Remove unneeded code 2021-10-02 11:24:43 +05:30
Kovid Goyal
20fcc5e31b DRYer 2021-10-02 11:16:47 +05:30
Kovid Goyal
01299421ee Fix typo causing test to fail 2021-10-02 11:07:34 +05:30
Kovid Goyal
5729e33412 librsync actually blocks on output buffer size as well as input availability. So handle that 2021-10-02 09:26:35 +05:30
Kovid Goyal
f85f39e662 Code to easily develop librsync bindings 2021-10-02 07:22:33 +05:30
Kovid Goyal
0e9be57119 ... 2021-10-02 06:25:57 +05:30
Kovid Goyal
ffd7b5779b Fix end of data not being sent when using rsync 2021-10-02 06:15:06 +05:30
Kovid Goyal
1d1d55e2b4 Fix #4084 2021-10-02 05:10:59 +05:30
Kovid Goyal
3cea8f24d4 ... 2021-10-02 04:58:47 +05:30
Kovid Goyal
d6a43a7729 Dont turn on disambiguate keys when receiving th XTMODKEYS escape code
See #4075
2021-10-01 21:26:27 +05:30
Kovid Goyal
cfeeec95fa Start work on delta based file transmission 2021-10-01 17:26:27 +05:30
Kovid Goyal
e6cff61f99 Move management of destination file completely into PatchFile 2021-10-01 14:29:14 +05:30
Kovid Goyal
eeb02ceef4 Shell integration: Workaround bash not redrawing multiline prompts 2021-10-01 09:30:26 +05:30
Kovid Goyal
eaa0ec4fc3 ... 2021-10-01 07:57:21 +05:30
Kovid Goyal
91a719f80e fix query URL 2021-10-01 07:54:04 +05:30
Kovid Goyal
06f67e4765 typo in comment 2021-09-30 14:27:22 +05:30
Kovid Goyal
7530bfd1a1 lang -> source_ext since it is now file extension not language name 2021-09-30 14:25:48 +05:30
Kovid Goyal
abf6a3f91d Fix #4080 2021-09-30 14:23:19 +05:30
Kovid Goyal
21d3856e90 Another attempt at fixing fish cursor movement 2021-09-30 14:17:01 +05:30
Kovid Goyal
2304d0ec5c Ignore extra zero in escape code to manipulate window title stack
See https://github.com/weechat/weechat/issues/1702
2021-09-30 09:16:51 +05:30
Kovid Goyal
5cafe198bf icat: Fix EXIF orientation not taken into account when resizing 2021-09-30 08:45:41 +05:30
Kovid Goyal
4ce2690bd2 DRYer 2021-09-30 08:39:27 +05:30
Kovid Goyal
ea186ac48d Fix click to move cursor in fish multiline text
Thanks to @ridiculousfish, see: https://github.com/kovidgoyal/kitty/issues/3948#issuecomment-930458949
2021-09-30 07:44:30 +05:30
Kovid Goyal
9ab5a03f53 Fix movement of cursor when clicking and dual width chars are present in zsh 2021-09-30 07:38:44 +05:30
Kovid Goyal
7650c8bca9 Remove premature changelog entry 2021-09-29 20:42:06 +05:30
Kovid Goyal
3728d2cfd9 Add changelog entry for previous PR 2021-09-29 19:43:33 +05:30
Kovid Goyal
3214ba4541 Merge branch 'ibus_forward_key_event' of https://github.com/pjm0616/kitty 2021-09-29 19:36:44 +05:30
Park, Jeongmin
4232904055 ibus: Add support for ForwardKeyEvent signal
The ForwardKeyEvent ibus signal is used to maintain ordering between CommitText events and non-IME key events.
The ordering is important for Korean IMEs, where it automatically commits text whenever a character is fully composed. This is different from Chinese/Japanese IMEs, where user manually presses a key to commit each word.

Without this patch, kitty can't handle non-IME key events when used with ibus-hangul, which utilizes ForwardKeyEvent signal.

Without ForwardKeyEvent:
```
key | sequence of events from application's view
r   | UpdatePreeditText 'ㄱ'
k   | UpdatePreeditText '가'
1   | (receives the reply to ProcessKeyEvent call: "native_key: 0x31 release: 0 handled: 0")
    | -> UpdatePreeditText ''
    | -> CommitText '가'
```
Application receives "1가", which is incorrect.

With ForwardKeyEvent:
```
key | sequence of events from application's view
r   | UpdatePreeditText 'ㄱ'
k   | UpdatePreeditText '가'
1   | (receives the reply to ProcessKeyEvent call: "native_key: 0x31 release: 0 handled: 1", and kitty discards the event)
    | -> UpdatePreeditText ''
    | -> CommitText '가'
    | -> ForwardKeyEvent keysym=0x31("1")
```
Application receives "가1", which is correct.

Relevant ibus-hangul github issue to implement ForwardKeyEvent: https://github.com/libhangul/ibus-hangul/issues/42
Relevant changes in Qt to handle ForwardKeyEvent: https://codereview.qt-project.org/c/qt/qtbase/+/212179, https://codereview.qt-project.org/c/qt/qtbase/+/255587
2021-09-29 21:20:09 +09:00
Kovid Goyal
baf8976c2d Keep global_watchers immutable 2021-09-29 14:39:48 +05:30
Kovid Goyal
b3ae857f3c ... 2021-09-29 14:25:13 +05:30
Kovid Goyal
8be0dd0d8e Restore the --watcher command line option for backwards compat
It is now deprecated but not removed. And it now applies to all windows
not just initially created ones.
2021-09-29 14:18:55 +05:30
Kovid Goyal
166ea9deb9 A new watcher option for kitty.conf that replaces the old --watcher cli flag
Applies to all windows, not just initial ones.
2021-09-29 14:01:30 +05:30
Kovid Goyal
7a16ef2cc4 ... 2021-09-29 13:21:42 +05:30
Kovid Goyal
a0cee13652 Also turn on extended key reporting for CSI > 4; 2 m
This is supported by XTerm and used by vim. Fixes #4075
2021-09-29 11:12:01 +05:30
Kovid Goyal
a3b434d2fe ... 2021-09-29 11:01:30 +05:30
Kovid Goyal
36ab05f003 DRYer 2021-09-29 10:59:42 +05:30
Kovid Goyal
35dee0c46e Dont list all releases when publishing, instead just query the API for the existing release directly 2021-09-29 10:52:51 +05:30
Kovid Goyal
cb1858ecc8 Remove unused import 2021-09-29 10:33:04 +05:30
Kovid Goyal
10fbf36e92 Silence bells caused by cursor movement after click at prompt 2021-09-29 10:27:13 +05:30
Kovid Goyal
3c3e97aa6e Fix moved status not being returned to python 2021-09-29 08:37:26 +05:30
Kovid Goyal
f353380e86 Fix #4074 2021-09-29 08:08:29 +05:30
Kovid Goyal
b1375e5ed1 ask kitten: Allow clicking on a choice to select it
Fixes #4071
2021-09-28 20:13:11 +05:30
Kovid Goyal
44bcbc4823 Make it easier to handle simple click events 2021-09-28 20:12:55 +05:30
Kovid Goyal
a402a3ad12 Fix release not reporting button in sgr pixel protocol 2021-09-28 16:20:32 +05:30
Kovid Goyal
343eb56cdf Fix import of MouseEvent 2021-09-28 15:46:35 +05:30
Kovid Goyal
3efa8b6322 In SGR_PIXEL_MODE report pixel co-ords outside of window when dragging 2021-09-28 15:14:29 +05:30
Kovid Goyal
7cd72f344d Update link 2021-09-28 14:23:49 +05:30
Kovid Goyal
066dfc71aa A kitten to demo mouse handling 2021-09-28 13:48:56 +05:30
Kovid Goyal
769cd9be3f DRYer 2021-09-28 13:31:06 +05:30
Kovid Goyal
0f9d6a1e4a Forgot to clear screen before drawing 2021-09-28 12:56:19 +05:30
Kovid Goyal
3c742a0037 Use pixel mode for mouse tracking in kittens 2021-09-28 12:46:41 +05:30
Kovid Goyal
9a3d99515f Add support for reporting mouse events with pixel co-ordinates using the SGR_PIXEL_PROTOCOL introduced in xterm 359 2021-09-28 11:41:35 +05:30
Kovid Goyal
f3447d187d Allow handlers to ask for mouse events 2021-09-28 09:32:53 +05:30
Kovid Goyal
276696414e Use a full handler for choices in the ask kitten 2021-09-28 09:14:34 +05:30
Kovid Goyal
7d41aca0e4 More word selection direction change fixes 2021-09-27 20:42:22 +05:30
Kovid Goyal
c71d8fe1cc Fix #4070 2021-09-27 17:29:22 +05:30
Kovid Goyal
cc261db606 ... 2021-09-27 12:02:23 +05:30
Kovid Goyal
7e17ed21ce Use the atomic update decorator everywhere 2021-09-27 12:00:33 +05:30
Kovid Goyal
b1f4b2d8ed Use pending updates for unicode input kitten
Avoids all possibility of flicker
2021-09-27 11:33:21 +05:30
Kovid Goyal
9cb5f6d9d7 Add changelog entry for last PR 2021-09-27 11:18:47 +05:30
Kovid Goyal
f3177d8878 Merge branch 'unicode-input-scroll-4064' of https://github.com/dusanx/kitty 2021-09-27 11:17:42 +05:30
Kovid Goyal
3bc7b5bad9 Remote file transfer: Fix transfer not working is custom ssh port or identity is specified on the SSH command line
Fixes #4067
2021-09-27 10:58:40 +05:30
Kovid Goyal
b70064d1be Use a default set of ssh options if the binary is not found 2021-09-27 10:49:38 +05:30
Dusan Popovic
ffca2ecf19 scroll in unicode input 2021-09-26 23:18:33 +01:00
Kovid Goyal
a32b6d5cf5 No need for Optional 2021-09-26 12:30:08 +05:30
Kovid Goyal
3ce087a716 ... 2021-09-26 12:26:21 +05:30
Kovid Goyal
15cdeef552 Cleanup test_compile a bit 2021-09-26 12:21:25 +05:30
Kovid Goyal
a038477ce0 Cleanup previous PR 2021-09-26 11:17:54 +05:30
Kovid Goyal
b05e939e05 Merge branch 'patch-1' of https://github.com/unisgn/kitty 2021-09-26 11:11:42 +05:30
Kovid Goyal
6347daf0ac Merge branch 'add-dependency-to-shell.nix' of https://github.com/Luflosi/kitty 2021-09-25 19:24:07 +05:30
Luflosi
327f4ca327 shell.nix: add dependency on librsync
The dependency on librsync was introduced in f0fab80f5b.
2021-09-25 14:37:38 +02:00
Kovid Goyal
fe0d1034aa Cleanup any extra files produced by clang in debug mode when test compiling 2021-09-25 17:41:55 +05:30
Kovid Goyal
d982a3c94e ... 2021-09-25 14:08:44 +05:30
Kovid Goyal
259ca4a11e Speed up parsing of file transfer OSC codes
Avoid roundtrips between unicode and bytes objects
2021-09-25 14:05:21 +05:30
Kovid Goyal
b9ae1fa429 ... 2021-09-25 11:04:13 +05:30
Kovid Goyal
0d32c1656a More work on rsync based transfer 2021-09-25 11:03:17 +05:30
Kovid Goyal
2defd311e1 Fix a couple of typos in schedule_write_to_child_python 2021-09-25 11:01:23 +05:30
unisgn
d078cb264a Update ibus_glfw.c 2021-09-25 00:10:53 +08:00
unisgn
c45a656153 ibus's dbus name owner changed detection
fcitx5 works fine with kitty, except that when you restart fcitx5, kitty stop working with fcitx5, because the dbus_connection_get_is_connected(ibus->conn) in #check_connection is always true when you use fcitx5.
this patch add a dbus name owner changed detection to detect the online status of ibus, in case the ibus backend uses the session bus, like fcitx5.
2021-09-24 23:10:38 +08:00
Kovid Goyal
1cef544cff Allow sending escape code to child in chunks 2021-09-24 16:54:04 +05:30
Kovid Goyal
67cef371dc Allow writing bytes when sending escape code to child 2021-09-24 14:06:09 +05:30
Kovid Goyal
2fcfa8d3eb ... 2021-09-24 12:03:51 +05:30
Kovid Goyal
03391b4f7a Improve docs a little 2021-09-24 09:05:42 +05:30
Kovid Goyal
2dae95bf0b Fix reload config macOS shortcut in docs 2021-09-24 08:40:00 +05:30
Kovid Goyal
558fad1630 Fix test_compile() with debug and clang on macOS 2021-09-24 08:31:16 +05:30
Kovid Goyal
c2641458e7 A new option to specify the path to a sound file to use as the bell sound 2021-09-24 08:28:37 +05:30
Kovid Goyal
bbdfdb978d Modify canberra wrapper to allow specifying a sound file path 2021-09-24 07:31:02 +05:30
Kovid Goyal
4112061a47 Format the INSTALL.md links 2021-09-23 20:31:13 +05:30
Kovid Goyal
25e9ddb4a4 Fix type signature 2021-09-23 20:27:33 +05:30
Kovid Goyal
66bf39db93 DRYer 2021-09-23 20:20:47 +05:30
Kovid Goyal
be439cb887 When a tab_bar_background is specified it should extend to the edges of the OS window
Fixes #4054
2021-09-23 20:12:30 +05:30
Kovid Goyal
f3b601aa06 Make it clear what rects we are using for extra blank rects 2021-09-23 16:19:12 +05:30
Kovid Goyal
f6a6ead0f3 Fix active_tab_foreground ignored in slant style
Fixes #4053
2021-09-23 14:40:08 +05:30
Kovid Goyal
43c04df98a Only report progress if connected to a TTY 2021-09-22 08:14:47 +05:30
Kovid Goyal
581a373dae Echo build commands 2021-09-21 08:17:53 +05:30
Kovid Goyal
ca197a915c ... 2021-09-20 12:07:41 +05:30
Kovid Goyal
061111d822 Dont fail if asset already deleted 2021-09-20 12:05:35 +05:30
Kovid Goyal
41003d106a Set the signature parameters manually when rs_sig_args is not available 2021-09-20 11:42:44 +05:30
Kovid Goyal
c9b1e66c71 Upload the source for nightly builds as well 2021-09-20 11:28:34 +05:30
Kovid Goyal
17e95cb615 Add a test for rsync roundtrip 2021-09-19 20:55:00 +05:30
Kovid Goyal
b5c086aedb ... 2021-09-19 20:25:08 +05:30
Kovid Goyal
1036132838 Rename pw to bypass 2021-09-19 17:21:57 +05:30
Kovid Goyal
1d1d82ca50 Setup ropr buffer sizes for rsync operations 2021-09-19 17:19:34 +05:30
Kovid Goyal
85be3e4ed1 Also avoid mallocs for the output buffer 2021-09-19 15:28:22 +05:30
Kovid Goyal
d5d52ec8b9 When driving a job on a file avoid mallocs for each read 2021-09-19 13:49:10 +05:30
Kovid Goyal
ecb0d1f325 More work on wrapping librsync 2021-09-19 13:26:09 +05:30
Kovid Goyal
68436c93a7 More work on the transfer kitten 2021-09-19 10:17:53 +05:30
Kovid Goyal
2a9dff2846 Function to create the delta for a file 2021-09-18 14:00:59 +05:30
Kovid Goyal
bcd1837924 Generator for loading signatures
Also dont waste memory when no output is expected
2021-09-18 13:52:26 +05:30
Kovid Goyal
77508bfe0d Handle blocking with unused input in librsync 2021-09-18 13:08:53 +05:30
Kovid Goyal
cf517effb3 Wrap more of the librsync API 2021-09-18 12:49:38 +05:30
Kovid Goyal
901a075a38 ... 2021-09-18 11:51:54 +05:30
Kovid Goyal
76d6820af9 Do a full link test for rs_sig_args 2021-09-18 11:44:11 +05:30
Kovid Goyal
7cf73c10ac clang needs a newline at the end of src 2021-09-18 11:16:56 +05:30
Kovid Goyal
71963aa738 Fix librsync detection on freeze builds 2021-09-18 11:10:03 +05:30
Kovid Goyal
dcc0dabe68 Specify the library in the correct place when test compiling
Needed for ancient compilers
2021-09-18 10:58:14 +05:30
Kovid Goyal
348e632dd6 Fix building on the usual ancient Linux distro suspects
Detect if librsync is new enough to have rs_sig_args
2021-09-18 10:49:46 +05:30
Kovid Goyal
067502bd66 Fix warning on ancient gcc 2021-09-18 10:25:18 +05:30
Kovid Goyal
6b576fcf5c Use paths rather than flags in kitten extension definitions 2021-09-18 10:08:28 +05:30
Kovid Goyal
2fc972a173 rename function 2021-09-18 09:39:12 +05:30
Kovid Goyal
a941b1af4e Implement signature generation 2021-09-17 17:42:25 +05:30
Kovid Goyal
fbc8a1cdcb Remove workaround for older pillow in macOS CI 2021-09-17 13:57:09 +05:30
Kovid Goyal
f0fab80f5b Start work on rsync support for file transfers 2021-09-17 13:41:45 +05:30
Kovid Goyal
a0740d1616 Use multi-phase initialization for unicode-names 2021-09-17 08:56:55 +05:30
Kovid Goyal
8986d15a5b Remove unused code 2021-09-17 08:39:41 +05:30
Kovid Goyal
9f4f22743f Document how to install the nightly builds 2021-09-17 07:32:51 +05:30
Kovid Goyal
9eebd2c921 Update nightly release description with timestamp and commit sha 2021-09-16 22:44:18 +05:30
Kovid Goyal
5ce71506c8 Various minor fixes in nightly pipeline 2021-09-16 22:31:43 +05:30
Kovid Goyal
ad5b43f6db Start work on infrastructure for nightly builds 2021-09-16 22:13:01 +05:30
Kovid Goyal
aa9855516f Change memory allocation strategy for pending buf
Now it is allocated on demand. This prevents it from blowing up
to READ_BUF_SZ * 2 (2MB) if a small pending update is followed by a
large non pending section in the read buffer, which is commonly
triggered for instance by the transfer kitten which uses pending updates
for its screen drawing mixed with non-pending data transmission.

This is a slight performance penalty since there is a branch when
writing every char to the pending buffer, but the branch will be almost
always one sided so should be well predicted.

In any case, filling the pending buffer is not a performance bottleneck,
compared to actually dispatching parsed escape codes.
2021-09-16 20:23:15 +05:30
Kovid Goyal
fcd4649642 Use pending mode for progress bar updates 2021-09-16 19:54:48 +05:30
Kovid Goyal
e12246983b Fix the upper limit for the pending buffer
The pending buffer needs to be twice the max size of the read buffer.
2021-09-16 19:53:55 +05:30
Kovid Goyal
e8e7ad3b75 DRYer 2021-09-16 18:34:51 +05:30
Kovid Goyal
e9d648d37c Handle exceptions in the tui context managers 2021-09-16 18:28:29 +05:30
Kovid Goyal
eaeece8177 Use the repeat escape code for progress bar rendering 2021-09-16 17:55:22 +05:30
Kovid Goyal
aa9a991a85 Draw separator for final total 2021-09-16 17:45:11 +05:30
Kovid Goyal
0d37431def Report individual file transfer failures 2021-09-16 17:40:19 +05:30
Kovid Goyal
44dfd7a803 More work on transfer kitten 2021-09-16 17:28:26 +05:30
Kovid Goyal
d2809a0acb More work on transfer kitten 2021-09-16 15:27:53 +05:30
Kovid Goyal
4b074d723e ... 2021-09-16 14:01:48 +05:30
Kovid Goyal
deb6abe50e Ancient python compat 2021-09-16 13:50:05 +05:30
Kovid Goyal
d042ea5ab9 Split up tranfer kitten code into modules 2021-09-16 13:47:12 +05:30
Kovid Goyal
bc7c1e4d05 More work on the transfer kitten 2021-09-16 13:34:32 +05:30
Kovid Goyal
a4c5e7c2ee More work on the transfer kitten 2021-09-16 13:02:39 +05:30
Kovid Goyal
504d915723 Fix div by zero errors 2021-09-16 10:30:28 +05:30
Kovid Goyal
039ea95390 Sanitize displayed file names 2021-09-16 10:19:08 +05:30
Kovid Goyal
5f32d2e56f Uppercase DELETE_ENV_VAR 2021-09-16 10:16:33 +05:30
Kovid Goyal
5b716df45f We dont need a special class for delete_env_var 2021-09-16 09:53:54 +05:30
Kovid Goyal
66e2e60ac4 Allow deleting environment vars from the child environment using env 2021-09-16 08:43:17 +05:30
Kovid Goyal
69dc09489b Fix name collision 2021-09-16 07:59:42 +05:30
Kovid Goyal
33a6abfc07 More work on the transfer kitten 2021-09-16 07:39:07 +05:30
Kovid Goyal
f277cbf3f3 Improved trailing newline handling in the fish shell integration
Thanks to some assistance from @faho
See https://github.com/kovidgoyal/kitty/issues/4032#issuecomment-919936913
2021-09-15 21:06:28 +05:30
Kovid Goyal
0a56ab7a1e Workaround for fish splitting on newlines when doing command substitution 2021-09-15 18:12:40 +05:30
Kovid Goyal
a073936997 Fish shell integration: Strip trailing newlines from the original fish prompt as fish does this 2021-09-15 16:58:31 +05:30
Kovid Goyal
5c1dd69963 forgot this in the last commit 2021-09-15 14:03:01 +05:30
Kovid Goyal
c08dc64581 spinner and progress bar for kittens UI 2021-09-15 13:39:39 +05:30
Kovid Goyal
5916bbd5b3 Merge branch 'master' of https://github.com/DiegoBaldassar/kitty 2021-09-15 07:31:51 +05:30
DiegoBaldassar
8c104b52f9 icat: fix exception thrown if stdin is None
Don't use sys.stdin if --stdin=no is given, or if --stdin=detect is given and sys.stdin is None
2021-09-14 22:18:34 +02:00
Kovid Goyal
7266cb653d Add a reference for the claim of minimal latency 2021-09-14 22:38:58 +05:30
Kovid Goyal
2a8fd278c1 Bring implementation of XTSAVE and XTRESTORE into line with xterm
Now a stack of depth 1 is used to save/restore private mode values. And
saving/restoring individual modes is supported. This latter is used by
midnight commander.
2021-09-14 21:59:41 +05:30
Kovid Goyal
4c25ceff29 Remove duplicated reset of mouse_utf8_mode 2021-09-14 20:22:28 +05:30
Kovid Goyal
26f0b53bb2 Dont compress already compressed files 2021-09-14 20:11:34 +05:30
Kovid Goyal
101377d7f2 Better fix for reflow with last line being empty output start line 2021-09-14 14:18:47 +05:30
Kovid Goyal
2487f55bbc Merge branch 'patch-1' of https://github.com/vincentbernat/kitty 2021-09-14 13:06:57 +05:30
Vincent Bernat
f69e718151 Fix typo in documentation
"programmble" → "programmable"
2021-09-14 09:04:06 +02:00
Kovid Goyal
5d516a8584 ... 2021-09-13 13:26:30 +05:30
Kovid Goyal
b1322fbe04 Prompt for permission when reading from clipboard by default
Fixes #4022
2021-09-13 12:32:40 +05:30
Kovid Goyal
38a5e38f88 Transmit hashed password 2021-09-13 12:00:38 +05:30
Kovid Goyal
78fd05c1c6 ... 2021-09-13 11:49:17 +05:30
Kovid Goyal
6993c905e3 Disallow empty ids in file transfer commands 2021-09-13 09:53:59 +05:30
Kovid Goyal
14f8ce6e15 Add a python wrapper to play arbitrary sounds 2021-09-13 08:59:34 +05:30
Kovid Goyal
d726eb354d Play with human size some more 2021-09-12 13:41:51 +05:30
Kovid Goyal
1136c64d49 Make human_size() a little nicer 2021-09-12 13:28:07 +05:30
Kovid Goyal
3f3179db0c ... 2021-09-12 12:47:58 +05:30
Kovid Goyal
d224a4c39f When receiving a long delayed cancel request process it before pruning 2021-09-12 12:46:30 +05:30
Kovid Goyal
3eee442f28 Output total transfer size when confirming 2021-09-12 12:41:48 +05:30
Kovid Goyal
7c90812e51 ... 2021-09-12 12:21:03 +05:30
Kovid Goyal
5c8bcf9379 Implement confirm paths 2021-09-12 12:12:23 +05:30
Kovid Goyal
d40456d6a9 Add a FAQ entry with a list of alternate icons 2021-09-12 11:53:08 +05:30
Kovid Goyal
8e203af344 cleanup text 2021-09-12 11:40:02 +05:30
Kovid Goyal
31ead3f088 Basic file transfer works for sending 2021-09-12 10:02:23 +05:30
Kovid Goyal
efaeb0f0b2 Remove backslashes from CLI theme names if no theme with the name is found 2021-09-12 09:35:31 +05:30
Kovid Goyal
9db9638bc3 Soak up protocol responses after a cancel to avoid outputting garbage to the shell after the kitten exits 2021-09-11 10:48:40 +05:30
Kovid Goyal
74c1476f6d Disallow more than 10 active receives to prevent DoS attacks 2021-09-10 21:20:05 +05:30
Kovid Goyal
24255be0bd Add a permission password to the transfer kitten 2021-09-10 18:09:59 +05:30
Kovid Goyal
0d89eb2c40 When not using alternate screen dont restore cursor position to what it was before initialization 2021-09-10 17:26:01 +05:30
Kovid Goyal
2350952d05 More work on the transfer kitten 2021-09-10 16:54:36 +05:30
Kovid Goyal
53e38cb1d2 Add a note about hologram.nvim to the graphics protocol page 2021-09-10 10:33:01 +05:30
Kovid Goyal
f9c99a61d4 More work on file transfer 2021-09-09 12:59:31 +05:30
Kovid Goyal
2178c8e4af ... 2021-09-09 08:43:44 +05:30
Kovid Goyal
8aacf30f19 Centralize definition of file transfer OSC code 2021-09-08 13:43:59 +05:30
Kovid Goyal
745e97e0ab Send a started response after each dest file is registered 2021-09-08 09:59:45 +05:30
Kovid Goyal
af5c0b3b71 More work on transmission kitten 2021-09-08 08:56:14 +05:30
Kovid Goyal
d7a1f3104a Add no_op to get_all_actions() 2021-09-06 15:26:48 +05:30
Kovid Goyal
8fb48d7952 Output more kitty global state when debugging config 2021-09-06 08:36:53 +05:30
Kovid Goyal
1ac3de4aeb typo 2021-09-04 10:45:53 +05:30
Kovid Goyal
0c5ea5c3c0 Make paypal button appearance match the rest 2021-09-03 09:24:55 +05:30
Kovid Goyal
78e4f1cde4 Add github sponsors to support page 2021-09-03 09:13:32 +05:30
Kovid Goyal
fb0b94eaa1 ... 2021-09-03 09:06:03 +05:30
Kovid Goyal
7291fef7cc Add github sponsors funding link 2021-09-03 08:39:46 +05:30
Kovid Goyal
6db46850eb Fix #3989 2021-09-02 13:05:14 +05:30
Kovid Goyal
7997295d4c Make a section about terminals implementing the graphics protocol 2021-09-02 12:49:17 +05:30
Kovid Goyal
6daee3a0b5 @get-text: Allow getting the last command output 2021-09-02 10:13:54 +05:30
Kovid Goyal
87f6793552 Allow mocking usage of timers in the test suite 2021-09-01 13:09:42 +05:30
Kovid Goyal
40786427b0 More work on file transmission 2021-09-01 09:22:04 +05:30
Kovid Goyal
59b84ae1a4 Note that chafa added support for the graphics protocol 2021-09-01 06:44:35 +05:30
Kovid Goyal
aafd8a8da4 When expanding vars allow using $$ for literal $ 2021-08-31 17:24:19 +05:30
Kovid Goyal
5ff66f6bfa When reloading config also reload open-actions.conf 2021-08-30 20:24:08 +05:30
Kovid Goyal
e8873804c0 Note that the graphics protocol is now supported in WezTerm as well 2021-08-30 13:56:21 +05:30
Kovid Goyal
0f37521592 Add a note to the graphics protocol about symlink resolution 2021-08-30 12:23:26 +05:30
Kovid Goyal
8ad1180321 Make a note that only regular files are supported for transmission of graphics data 2021-08-30 12:04:43 +05:30
Kovid Goyal
ced03c5d99 More work on file transmission 2021-08-30 09:00:38 +05:30
Kovid Goyal
161a54ceaa Disable transmission tests pending rewrite 2021-08-30 08:08:41 +05:30
Kovid Goyal
c159ac287f Flush input queue when child is removed
This is needed for running kittens that return data by printing
to STDOUT. As otherwise with a long input delay the output never
gets processed. Fixes #3980
2021-08-30 08:03:53 +05:30
Kovid Goyal
4ddd2bf980 More work on transmission 2021-08-29 21:09:20 +05:30
Kovid Goyal
1d9425ecdc Change transmission protocol to not need container formats 2021-08-29 06:27:07 +05:30
Kovid Goyal
495981bade Pass failure to send data to child because of full buffer up the stack 2021-08-25 13:28:50 +05:30
Kovid Goyal
672cf9fffe Start work on transfer kitten 2021-08-25 11:38:41 +05:30
Kovid Goyal
72e15d8b4f Fish integration: Have the value of $status preserved by the prompt functions 2021-08-24 20:29:12 +05:30
Kovid Goyal
075b4d252a DRYer 2021-08-24 07:49:12 +05:30
Kovid Goyal
1953ecdf4d Add tests for container transmission 2021-08-23 22:10:26 +05:30
Kovid Goyal
89f8151579 hints kitten: Fix a regression that caused using the default open program to trigger open actions instead of running the program
Fixes #3968
2021-08-23 11:56:16 +05:30
Kovid Goyal
d9cc1d67c0 Make path comparison more robust 2021-08-23 11:48:21 +05:30
Kovid Goyal
d178f4c75d Implement canceling of file transmission 2021-08-23 11:33:03 +05:30
Kovid Goyal
0668a3bf2a Send a response indicating transmission was successful 2021-08-23 11:09:45 +05:30
Kovid Goyal
d548b21be2 Allow interleaving file transmissions 2021-08-22 22:08:03 +05:30
Kovid Goyal
ebcd053bf3 Fix incorrect prompt reflow when a command is running that has produced no output
Needed to preserve the output start semantics on the first empty dest line
2021-08-22 13:55:59 +05:30
Kovid Goyal
b282464604 ... 2021-08-22 13:13:13 +05:30
Kovid Goyal
42dcecde14 More work on file transmission 2021-08-22 13:01:43 +05:30
Kovid Goyal
aa0b344b55 kitten to confirm file transfer requests 2021-08-22 07:23:49 +05:30
Kovid Goyal
fa77128026 ... 2021-08-21 22:09:20 +05:30
Kovid Goyal
7f1c5d8534 DRYer 2021-08-21 17:32:55 +05:30
Kovid Goyal
d2a31a6a0f Merge branch 'master' of https://github.com/Mukundan314/kitty 2021-08-20 21:51:21 +05:30
Mukundan314
fb9c911ae9 Fix spelling mistake in docs for themes kitten 2021-08-20 21:35:40 +05:30
Kovid Goyal
5bc569c4dd Allow specifying whether to count windows at prompts or not for confirm_clsoe 2021-08-20 17:13:42 +05:30
Kovid Goyal
8397970bf8 Ensure fish config dir exists 2021-08-20 08:54:41 +05:30
Kovid Goyal
6fc7b3d946 Merge branch 'fix-clang-warning' of https://github.com/Luflosi/kitty 2021-08-20 05:56:31 +05:30
Luflosi
0fe7796df0 Fix Clang warning
Without this, Clang would complain:
```
In file included from kitty/fonts.c:9:
In file included from kitty/fonts.h:9:
kitty/lineops.h:67:29: error: suggest braces around initialization of subobject
      [-Werror,-Wmissing-braces]
    const CellAttrs zero = {0};
                            ^
                            {}
```
2021-08-19 22:52:36 +02:00
Kovid Goyal
40b50332de Fix space ligatures not working with Iosevka for some characters in the Enclosed Alphanumeric Supplement
Recognize chars in this block as non-emoji dingbats to turn on space
ligatures for them

Fixes #3954
2021-08-19 22:28:07 +05:30
Kovid Goyal
9a50dfc4b5 broadcast kitten: Allow broadcasting ctrl+c
Fixes #3956
2021-08-19 22:05:29 +05:30
Kovid Goyal
09c18f474f Broadcast kitten: Fix --match and also remove a useless print 2021-08-19 21:58:04 +05:30
Kovid Goyal
51244c4388 Cleanup previous PR 2021-08-19 19:42:15 +05:30
Kovid Goyal
898f162369 Merge branch 'master' of https://github.com/fladson/kitty 2021-08-19 19:41:28 +05:30
Fladson Gomes
2529ef2f0b Add linker fail build notes for macos 2021-08-19 15:08:08 +02:00
Kovid Goyal
fc528941bd remove reference to obsolete kitty-themes repo 2021-08-19 14:20:06 +05:30
Kovid Goyal
8e9ee90d9f More work on file transfer protocol 2021-08-19 14:13:54 +05:30
Kovid Goyal
b03c6f70fe add macOS variants for config scs 2021-08-19 10:00:09 +05:30
Kovid Goyal
42da681f2b Launch command: Allow specifying the OS window title 2021-08-19 09:52:52 +05:30
Kovid Goyal
44561e8cea macOS: Fix SIGUSR1 quitting kitty instead of reloading the config file
Fixes #3952
2021-08-19 09:37:08 +05:30
Kovid Goyal
37735b962e Start work on new file_transmission protocol 2021-08-19 09:23:01 +05:30
Kovid Goyal
34ec3eac44 icat kitten: Fix display of JPEG images that are rotated via EXIF data and larger than available screen size
Fixes #3949
2021-08-19 09:08:35 +05:30
Kovid Goyal
59c14d07fd Update versionadded 2021-08-18 11:02:15 +05:30
Kovid Goyal
86ffb744f5 Move changelog entry for shell integration 2021-08-18 10:06:53 +05:30
Kovid Goyal
fab7cfb113 Handle multiline cursor movement in zsh when clicking 2021-08-18 10:06:10 +05:30
Kovid Goyal
2715947830 DRYer 2021-08-18 10:06:10 +05:30
Kovid Goyal
eb2f3387c5 Add some notes about the shell marking protocol 2021-08-18 10:06:10 +05:30
Kovid Goyal
2472cea69f Fix resizing causing a line or two from the start of the th last cmd output to be skipped
Resizing causes multiple consecutive lines to be marked as being start
of output, so rewind to the first of them.
2021-08-18 10:06:10 +05:30
Kovid Goyal
2a634af2bc When confirming close commands dont count windows sitting at shell prompts 2021-08-18 10:06:10 +05:30
Kovid Goyal
81654c9874 Function to check if cursor is at marked prompt 2021-08-18 10:06:09 +05:30
Kovid Goyal
28914d4450 Remove a macro that is not really needed anymore 2021-08-18 10:06:09 +05:30
Kovid Goyal
4000cce81c DRYer 2021-08-18 10:06:09 +05:30
Kovid Goyal
35ad366427 Fix incorrect prompt marking on screen resize
Forgot to initialize line attrs for src lines in the LineBuf
2021-08-18 10:06:09 +05:30
Kovid Goyal
c257adb56a Add a debug action to dump current lines with their attributes 2021-08-18 10:06:09 +05:30
Kovid Goyal
929e0c126d rename -> replace 2021-08-18 10:06:09 +05:30
Kovid Goyal
b293e4d516 DRYer 2021-08-18 10:06:09 +05:30
Kovid Goyal
6571cf2e89 When showing last cmd output convert wrap markers into line breaks
This matches the behavior of show_scrollback and works well with overlay
windows and if the pager is configured to not wrap
2021-08-18 10:06:09 +05:30
Kovid Goyal
aa739cdfd4 Add shell_prompt_marking to client 2021-08-18 10:06:09 +05:30
Kovid Goyal
35c608ae77 Dont add wrap markers (\r) when showing last command output 2021-08-18 10:06:09 +05:30
Kovid Goyal
8d8095a2d1 Migrate an action spec to the new syntax 2021-08-18 10:06:09 +05:30
Kovid Goyal
1740821bb4 Move changelog entry into correct place 2021-08-18 10:06:09 +05:30
Kovid Goyal
4cd6829657 forgot to geenrate update opts 2021-08-18 10:06:09 +05:30
Kovid Goyal
ef76c075e0 Get rid of bits from CellAttrs 2021-08-18 10:06:08 +05:30
Kovid Goyal
b260a61c8f Get rid of bits from LineAttrs 2021-08-18 10:06:08 +05:30
Kovid Goyal
780e526143 Use a union for cell attributes
Cleaner code, no performance impact
2021-08-18 10:06:08 +05:30
Kovid Goyal
1e0269faa2 Fix sourcing of shell integration changing $? on bash/zsh 2021-08-18 10:06:08 +05:30
Kovid Goyal
73465aa44b Change the shortcuts to z and x for jumping to prompts 2021-08-18 10:06:08 +05:30
Kovid Goyal
1f5fa03015 Use a union for line attrs
Allows faster construction of Line objects without needing to set
individual booleans. And cleaner code.
2021-08-18 10:06:08 +05:30
Kovid Goyal
000e1012c6 Option for packagers to easily tune shell integration 2021-08-18 10:06:08 +05:30
Kovid Goyal
afc5821809 Note when shell integration was added to kitty 2021-08-18 10:06:08 +05:30
Kovid Goyal
e8832a86bb Fix scroll_to_prompt for prompts that have been reflowed over multiple lines 2021-08-18 10:06:08 +05:30
Kovid Goyal
f61b8608de Fix mouse click event using current mouse co-ords rather than the co-ords at the time of the click 2021-08-18 10:06:08 +05:30
Kovid Goyal
92f428b6d1 common prefix should not apply to basename 2021-08-18 10:06:08 +05:30
Kovid Goyal
8795bf8cf9 various fixed for completion
- Fix completion of --directory
- Dont remove common prefix unless it contains path separator
- Dont show suggestions for options on new words
2021-08-18 10:06:08 +05:30
Kovid Goyal
0dee0bfada zsh completion: Dont remove prefix when only a single item is present in the group 2021-08-18 10:06:07 +05:30
Kovid Goyal
482d3bb913 Better integrate shell integration into sidebar toc 2021-08-18 10:06:07 +05:30
Kovid Goyal
48035977e3 Style details summary as a link 2021-08-18 10:06:07 +05:30
Kovid Goyal
6b23921880 Document the new shell integration features 2021-08-18 10:06:07 +05:30
Kovid Goyal
c98e4eb478 Start documenting shell integration 2021-08-18 10:06:07 +05:30
Kovid Goyal
7cd05ad76b ... 2021-08-18 10:06:07 +05:30
Kovid Goyal
fa327d618d Cursor movement at shell prompts on click
Fixes #3825
2021-08-18 10:06:07 +05:30
Kovid Goyal
bc202aec6e Dont discard information on whether a click hit a URL 2021-08-18 10:06:07 +05:30
Kovid Goyal
606ce4e66f Add descriptions to fish completions 2021-08-18 10:06:07 +05:30
Kovid Goyal
a10c19456a Fix completions for fish 2021-08-18 10:06:07 +05:30
Kovid Goyal
20688661aa ... 2021-08-18 10:06:07 +05:30
Kovid Goyal
cbbd9f475e fish completions dont want quoting 2021-08-18 10:06:07 +05:30
Kovid Goyal
f4b3948168 Use a shortened dir path for window title
Also respect named directories
2021-08-18 10:06:07 +05:30
Kovid Goyal
2245d4506f Add title and cursor to fish integration 2021-08-18 10:06:06 +05:30
Kovid Goyal
7f3da135e2 ... 2021-08-18 10:06:06 +05:30
Kovid Goyal
23f94b6e67 Get prompt marking working for th fish shell 2021-08-18 10:06:06 +05:30
Kovid Goyal
0ec10b52e0 Add shebangs 2021-08-18 10:06:06 +05:30
Kovid Goyal
2fcd57410a Dont fail if rc file dir doesnt exist 2021-08-18 10:06:06 +05:30
Kovid Goyal
a993a71857 Add shell integration for bash 2021-08-18 10:06:06 +05:30
Kovid Goyal
01ce0e1d1a Prevent fd leak if copystat fails 2021-08-18 10:06:06 +05:30
Kovid Goyal
040a152f1f Preserve stat attributes when modifying rc files atomically 2021-08-18 10:06:06 +05:30
Kovid Goyal
f4f2013c2b Create shell integration rc file if it doesnt exist 2021-08-18 10:06:06 +05:30
Kovid Goyal
6e172bdc09 Fix cursor in zsh vicmd mode 2021-08-18 10:06:06 +05:30
Kovid Goyal
725ec57bee Automatically setup shell integration for ZSH 2021-08-18 10:06:06 +05:30
Kovid Goyal
8a9234ba4f Move shell integration docs into own file 2021-08-18 10:06:06 +05:30
Kovid Goyal
a00e4ebe3f Improce docstring 2021-08-18 10:06:06 +05:30
Kovid Goyal
2d93a011df Option to control shell integration 2021-08-18 10:06:05 +05:30
Kovid Goyal
bffe7aba8f Add shell integration scripts to kitty package 2021-08-18 10:06:05 +05:30
Kovid Goyal
b581408137 DRYer 2021-08-18 10:06:05 +05:30
Kovid Goyal
2263cd1355 Use a _ksi_ prefix for shell integration
Sadly function in zsh are global so prefix all function and global var
names with _ksi_ as poor mans namespacing.
2021-08-18 10:06:05 +05:30
Kovid Goyal
1bb87c71aa Make all shell integrations disablable 2021-08-18 10:06:05 +05:30
Kovid Goyal
7dec7d615a Use an env var to control shell integration 2021-08-18 10:06:05 +05:30
Kovid Goyal
2e5308ad40 Use an associative array for prompt data 2021-08-18 10:06:05 +05:30
Kovid Goyal
d1015de700 Workaround for base64 on linux inserting line breaks by default 2021-08-18 10:06:05 +05:30
Kovid Goyal
934318adb1 DRYer 2021-08-18 10:06:05 +05:30
Kovid Goyal
179c2b21c0 Make debug_print remove esc and bel
Should really be made more robust, but cant be bothered
2021-08-18 10:06:05 +05:30
Kovid Goyal
85f6d3fed8 Use PS1 to set the prompt start mark
Needed as precmd functions are not called when redrawing the prompt. As
far as I can tell zsh stupidly has no hook that is called when the
prompt is redrawn after a window resize or when a background job
finishes.
2021-08-18 10:06:05 +05:30
Kovid Goyal
a4925eeeb4 ... 2021-08-18 10:06:05 +05:30
Kovid Goyal
196200d03f Dont reflow the current prompt when resizing
This ensures that there is no leftover line when the shell redraws the prompt,
by making the prompt a simple single character prompt before rewrapping.
2021-08-18 10:06:04 +05:30
Kovid Goyal
f2ca0424a0 Use correct src_line for attrs copy when rewrapping 2021-08-18 10:06:04 +05:30
Kovid Goyal
07b971ad5f Add a shortcut to easily browse the output of the last command run in the shell 2021-08-18 10:06:04 +05:30
Kovid Goyal
51fa25e03d Add shortcuts for jumping to prev/next shell prompt 2021-08-18 10:06:04 +05:30
Kovid Goyal
bd5f100f13 Add test for multiline prompt jumping 2021-08-18 10:06:04 +05:30
Kovid Goyal
3b8da7e4c2 implementation of scroll_to_prompt 2021-08-18 10:06:04 +05:30
Kovid Goyal
4a9a021b2c DRYer 2021-08-18 10:06:04 +05:30
Kovid Goyal
d4dd226d8f Preserve prompt markings when copying lines and rewrapping them 2021-08-18 10:06:04 +05:30
Kovid Goyal
0d4237f802 Mark prompt lines 2021-08-18 10:06:04 +05:30
Kovid Goyal
46b9aca16e Start work on shell integration 2021-08-18 10:06:04 +05:30
Kovid Goyal
4931477ef4 typo 2021-08-18 10:06:04 +05:30
Kovid Goyal
dfdd1697c5 Make the signatures of drat tab functions extendable with backwards compat 2021-08-18 10:03:50 +05:30
Kovid Goyal
801f0d51a1 Cleanup docs a bit 2021-08-18 08:31:49 +05:30
Kovid Goyal
bdebb19648 Merge branch 'wayland-hyper' of https://github.com/orki/kitty 2021-08-18 08:29:51 +05:30
Ravi R Kiran
75df0cbcf5 Gate Wayland modifier autodiscovery behind an environment variable 2021-08-17 21:46:09 -05:00
Kovid Goyal
e23b4ce6b4 Document a couple more env vars 2021-08-18 07:49:54 +05:30
Ravi R Kiran
1b88a68b55 Be even more conservative in declaring success
This handles the nonsensical case of Alt_X being mapped to two
different modifiers.
2021-08-17 21:11:55 -05:00
Kovid Goyal
a82bc6738c A new option to draw the tab bar centered or right
Fixes #3946
2021-08-18 07:35:04 +05:30
Kovid Goyal
868626c79c Allow the user to supply a custom Python function to draw tab bar 2021-08-18 07:15:03 +05:30
Kovid Goyal
e4cc8bf828 Merge branch 'update-shell.nix' of https://github.com/Luflosi/kitty 2021-08-18 06:26:31 +05:30
Luflosi
f57fb17d2b shell.nix: add new dependencies for building the documentation 2021-08-17 17:55:40 +02:00
Luflosi
a69170b0ba shell.nix: make more similar to the code in Nixpkgs
Remove the dependency on installShellFiles as it is not needed for building kitty itself and is only used in Nixpkgs for conveniently installing man pages and shell completions.
pkgconfig has been renamed to pkg-config.
Use `with python3Packages;` to reduce code duplication. This is how it's done in Nixpkgs as well.
Also sort the packages in nativeBuildInputs.
2021-08-17 17:43:49 +02:00
Kovid Goyal
4066c2389d Fix a regression that caused --title to not work when opening new OS windows using --single-instance 2021-08-17 20:32:03 +05:30
Kovid Goyal
cd7b4fcd8e version 0.23.1 2021-08-17 11:37:24 +05:30
Ravi R Kiran
b0c963b650 Heuristic to find hyper and meta on wayland 2021-08-16 21:59:53 -05:00
Kovid Goyal
f67995d5d3 See if we can mollify CodeQL 2021-08-16 22:53:46 +05:30
Kovid Goyal
f0e7344bc8 Use bundled CA certs on Linux binary builds as well
Makes it consistent with macOS
2021-08-16 22:47:53 +05:30
Kovid Goyal
aa525c68c7 Only test bundled CA certs on macOS 2021-08-16 22:26:10 +05:30
Kovid Goyal
a2e25331a5 Dont check Linux CA locations on macOS 2021-08-16 22:23:24 +05:30
Kovid Goyal
d8f09d377f Install ca-certificates on Linux CI machines 2021-08-16 22:15:27 +05:30
Kovid Goyal
cc96cb1c75 Check a few more locations for CA certificates 2021-08-16 22:09:39 +05:30
Kovid Goyal
5966f04656 Add a build test for CA certificate loading 2021-08-16 20:44:47 +05:30
Kovid Goyal
dbce9a8f29 themes kitten: Fix only the first custom theme file being loaded
Fixes #3938
2021-08-16 20:27:21 +05:30
Kovid Goyal
4333552523 Matching windows/tabs: allow matching by recency
``recent:0`` matches the active window/tab, ``recent:1`` matches the
previous window/tab and so on
2021-08-16 18:29:06 +05:30
Kovid Goyal
c00e945f6e Make the clipboard size limit configurable
Fixes #3937
2021-08-16 17:29:36 +05:30
Kovid Goyal
56cb628ee8 macOS: Bundle mozilla's root certificates with kitty
Apple doesnt provide root certificates in a form useable by openssl
which means all ssl based network requests fail, so bundle our own

Fixes #3936
2021-08-16 17:16:03 +05:30
Kovid Goyal
827b6598b2 version 0.23.0 2021-08-16 07:38:02 +05:30
Kovid Goyal
59bafea06d Add some docs for non-interactive theme changing 2021-08-16 07:37:59 +05:30
Kovid Goyal
d61aca40b8 Make link to template.conf a download link 2021-08-16 07:14:49 +05:30
Kovid Goyal
bf704d35a2 Add a link to kitty-themes in the changelog 2021-08-16 07:11:05 +05:30
Kovid Goyal
fbc8881a96 Merge branch 'master' of github.com:kovidgoyal/kitty 2021-08-15 08:28:00 +05:30
Kovid Goyal
8cfb1efb01 hints kitten: Make the --program option work with --linenum-action=self
Fixes #3931
2021-08-15 08:27:25 +05:30
Kovid Goyal
f399b8466c Merge branch 'patch-1' of https://github.com/con-f-use/kitty 2021-08-14 19:42:19 +05:30
con-f-use
437ba69049 docs: typo in hint.rst, adaption to new layout 2021-08-14 15:19:27 +02:00
Kovid Goyal
dbc7e8e85d When dragging word or line selections, ensure the initially selected item is never deselected
This matches behavior in most other programs
Fixes #3930
2021-08-13 20:23:43 +05:30
Kovid Goyal
f3333ce941 Fix getting connection data from ssh command line when -- is used in the command line
This broke the remote file kitten when using the ssh kitten as the later
was changed to use -- recently.

Fixes #3929
2021-08-13 17:14:43 +05:30
Kovid Goyal
97a9261096 ... 2021-08-13 17:04:49 +05:30
Kovid Goyal
5a76dab3c6 ControlMaster must not suppress exceptions 2021-08-13 17:02:27 +05:30
Kovid Goyal
5a92d3f312 Fix a regression that broke the edit action in the remote file kitten 2021-08-13 16:59:40 +05:30
Kovid Goyal
b173dd1c39 Fix error getting editor in remote file kitten not being reported 2021-08-13 16:57:01 +05:30
Kovid Goyal
473e1a6f22 Fix #3926
Apparently nvim assumes cnorm doesn't affect cursor shape. It's
ambiguous whether cnorm should affect it or not. So to prevent
regressions in case other programs assume that as well, have it only
make the cursor visible and blinking, without changing its shape.
2021-08-13 09:31:18 +05:30
Kovid Goyal
9c4a890688 Adjust attenuation based on color 2021-08-11 12:41:09 +05:30
Kovid Goyal
a803c8bcc5 Make the visual bell flash more gentle, especially on dark themes
Fixes #2937
2021-08-11 12:09:25 +05:30
Kovid Goyal
5c7ce18379 Move visual bell code into shaders.c 2021-08-11 12:04:52 +05:30
Andrew Mayorov
aff6fdfa84 Make visual bell flash much more gentle
Right now visual bell makes background flash sharply with bright white
(when configured with darkish color theme). This causes eye strain,
especially prominent in unlit environments.

This change makes background bounce smoothly between regular bg color
and highlight (selection) bg color for the configured visual bell
duration. Intensity is animated with cubic easing functions. It
currently peaks at 20% of the duration, this is hardcoded.

Mark functions computing intensity and easing as inline

Do smarter blending of visual bell flash

Blend highlight color with pegtop's softlight mode over both background
and half as much over foreground. This should help with flash visibility
in light themed and inverted colors contexts.

Blend flash in BACKGROUND pass also

Revert "Do smarter blending of visual bell flash"

This reverts commit 9a269d55c7d04334b1c4891c42914423517dfad6.

Revert "Blend flash in BACKGROUND pass also"

This reverts commit 756332cb9d7576b08db78406e37349aa6d1df156.

Revert "Make visual bell flash much more gentle"

This reverts commit cbfe5d59ada2da690e14c7532a7468b0c307c462.

Render flash overlay in a separate drawcall

Trigger frequent repaints to make for smooth animation

Attenuate flash a bit more
2021-08-11 11:54:43 +05:30
Kovid Goyal
477a652b44 Function to update a theme file 2021-08-11 09:09:07 +05:30
Kovid Goyal
15e0b42f04 Make the regex for commenting settings more robust 2021-08-11 08:46:42 +05:30
Kovid Goyal
b25ea9c863 Fix #3913 2021-08-09 08:37:53 +05:30
Kovid Goyal
c838cb03c9 Do not allow reloading the config to affect allow_remote_control 2021-08-08 15:34:34 +05:30
Kovid Goyal
ba9adc127e Use realpath when creating conf.bak as well 2021-08-08 10:49:41 +05:30
Kovid Goyal
b7d603c4de Atomic save should preserve stat if the file exists 2021-08-08 10:41:46 +05:30
Kovid Goyal
71f1f3aa64 Atomic save should use the target of symlinks 2021-08-08 10:35:38 +05:30
Kovid Goyal
7d1c26202a Add completion for options that take choices 2021-08-08 10:08:15 +05:30
Kovid Goyal
80db2f6558 Completion for theme names 2021-08-08 09:57:57 +05:30
Kovid Goyal
e376c79dda Show the current theme name in kitty.conf as well 2021-08-08 09:42:07 +05:30
Kovid Goyal
5a47e0d2e4 Make reload_conf_in_all_kitties re-useable 2021-08-08 09:38:29 +05:30
Kovid Goyal
ca9143bebc Allow reloading conf in all kitty instances as well 2021-08-08 09:33:36 +05:30
Kovid Goyal
a49f6799de Print usage when no args provided to +runpy 2021-08-08 09:10:47 +05:30
Kovid Goyal
d916ecc4f3 Add a non-interactive mode to the themes kitten 2021-08-08 07:57:14 +05:30
Kovid Goyal
e1ed9aca10 clear_all_mouse_shortcuts -> clear_all_mouse_actions 2021-08-07 21:34:16 +05:30
Kovid Goyal
0e2f1b9405 Merge branch 'fork' of https://github.com/bdeshi/kitty 2021-08-07 21:30:57 +05:30
bdeshi
db5a2d2141 add clear_all_mouse_shortcuts option to clear mouse_maps 2021-08-07 21:33:56 +06:00
Kovid Goyal
a9771dccba Change list position in kittens intro 2021-08-07 18:40:36 +05:30
Kovid Goyal
4849e07c26 Document the themes kitten 2021-08-07 18:38:33 +05:30
Kovid Goyal
4645e78fa7 Reload config in parent kitty when running the themes kitten 2021-08-07 16:54:47 +05:30
Kovid Goyal
9e2590eb15 Set the KITTY_PID env var when running child processes 2021-08-07 16:48:34 +05:30
Kovid Goyal
94575a5cf6 Implement modifying of kitty.conf
An include for the current theme is added and
all existing color related settings are commented out
so that the theme overlays on kitty's default settings.
2021-08-07 16:34:41 +05:30
Kovid Goyal
a597a8d86b Make the recent list functional 2021-08-07 15:31:03 +05:30
Kovid Goyal
3287798efe terminfo: Fix "cnorm" the property for setting the cursor to normal using a solid block rather than a blinking block cursor
cnorm should match the default cursor in kitty, which is a blinking
block. Fixes #3906
2021-08-07 15:15:59 +05:30
Kovid Goyal
d01ac17334 Implement placing of selected theme in kitty config dir 2021-08-07 15:04:32 +05:30
Kovid Goyal
2c96727c45 Implement searching in the themes kitten 2021-08-07 11:17:32 +05:30
Kovid Goyal
ca1b2454bd Fix position output in matcher 2021-08-07 10:45:50 +05:30
Kovid Goyal
064fc17ce3 More work on themes kitten 2021-08-05 21:38:39 +05:30
Kovid Goyal
43ccf9cb41 Draw theme demo 2021-08-05 13:17:16 +05:30
Kovid Goyal
96857a197c Allow default theme to have no settings 2021-08-05 11:20:01 +05:30
Kovid Goyal
079ff7785c ... 2021-08-05 07:47:32 +05:30
Kovid Goyal
d6a6cbe153 Migrate import in test 2021-08-05 07:05:19 +05:30
Kovid Goyal
2486cfd45d Move match() into a more re-useable location 2021-08-05 06:59:24 +05:30
Kovid Goyal
30cb7286db Fix building on macOS
macOS defines newlocale() in xlocale.h
2021-08-05 06:47:45 +05:30
Kovid Goyal
9e7253c179 macOS: Set LANG to en_US if cocoa reports language as en_* that is not a valid locale
Fixes #3899
2021-08-05 06:29:21 +05:30
Kovid Goyal
276a82d1f7 Make get_all_actions() work in binary builds 2021-08-05 06:10:41 +05:30
Kovid Goyal
57ced9bc83 Dont send press event for shift+middle when grabbed
Fixes #3902
2021-08-05 05:03:22 +05:30
Kovid Goyal
3c3662b032 Limit display length for theme names 2021-08-04 23:18:57 +05:30
Kovid Goyal
f490b9a8bd Better error message for get_all_actions() when docstrings are missing 2021-08-04 22:58:05 +05:30
Kovid Goyal
c7ccedae95 ... 2021-08-04 22:27:48 +05:30
Kovid Goyal
03517459db Type check set_mode and reset_mode 2021-08-04 22:25:27 +05:30
Kovid Goyal
96326280e5 Use a pending update when drawing the screen 2021-08-04 22:06:05 +05:30
Kovid Goyal
9b7899780b Implement drawing the list of themes 2021-08-04 21:56:33 +05:30
Kovid Goyal
e01cd057e8 Fix timestamp not being updated in downloaded zip file comment
Also clean up tab bar formatting
2021-08-04 20:34:00 +05:30
Kovid Goyal
ba85ca1991 Finish the tab bar for the themes kitten 2021-08-04 19:06:07 +05:30
Kovid Goyal
92a9b71f21 More work on the themes kitten 2021-08-04 18:43:26 +05:30
Kovid Goyal
e50c26d1b9 Allow using a non-toal dict to init Options objects 2021-08-04 17:06:50 +05:30
Kovid Goyal
7090c24321 More work on the themes kitten 2021-08-04 14:13:09 +05:30
Kovid Goyal
55319cd6d6 FreeType: Round glyph advances
The old code would simply add advances and store as a float with
individual glyph positioning using floor() based on the advance +
offset. This breaks rendering of infinite length ligatures at some font
sizes as they either under or overflow. Rounding the advances seems to
fix it. Dont know if it will have other ill-effects for non infinite
length ligatures. If it does we can test total ligature length and
use rounding only for long ligatures.

Fixes #3896
2021-08-04 08:40:49 +05:30
Kovid Goyal
8a6b51441c More work on themes kitten 2021-08-04 07:36:09 +05:30
Kovid Goyal
36670b49a0 Make creation of kitty-themes.zip atomic 2021-08-03 17:47:47 +05:30
Kovid Goyal
a402d848d2 Work on themes kitten UI 2021-08-03 17:32:15 +05:30
Kovid Goyal
37c563802c typo 2021-08-03 12:58:38 +05:30
Kovid Goyal
2d7032973c Change the semantics of --title slightly
Now it no longer overrides the titles of windows/tabs created in the
session. This allows windows/tabs to have their own titles while fixing
the OS Window's title.
2021-08-03 09:51:53 +05:30
Kovid Goyal
70b5f5bce3 Fix kitty --title not overriding tab titles
It must set the OS Window title permanently.

Fixes #3893
2021-08-03 09:34:13 +05:30
Kovid Goyal
be34af4555 Remove inline from .c files
It is ignored by compilers and hides unused static functions
2021-08-03 09:11:17 +05:30
Kovid Goyal
815539a933 Clean up the docs for tab_bar_style 2021-08-03 08:52:19 +05:30
Kovid Goyal
ab889e2945 A new "slant" style for the tab bar 2021-08-03 08:45:55 +05:30
Kovid Goyal
b3231c8003 Fix a link in the conf docs 2021-08-02 21:58:39 +05:30
Kovid Goyal
5f6cb34f77 placeholder 2021-08-02 21:54:06 +05:30
Kovid Goyal
a99a080c50 More work on theme loading 2021-08-02 21:46:33 +05:30
Kovid Goyal
4a1ca8d582 Move theme parser into kitty code 2021-08-02 18:54:48 +05:30
Kovid Goyal
050eb5660d Start work on themes kitten 2021-08-02 17:56:31 +05:30
343 changed files with 52007 additions and 35479 deletions

1
.github/FUNDING.yml vendored
View File

@@ -1,3 +1,4 @@
github: kovidgoyal
patreon: kovidgoyal
liberapay: kovidgoyal
custom: https://sw.kovidgoyal.net/kitty/support.html

View File

@@ -34,18 +34,15 @@ def install_deps():
run('brew', 'install', *items)
else:
run('sudo apt-get update')
run('sudo apt-get install -y libgl1-mesa-dev libxi-dev libxrandr-dev libxinerama-dev'
run('sudo apt-get install -y libgl1-mesa-dev libxi-dev libxrandr-dev libxinerama-dev ca-certificates'
' libxcursor-dev libxcb-xkb-dev libdbus-1-dev libxkbcommon-dev libharfbuzz-dev libx11-xcb-dev'
' libpng-dev liblcms2-dev libfontconfig-dev libxkbcommon-x11-dev libcanberra-dev uuid-dev')
' libpng-dev liblcms2-dev libfontconfig-dev libxkbcommon-x11-dev libcanberra-dev librsync-dev uuid-dev')
if is_bundle:
install_bundle()
else:
if is_macos:
# needed for zlib for pillow, should not be needed after pillow 8.0
os.environ['PKG_CONFIG_PATH'] = '/usr/local/opt/zlib/lib/pkgconfig'
cmd = 'pip3 install Pillow pygments'
cmd = 'python3 -m pip install Pillow pygments'
if sys.version_info[:2] < (3, 7):
cmd += ' importlib-resources'
cmd += ' importlib-resources dataclasses'
run(cmd)

View File

@@ -20,15 +20,15 @@ jobs:
cc: [gcc, clang]
include:
- python: a
pyver: 3.6
pyver: 3.7
sanitize: 0
- python: b
pyver: 3.7
pyver: 3.8
sanitize: 1
- python: c
pyver: 3.8
pyver: 3.9
sanitize: 1

View File

@@ -22,17 +22,11 @@ jobs:
# a pull request then we can checkout the head.
fetch-depth: 2
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
# Override language selection by uncommenting this and choosing your languages
# with:
# languages: go, javascript, csharp, python, cpp, java
with:
languages: python, c
- name: Build kitty
run: python3 .github/workflows/ci.py build

1
.gitignore vendored
View File

@@ -19,3 +19,4 @@ __pycache__/
/.mypy_cache
.DS_Store
bypy/b
bypy/virtual-machines.conf

View File

@@ -1,5 +1,6 @@
pkg-config
zlib
librsync
python
imagemagick
harfbuzz

View File

@@ -1,3 +1,3 @@
To build from source: <https://sw.kovidgoyal.net/kitty/build/>
[To build from source](https://sw.kovidgoyal.net/kitty/build/)
Pre-built binaries: <https://sw.kovidgoyal.net/kitty/binary/>
[Pre-built binaries](https://sw.kovidgoyal.net/kitty/binary/)

View File

@@ -671,4 +671,4 @@ into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/philosophy/why-not-lgpl.html>.
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
import os
@@ -24,20 +23,34 @@ def remote_control(args: List[str]) -> None:
def runpy(args: List[str]) -> None:
if len(args) < 2:
raise SystemExit('Usage: kitty +runpy "some python code"')
sys.argv = ['kitty'] + args[2:]
exec(args[1])
def hold(args: List[str]) -> None:
import subprocess
import tty
import termios
from contextlib import suppress
from kittens.tui.operations import init_state, set_cursor_visible
ret = subprocess.Popen(args[1:]).wait()
with suppress(BaseException):
print('\n\x1b[1;32mPress any key to exit', end='', flush=True)
print(
'\n\x1b[1;32mPress Enter to exit',
end=init_state(alternate_screen=False, kitty_keyboard_mode=False) + set_cursor_visible(False),
flush=True)
with suppress(BaseException):
tty.setraw(sys.stdin.fileno())
sys.stdin.buffer.read(1)
fd = sys.stdin.fileno()
old = termios.tcgetattr(fd)
new = old[:]
new[3] &= ~termios.ECHO # 3 == 'lflags'
tcsetattr_flags = termios.TCSAFLUSH
if hasattr(termios, 'TCSASOFT'):
tcsetattr_flags |= getattr(termios, 'TCSASOFT')
termios.tcsetattr(fd, tcsetattr_flags, new)
with suppress(KeyboardInterrupt):
input()
raise SystemExit(ret)
@@ -117,21 +130,21 @@ namespaced_entry_points['complete'] = complete
def setup_openssl_environment() -> None:
# Workaround for Linux distros that have still failed to get their heads
# out of their asses and implement a common location for SSL certificates.
# It's not that hard people, there exists a wonderful tool called the symlink
# See https://www.mobileread.com/forums/showthread.php?t=256095
if 'SSL_CERT_FILE' not in os.environ and 'SSL_CERT_DIR' not in os.environ:
if os.access('/etc/pki/tls/certs/ca-bundle.crt', os.R_OK):
os.environ['SSL_CERT_FILE'] = '/etc/pki/tls/certs/ca-bundle.crt'
setattr(sys, 'kitty_ssl_env_var', 'SSL_CERT_FILE')
elif os.path.isdir('/etc/ssl/certs'):
os.environ['SSL_CERT_DIR'] = '/etc/ssl/certs'
setattr(sys, 'kitty_ssl_env_var', 'SSL_CERT_DIR')
# Use our bundled CA certificates instead of the system ones, since
# many systems come with no certificates in a useable form or have various
# locations for the certificates.
d = os.path.dirname
ext_dir: str = getattr(sys, 'kitty_extensions_dir')
if 'darwin' in sys.platform.lower():
cert_file = os.path.join(d(d(d(ext_dir))), 'cacert.pem')
else:
cert_file = os.path.join(d(ext_dir), 'cacert.pem')
os.environ['SSL_CERT_FILE'] = cert_file
setattr(sys, 'kitty_ssl_env_var', 'SSL_CERT_FILE')
def main() -> None:
if getattr(sys, 'frozen', False) and 'darwin' not in sys.platform.lower():
if getattr(sys, 'frozen', False) and getattr(sys, 'kitty_extensions_dir', ''):
setup_openssl_environment()
first_arg = '' if len(sys.argv) < 2 else sys.argv[1]
func = entry_points.get(first_arg)

View File

@@ -30,6 +30,7 @@ def initialize_constants():
kitty_constants['appname'] = re.search(
r'appname: str\s+=\s+(u{0,1})[\'"]([^\'"]+)[\'"]', src
).group(2)
kitty_constants['cacerts_url'] = 'https://curl.haxx.se/ca/cacert.pem'
return kitty_constants

View File

@@ -1,3 +1,3 @@
image 'https://partner-images.canonical.com/core/xenial/current/ubuntu-xenial-core-cloudimg-{}-root.tar.gz'
image 'https://cloud-images.ubuntu.com/releases/bionic/release/ubuntu-18.04-server-cloudimg-{}.img'
deps 'bison flex libxcursor-dev libxrandr-dev libxi-dev libxinerama-dev libgl1-mesa-dev libxcb-xkb-dev libfontconfig1-dev libdbus-1-dev'

View File

@@ -19,7 +19,11 @@ from bypy.freeze import (
from bypy.utils import get_dll_path, mkdtemp, py_compile, walk
j = os.path.join
arch = 'x86_64' if is64bit else 'i686'
machine = (os.uname()[4] or '').lower()
if machine.startswith('arm64') or machine.startswith('aarch64'):
arch = 'arm64'
else:
arch = 'x86_64' if is64bit else 'i686'
self_dir = os.path.dirname(os.path.abspath(__file__))
py_ver = '.'.join(map(str, python_major_minor_version()))
iv = globals()['init_env']
@@ -29,7 +33,7 @@ kitty_constants = iv['kitty_constants']
def binary_includes():
return tuple(map(get_dll_path, (
'expat', 'sqlite3', 'ffi', 'z', 'lzma', 'png16', 'lcms2', 'crypt',
'iconv', 'pcre', 'graphite2', 'glib-2.0', 'freetype',
'iconv', 'pcre', 'graphite2', 'glib-2.0', 'freetype', 'rsync',
'harfbuzz', 'xkbcommon', 'xkbcommon-x11',
'ncursesw', 'readline', 'brotlicommon', 'brotlienc', 'brotlidec'
))) + (
@@ -92,6 +96,15 @@ def copy_libs(env):
subprocess.check_call(['chrpath', '-d', dest])
def add_ca_certs(env):
print('Downloading CA certs...')
from urllib.request import urlopen
cdata = urlopen(kitty_constants['cacerts_url']).read()
dest = os.path.join(env.lib_dir, 'cacert.pem')
with open(dest, 'wb') as f:
f.write(cdata)
def copy_python(env):
print('Copying python...')
srcdir = j(PREFIX, 'lib/python' + py_ver)
@@ -106,8 +119,7 @@ def copy_python(env):
shutil.copy2(y, env.py_dir)
srcdir = j(srcdir, 'site-packages')
site_packages_dir = j(env.py_dir, 'site-packages')
import_site_packages(srcdir, site_packages_dir)
import_site_packages(srcdir, env.py_dir)
pdir = os.path.join(env.lib_dir, 'kitty-extensions')
os.makedirs(pdir, exist_ok=True)
@@ -220,6 +232,7 @@ def main():
build_launcher(env)
files = find_binaries(env)
fix_permissions(files)
add_ca_certs(env)
if not args.dont_strip:
strip_binaries(files)
if not args.skip_tests:

View File

@@ -170,6 +170,7 @@ class Freeze(object):
self.add_stdlib()
self.add_misc_libraries()
self.freeze_python()
self.add_ca_certs()
if not self.dont_strip:
self.strip_files()
if not self.skip_tests:
@@ -180,6 +181,15 @@ class Freeze(object):
return ret
@flush
def add_ca_certs(self):
print('\nDownloading CA certs...')
from urllib.request import urlopen
cdata = urlopen(kitty_constants['cacerts_url']).read()
dest = os.path.join(self.contents_dir, 'Resources', 'cacert.pem')
with open(dest, 'wb') as f:
f.write(cdata)
@flush
def strip_files(self):
print('\nStripping files...')
@@ -212,7 +222,7 @@ class Freeze(object):
@flush
def get_local_dependencies(self, path_to_lib):
for x, is_id in self.get_dependencies(path_to_lib):
for y in (PREFIX + '/lib/', PREFIX + '/python/Python.framework/'):
for y in (PREFIX + '/lib/', PREFIX + '/python/Python.framework/', '@rpath/'):
if x.startswith(y):
if y == PREFIX + '/python/Python.framework/':
y = PREFIX + '/python/'
@@ -278,6 +288,7 @@ class Freeze(object):
'lcms2.2',
'crypto.1.1',
'ssl.1.1',
'rsync.2',
):
print('\nAdding', x)
x = 'lib%s.dylib' % x

View File

@@ -28,6 +28,15 @@
}
},
{
"name": "openssl",
"unix": {
"filename": "openssl-1.1.1i.tar.gz",
"hash": "sha256:e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242",
"urls": ["https://www.openssl.org/source/{filename}"]
}
},
{
"name": "cmake",
"os": "macos",
@@ -48,25 +57,22 @@
}
},
{
"name": "libxml2",
"os": "linux",
"unix": {
"filename": "libxml2-2.9.10.tar.gz",
"hash": "sha256:aafee193ffb8fe0c82d4afef6ef91972cbaf5feea100edc2f262750611b4be1f",
"filename": "libxml2-2.9.12.tar.gz",
"hash": "sha256:c8d6681e38c56f172892c85ddc0852e1fd4b53b4209e7f4ebf17f7e2eae71d92",
"urls": ["ftp://xmlsoft.org/libxml2/{filename}"]
}
},
{
"name": "xkbcommon",
"os": "linux",
"unix": {
"filename": "libxkbcommon-1.0.3.tar.xz",
"hash": "sha256:a2202f851e072b84e64a395212cbd976ee18a8ee602008b0bad02a13247dbc52",
"urls": ["http://xkbcommon.org/download/{filename}"]
"urls": ["https://xkbcommon.org/download/{filename}"]
}
},
@@ -90,15 +96,6 @@
}
},
{
"name": "openssl",
"unix": {
"filename": "openssl-1.1.1i.tar.gz",
"hash": "sha256:e8be6a35fe41d10603c3cc635e93289ed00bf34b79671a3a4de64fcee00d5242",
"urls": ["https://www.openssl.org/source/{filename}"]
}
},
{
"name": "ncurses",
"os": "linux",
@@ -115,7 +112,7 @@
"unix": {
"filename": "readline-8.1.tar.gz",
"hash": "sha256:f8ceb4ee131e3232226a17f51b164afc46cd0b9e6cef344be87c65962cb82b02",
"urls": ["http://ftp.gnu.org/gnu/readline/{filename}"]
"urls": ["https://ftp.gnu.org/gnu/readline/{filename}"]
}
},
@@ -128,6 +125,16 @@
}
},
{
"name": "librsync",
"unix": {
"filename": "librsync-2.3.2.tar.gz",
"hash": "sha256:ef8ce23df38d5076d25510baa2cabedffbe0af460d887d86c2413a1c2b0c676f",
"urls": ["https://github.com/librsync/librsync/releases/download/v2.3.2/{filename}"]
}
},
{
"name": "xcrypt",
"os": "linux",
@@ -170,7 +177,7 @@
"unix": {
"filename": "libpng-1.6.37.tar.xz",
"hash": "sha256:505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca",
"urls": ["http://downloads.sourceforge.net/sourceforge/libpng/{filename}"]
"urls": ["https://downloads.sourceforge.net/sourceforge/libpng/{filename}"]
}
},
@@ -189,7 +196,7 @@
"unix": {
"filename": "graphite2-1.3.14.tgz",
"hash": "sha256:f99d1c13aa5fa296898a181dff9b82fb25f6cc0933dbaa7a475d8109bd54209d",
"urls": ["http://downloads.sourceforge.net/silgraphite/{filename}"]
"urls": ["https://downloads.sourceforge.net/silgraphite/{filename}"]
}
},
@@ -249,7 +256,7 @@
"unix": {
"filename": "fontconfig-2.13.1.tar.bz2",
"hash": "sha256:f655dd2a986d7aa97e052261b36aa67b0a64989496361eca8d604e6414006741",
"urls": ["http://www.fontconfig.org/release/{filename}"]
"urls": ["https://www.fontconfig.org/release/{filename}"]
}
},

View File

@@ -5,6 +5,10 @@
* Distributed under terms of the MIT license.
*/
.italic {
font-style: italic;
}
.sidebar-logo {
max-height: 128px;
}
@@ -17,3 +21,16 @@
.sidebar-tree a.current {
font-style: italic;
}
details > summary {
color: var(--color-link);
cursor: pointer;
text-decoration-color: var(--color-link-underline);
text-decoration-line: underline;
}
/* pygments adds an underline to some white-space, this is particularly visible in
* dark mode. Remove it. */
.highlight .w {
text-decoration: none
}

View File

@@ -22,7 +22,7 @@ function scroll_sidebar_node_into_view(a) {
a = a.offsetParent;
if (!a || a == ss) break;
}
ss.scrollTop = pos;
ss.scrollTo({top: pos, behavior: 'instant'});
}
function mark_current_link(sidebar_tree, a, onload) {

View File

@@ -4,6 +4,7 @@ Mappable actions
.. highlight:: conf
The actions described below can be mapped to any key press or mouse action
using the ``map`` and ``mouse_map`` directives in :file:`kitty.conf`.
using the ``map`` and ``mouse_map`` directives in :file:`kitty.conf`. For
configuration examples, see the default shortcut links for each action.
.. include:: /generated/actions.rst

View File

@@ -11,16 +11,20 @@ windows are:
Scrolling
~~~~~~~~~~~~~~
======================== =======================
========================= =======================
Action Shortcut
======================== =======================
Scroll line up :sc:`scroll_line_up` (also :kbd:`⌥+⌘+⇞` and :kbd:`⌘+↑` on macOS)
Scroll line down :sc:`scroll_line_down` (also :kbd:`⌥+⌘+⇟` and :kbd:`⌘+↓` on macOS)
Scroll page up :sc:`scroll_page_up` (also :kbd:`⌘+⇞` on macOS)
Scroll page down :sc:`scroll_page_down` (also :kbd:`⌘+⇟` on macOS)
Scroll to top :sc:`scroll_home` (also :kbd:`⌘+↖` on macOS)
Scroll to bottom :sc:`scroll_end` (also :kbd:`⌘+↘` on macOS)
======================== =======================
========================= =======================
Line up :sc:`scroll_line_up` (also :kbd:`⌥+⌘+⇞` and :kbd:`⌘+↑` on macOS)
Line down :sc:`scroll_line_down` (also :kbd:`⌥+⌘+⇟` and :kbd:`⌘+↓` on macOS)
Page up :sc:`scroll_page_up` (also :kbd:`⌘+⇞` on macOS)
Page down :sc:`scroll_page_down` (also :kbd:`⌘+⇟` on macOS)
Top :sc:`scroll_home` (also :kbd:`⌘+↖` on macOS)
Bottom :sc:`scroll_end` (also :kbd:`⌘+↘` on macOS)
Previous shell prompt :sc:`scroll_to_previous_prompt` (see :ref:`shell_integration`)
Next shell prompt :sc:`scroll_to_next_prompt` (see :ref:`shell_integration`)
Browse scrollback in less :sc:`show_scrollback`
Browse last cmd output :sc:`show_last_command_output` (see :ref:`shell_integration`)
========================= =======================
Tabs
~~~~~~~~~~~
@@ -30,8 +34,8 @@ Action Shortcut
======================== =======================
New tab :sc:`new_tab` (also :kbd:`⌘+t` on macOS)
Close tab :sc:`close_tab` (also :kbd:`⌘+w` on macOS)
Next tab :sc:`next_tab` (also :kbd:`^+⇥` and :kbd:`⇧+⌘+]` on macOS)
Previous tab :sc:`previous_tab` (also :kbd:`⇧+^+⇥` and :kbd:`⇧+⌘+[` on macOS)
Next tab :sc:`next_tab` (also :kbd:`+⇥` and :kbd:`⇧+⌘+]` on macOS)
Previous tab :sc:`previous_tab` (also :kbd:`⇧++⇥` and :kbd:`⇧+⌘+[` on macOS)
Next layout :sc:`next_layout`
Move tab forward :sc:`move_tab_forward`
Move tab backward :sc:`move_tab_backward`
@@ -53,6 +57,8 @@ Previous window :sc:`previous_window`
Move window forward :sc:`move_window_forward`
Move window backward :sc:`move_window_backward`
Move window to top :sc:`move_window_to_top`
Visually focus window :sc:`focus_visible_window`
Visually swap window :sc:`swap_with_window`
Focus specific window :sc:`first_window`, :sc:`second_window` ... :sc:`tenth_window`
(also :kbd:`⌘+1`, :kbd:`⌘+2` ... :kbd:`⌘+9` on macOS)
(clockwise from the top-left)
@@ -118,13 +124,13 @@ Paste from selection :sc:`paste_from_selection`
Increase font size :sc:`increase_font_size` (also :kbd:`⌘++` on macOS)
Decrease font size :sc:`decrease_font_size` (also :kbd:`⌘+-` on macOS)
Restore font size :sc:`reset_font_size` (also :kbd:`⌘+0` on macOS)
Toggle fullscreen :sc:`toggle_fullscreen` (also :kbd:`^+⌘+f` on macOS)
Toggle fullscreen :sc:`toggle_fullscreen` (also :kbd:`+⌘+f` on macOS)
Toggle maximized :sc:`toggle_maximized`
Input unicode character :sc:`input_unicode_character` (also :kbd:`^+⌘+space` on macOS)
Input unicode character :sc:`input_unicode_character` (also :kbd:`+⌘+space` on macOS)
Click URL using the keyboard :sc:`open_url`
Reset the terminal :sc:`reset_terminal`
Reload :file:`kitty.conf` :sc:`reload_config_file` (also :kbd:`^+⌘+f5` on macOS)
Debug :file:`kitty.conf` :sc:`debug_config` (also :kbd:`⌘+option+f6` on macOS)
Reload :file:`kitty.conf` :sc:`reload_config_file` (also :kbd:`+⌘+,` on macOS)
Debug :file:`kitty.conf` :sc:`debug_config` (also :kbd:`⌘++f6` on macOS)
Pass current selection to program :sc:`pass_selection_to_program`
Edit |kitty| config file :sc:`edit_config_file`
Open a |kitty| shell :sc:`kitty_shell`

View File

@@ -22,6 +22,11 @@ The binaries will be installed in the standard location for your OS,
Linux. The installer only touches files in that directory. To update kitty,
simply re-run the command.
.. warning::
**Do not** copy the kitty binary out of the installation folder. If you want
to add it to your ``PATH`` create a symlink in :file:`~/.local/bin` or
:file:`/usr/bin` or wherever.
Manually installing
---------------------
@@ -63,6 +68,25 @@ particular desktop, but it should work for most major desktop environments.
Customizing the installation
--------------------------------
.. _nightly:
* You can install the latest nightly kitty build with ``installer``:
.. parsed-literal::
:class: pre
|ins| \\
installer=nightly
If you want to install it in parallel to the released kitty specify a
different install locations with ``dest``:
.. parsed-literal::
:class: pre
|ins| \\
installer=nightly dest=/some/other/location
* You can specify a different install location, with ``dest``:
.. parsed-literal::
@@ -88,6 +112,7 @@ Customizing the installation
|ins| \\
installer=/path/to/dmg or tarball
Uninstalling
----------------

View File

@@ -5,10 +5,14 @@ Build from source
:alt: Build status
:target: https://github.com/kovidgoyal/kitty/actions?query=workflow%3ACI
.. highlight:: sh
|kitty| is designed to run from source, for easy hack-ability. Make sure
the following dependencies are installed first.
.. note::
If you just want to test the latest changes to kitty you dont need to build
from source. Instead install the :ref:`latest nightly build <nightly>`.
.. note::
If you are making small changes only to the python parts of kitty, there is no need to
@@ -30,6 +34,7 @@ Run-time dependencies:
* ``zlib``
* ``libpng``
* ``liblcms2``
* ``librsync``
* ``freetype`` (not needed on macOS)
* ``fontconfig`` (not needed on macOS)
* ``libcanberra`` (not needed on macOS)
@@ -41,10 +46,20 @@ Build-time dependencies:
* ``gcc`` or ``clang``
* ``pkg-config``
* For building on Linux in addition to the above dependencies you might also need to install the ``-dev`` packages for:
``libdbus-1-dev``, ``libxcursor-dev``, ``libxrandr-dev``, ``libxi-dev``, ``libxinerama-dev``,
``libgl1-mesa-dev``, ``libxkbcommon-x11-dev``, ``libfontconfig-dev``, ``libx11-xcb-dev``,
``liblcms2-dev``, and ``libpython3-dev``, if they are not already installed by your distro.
* For building on Linux in addition to the above dependencies you might also need to install the following packages, if they are not already installed by your distro:
- ``libdbus-1-dev``
- ``libxcursor-dev``
- ``libxrandr-dev``
- ``libxi-dev``
- ``libxinerama-dev``
- ``libgl1-mesa-dev``
- ``libxkbcommon-x11-dev``
- ``libfontconfig-dev``
- ``libx11-xcb-dev``
- ``liblcms2-dev``
- ``libpython3-dev``
- ``librsync-dev``
Install and run from source
@@ -84,13 +99,18 @@ you might have to rebuild the app.
`bypy framework <https://github.com/kovidgoyal/bypy>`_ however, that is
designed to run on Linux and is not for the faint of heart.
.. note::
Apple disallows certain functionality, such as notifications for unsigned applications.
If you need this functionality, you can try signing the built kitty.app with
a self signed certificate, see for example, `here
<https://stackoverflow.com/questions/27474751/how-can-i-codesign-an-app-without-being-in-the-mac-developer-program/27474942>`_.
.. note::
If you are facing issues with ``linker`` while building,
try with a ``brew`` installed python instead, see :iss:`289`
for more discussion.
Build and run from source with Nix
-------------------------------------------
@@ -105,7 +125,9 @@ make them available in the newly spawned shell.
Then proceed with ``make`` or ``make app`` according to the platform specific instructions above.
Note for Linux/macOS packagers
.. _packagers:
Notes for Linux/macOS packagers
----------------------------------
The released |kitty| source code is available as a `tarball`_ from
@@ -125,10 +147,21 @@ with :file:`linux-package/bin/kitty`. All the files needed to run kitty will be
installed. You can choose a different staging area, by passing the ``--prefix``
argument to :file:`setup.py`.
You should probably split |kitty| into two packages, :file:`kitty-terminfo` that
installs the terminfo file and :file:`kitty` that installs the main program.
This allows users to install the terminfo file on servers into which they ssh,
without needing to install all of |kitty|.
You should probably split |kitty| into three packages:
:code:`kitty-terminfo`
installs the terminfo file
:code:`kitty-shell-integration`
installs the shell integration scripts (the contents of the
shell-integration directory in the kitty source code, probably to
:file:`/usr/share/kitty/shell-integration`
:code:`kitty`
installs the main program
This allows users to install the terminfo and shell integration files on
servers into which they ssh, without needing to install all of |kitty|.
.. note::
You need a couple of extra dependencies to build linux-package.
@@ -143,7 +176,29 @@ This applies to creating packages for |kitty| for macOS package managers such as
brew or MacPorts as well.
.. note::
Changing defaults for packages
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|kitty| has its defaults chosen to be suitable for a standalone distributable.
If you are packaging it a few of these might need to be changed.
update-checking
|kitty| has its own update check mechanism, if you would like to turn
it off for your package, use
``python3 setup.py linux-package --update-check-interval=0``
it off for your package, use::
./setup.py linux-package --update-check-interval=0
shell-integration
|kitty| by default injects its :ref:`shell_integration` code into the user's
shell using environment variables or (for bash only) modifying
the user's :file:`~/.bashrc` file.
For a package, it might make more sense to distribute the shell
integration scripts into the system-wide shell vendor locations. The
shell integration files are found in the :file:`shell-integration`
directory. Copy them to the system wide shell vendor locations for each
shell, and use::
./setup.py linux-package --shell-integration=enabled\ no-rc
This will prevent kitty from modifying the user's shell environment to load
the integration scripts.

View File

@@ -4,8 +4,315 @@ Changelog
|kitty| is a feature-rich, cross-platform, *fast*, GPU based terminal.
To update |kitty|, :doc:`follow the instructions <binary>`.
Recent major new features
---------------------------
.. only:: dirhtml
A demo video
~~~~~~~~~~~~~~~~
A new video showcasing some of kitty's many productivity enhancing features.
.. raw:: html
<video controls width="640" height="360">
<source src="https://download.calibre-ebook.com/videos/kitty.mp4" type="video/mp4">
<source src="https://download.calibre-ebook.com/videos/kitty.webm" type="video/webm">
</video>
.. rst-class:: caption caption-text
Watch kitty in action!
Shell integration
~~~~~~~~~~~~~~~~~~~~~
kitty automatically integrates with common shells to allow browsing the
output of the previous command in a pager by pressing
:sc:`show_last_command_output`, jumping to previous prompt locations in the
scrollback by pressing :sc:`scroll_to_previous_prompt` and clicking with the
mouse anywhere in the current command to move the cursor there. See
:doc:`shell-integration` for details.
Logos for windows
~~~~~~~~~~~~~~~~~~~~
kitty has the ability to display arbitrary ``PNG`` images at the corner
of any kitty window to serve as a *logo* for quick window identification.
Can be controlled via :opt:`window_logo_path` and also and changed via
the :ref:`at_set-window-logo` remote control command.
Useful to quickly identify special windows or just for some *bling*.
.. figure:: screenshots/window-logo.png
:alt: A screenshot of the kitty shell window showing the kitty logo
:align: center
:width: 100%
A screenshot of the kitty shell window showing the kitty logo
Visual keyboard based window select
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Select a kitty window visually using the keyboard, like the
:doc:`kittens/hints`, but for kitty windows. Can also be used from shell
scripts/third party integrations via the :ref:`at_select-window` remote control
command.
.. figure:: screenshots/select-window.png
:alt: A screenshot of the kitty select window function
:align: center
:width: 100%
Hints for selecting kitty windows visually
Detailed list of changes
-------------------------------------
0.24.1 [2022-01-06]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Shell integration: Work around conflicts with some zsh plugins (:iss:`4428`)
- Have the zero width space and various other characters from the *Other,
formatting* Unicode category be treated as combining characters (:iss:`4439`)
- Fix using ``--shell-integration`` with :file:`setup.py` broken (:iss:`4434`)
- Fix showing debug information not working if kitty's :file:`STDIN` is not a tty
(:iss:`4424`)
- Linux: Fix a regression that broke rendering of emoji with variation selectors
(:iss:`4444`)
0.24.0 [2022-01-04]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Integrate kitty closely with common shells such as zsh, fish and bash.
This allows lots of niceties such as jumping to previous prompts, opening the
output of the last command in a new window, etc. See :ref:`shell_integration`
for details. Packagers please read :ref:`packagers`.
- A new shortcut :sc:`focus_visible_window` to visually focus a window using
the keyboard. Pressing it causes numbers to appear over each visible window
and you can press the number to focus the corresponding window (:iss:`4110`)
- A new facility :opt:`window_logo_path` to draw an arbitrary PNG image as
logo in the corner of a kitty window (:pull:`4167`)
- Allow rendering the cursor with a *reverse video* effect. See :opt:`cursor`
for details (:iss:`126`)
- Allow rendering the mouse selection with a *reverse video* effect. See
:opt:`selection_foreground` (:iss:`646`)
- A new option :opt:`tab_bar_align` to draw the tab bar centered or right
aligned (:iss:`3946`)
- Allow the user to supply a custom Python function to draw tab bar. See
:opt:`tab_bar_style`
- A new remote control command to :program:`change the tab color <kitty @
set-tab-color>` (:iss:`1287`)
- A new remote control command to :program:`visually select a window <kitty @
select-window>` (:iss:`4165`)
- Add support for reporting mouse events with pixel co-ordinates using the
``SGR_PIXEL_PROTOCOL`` introduced in xterm 359
- When programs ask to read from the clipboard prompt, ask the user to allow
the request by default instead of denying it by default. See
:opt:`clipboard_control` for details (:iss:`4022`)
- A new mappable action ``swap_with_window`` to swap the current window with another window in the tab, visually
- A new :program:`remote control command <kitty @ set-enabled-layouts>` to change
the enabled layouts in a tab (:iss:`4129`)
- A new option :opt:`bell_path` to specify the path to a sound file
to use as the bell sound
- A new option :opt:`exe_search_path` to modify the locations kitty searches
for executables to run (:iss:`4324`)
- broadcast kitten: Show a "fake" cursor in all windows being broadcast too
(:iss:`4225`)
- Allow defining :opt:`aliases <action_alias>` for more general actions, not just kittens
(:pull:`4260`)
- Fix a regression that caused :option:`kitty --title` to not work when
opening new OS windows using :option:`kitty --single-instance` (:iss:`3893`)
- icat kitten: Fix display of JPEG images that are rotated via EXIF data and
larger than available screen size (:iss:`3949`)
- macOS: Fix SIGUSR1 quitting kitty instead of reloading the config file (:iss:`3952`)
- Launch command: Allow specifying the OS window title
- broadcast kitten: Allow broadcasting :kbd:`ctrl+c` (:pull:`3956`)
- Fix space ligatures not working with Iosevka for some characters in the
Enclosed Alphanumeric Supplement (:iss:`3954`)
- hints kitten: Fix a regression that caused using the default open program
to trigger open actions instead of running the program (:iss:`3968`)
- Allow deleting environment variables in :opt:`env` by specifying
just the variable name, without a value
- Fix :opt:`active_tab_foreground` not being honored when :opt:`tab_bar_style`
is ``slant`` (:iss:`4053`)
- When a :opt:`tab_bar_background` is specified it should extend to the edges
of the OS window (:iss:`4054`)
- Linux: Fix IME with fcitx5 not working after fcitx5 is restarted
(:pull:`4059`)
- Various improvements to IME integration (:iss:`4219`)
- Remote file transfer: Fix transfer not working if custom ssh port or identity
is specified on the command line (:iss:`4067`)
- Unicode input kitten: Implement scrolling when more results are found than
the available display space (:pull:`4068`)
- Allow middle clicking on a tab to close it (:iss:`4151`)
- The command line option ``--watcher`` has been deprecated in favor of the
:opt:`watcher` option in :file:`kitty.conf`. It has the advantage of
applying to all windows, not just the initially created ones. Note that
``--watcher`` now also applies to all windows, not just initially created ones.
- **Backward incompatibility**: No longer turn on the kitty extended keyboard
protocol's disambiguate mode when the client sends the XTMODKEYS escape code.
Applications must use the dedicated escape code to turn on the protocol.
(:iss:`4075`)
- Fix soft hyphens not being preserved when round tripping text through the
terminal
- macOS: Fix :kbd:`ctrl+shift` with :kbd:`Esc` or :kbd:`F1` - :kbd:`F12` not working
(:iss:`4109`)
- macOS: Fix :opt:`resize_in_steps` not working correctly on high DPI screens
(:iss:`4114`)
- Fix the :program:`resize OS Windows <kitty @ resize-os-window>` setting a
slightly incorrect size on high DPI screens (:iss:`4114`)
- :program:`kitty @ launch` - when creating tabs with the ``--match`` option create
the tab in the OS Window containing the result of the match rather than
the active OS Window (:iss:`4126`)
- Linux X11: Add support for 10bit colors (:iss:`4150`)
- Fix various issues with changing :opt:`tab_bar_background` by remote control
(:iss:`4152`)
- A new option :opt:`tab_bar_margin_color` to control the color of the tab bar
margins
- A new option :opt:`visual_bell_color` to customize the color of the visual bell
(:pull:`4181`)
- Add support for OSC 777 based desktop notifications
- Wayland: Fix pasting from applications that use a MIME type of "text/plain"
rather than "text/plain;charset=utf-8" not working (:iss:`4183`)
- A new mappable action to close windows with a confirmation (:iss:`4195`)
- When remembering OS window sizes for full screen windows use the size before
the window became fullscreen (:iss:`4221`)
- macOS: Fix keyboard input not working after toggling fullscreen till the
window is clicked in
- A new mappable action ``nth_os_window`` to to focus the specified nth OS
window. (:pull:`4316`)
- macOS: The kitty window can be scrolled by the mouse wheel when OS window not
in focus. (:pull:`4371`)
- macOS: Light or dark system appearance can be specified in
:opt:`macos_titlebar_color` and used in kitty themes. (:pull:`4378`)
0.23.1 [2021-08-17]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- macOS: Fix themes kitten failing to download themes because of missing SSL
root certificates (:iss:`3936`)
- A new option :opt:`clipboard_max_size` to control the maximum size
of data that kitty will transmit to the system clipboard on behalf of
programs running inside it (:iss:`3937`)
- When matching windows/tabs in kittens or using remote control, allow matching
by recency. ``recent:0`` matches the active window/tab, ``recent:1`` matches
the previous window/tab and so on
- themes kitten: Fix only the first custom theme file being loaded correctly
(:iss:`3938`)
0.23.0 [2021-08-16]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- A new :doc:`themes kitten </kittens/themes>` to easily change kitty themes.
Choose from almost two hundred themes in the `kitty themes repository
<https://github.com/kovidgoyal/kitty-themes>`_
- A new style for the tab bar that makes tabs looks like the tabs in a physical
tabbed file, see :opt:`tab_bar_style`
- Make the visual bell flash more gentle, especially on dark themes
(:pull:`2937`)
- Fix :option:`kitty --title` not overriding the OS Window title when multiple
tabs are present. Also this option is no longer used as the default title for
windows, allowing individual tabs/windows to have their own titles, even when
the OS Window has a fixed overall title (:iss:`3893`)
- Linux: Fix some very long ligatures being rendered incorrectly at some font
sizes (:iss:`3896`)
- Fix shift+middle click to paste sending a mouse press event but no release
event which breaks some applications that grab the mouse but cant handle
mouse events (:iss:`3902`)
- macOS: When the language is set to English and the country to one for which
an English locale does not exist, set :envvar:`LANG` to ``en_US.UTF-8``
(:iss:`3899`)
- terminfo: Fix "cnorm" the property for setting the cursor to normal using a
solid block rather than a blinking block cursor (:iss:`3906`)
- Add :opt:`clear_all_mouse_actions` to clear all mouse actions defined to
that point (:iss:`3907`)
- Fix the remote file kitten not working when using -- with ssh. The ssh kitten
was recently changed to do this (:iss:`3929`)
- When dragging word or line selections, ensure the initially selected item is
never deselected. This matches behavior in most other programs (:iss:`3930`)
- hints kitten: Make copy/paste with the :option:`kitty +kitten hints
--program` option work when using the ``self``
:option:`kitty +kitten hints --linenum-action` (:iss:`3931`)
0.22.2 [2021-08-02]
----------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- macOS: Fix a long standing bug that could cause kitty windows to stop
updating, that got worse in the previous release (:iss:`3890` and
@@ -16,7 +323,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.22.1 [2021-07-31]
----------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Fix a regression in the previous release that broke ``kitty --help`` (:iss:`3869`)
@@ -39,7 +346,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.22.0 [2021-07-26]
----------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Add a new :ref:`action-toggle_layout` action to easily zoom/unzoom a window
@@ -109,7 +416,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.21.2 [2021-06-28]
----------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- A new :opt:`adjust_baseline` option to adjust the vertical alignment of text
inside a line (:pull:`3734`)
@@ -152,7 +459,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.21.1 [2021-06-14]
----------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- macOS: Fix a regression in the previous release that broke rendering of
strikeout (:iss:`3717`)
@@ -165,7 +472,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.21.0 [2021-06-12]
----------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Allow reloading the :file:`kitty.conf` config file by pressing
:sc:`reload_config_file`. (:iss:`1292`)
@@ -197,7 +504,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- Unicode input kitten: Fix a regression in 0.20.0 that broke keyboard handling
when the NumLock or CapsLock modifiers were engaged. (:iss:`3587`)
- Fix a regression in 0.20.0 that sent incorrect bytes for the :kbd:`F1-F4` keys
- Fix a regression in 0.20.0 that sent incorrect bytes for the :kbd:`F1`-:kbd:`F4` keys
in rmkx mode (:iss:`3586`)
- macOS: When the Apple Color Emoji font lacks an emoji glyph search for it in other
@@ -258,7 +565,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.20.3 [2021-05-06]
----------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- macOS: Distribute universal binaries with both ARM and Intel architectures
@@ -279,7 +586,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.20.2 [2021-04-28]
----------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- A new protocol extension to :ref:`unscroll <unscroll>` text from the
scrollback buffer onto the screen. Useful, for example, to restore
@@ -319,7 +626,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.20.1 [2021-04-19]
----------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- icat: Fix some broken GIF images with no frame delays not being animated
(:iss:`3498`)
@@ -332,7 +639,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.20.0 [2021-04-19]
----------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Support display of animated images ``kitty +kitten icat animation.gif``. See
:ref:`animation_protocol` for details on animation support in the kitty
@@ -456,7 +763,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.19.3 [2020-12-19]
-------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Happy holidays to all kitty users!
@@ -518,7 +825,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.19.2 [2020-11-13]
-------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- A new :doc:`kittens/query_terminal` kitten to easily query the running kitty
via escape codes to detect its version, and the values of
@@ -561,7 +868,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.19.1 [2020-10-06]
-------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- hints kitten: Add an ``ip`` type for easy selection of IP addresses
(:pull:`3009`)
@@ -573,7 +880,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.19.0 [2020-10-04]
-------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Add support for `hyperlinks from terminal programs
<https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda>`_.
@@ -645,7 +952,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.18.3 [2020-08-11]
-------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- hints kitten: Allow customizing hint colors (:pull:`2894`)
@@ -666,7 +973,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.18.2 [2020-07-28]
--------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- X11: Improve handling of multiple keyboards. Now pressing a modifier key in
one keyboard and a normal key in another works (:iss:`2362`). Don't rebuild
@@ -731,13 +1038,13 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.18.1 [2020-06-23]
--------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- macOS: Fix for diff kitten not working with python 3.8 (:iss:`2780`)
0.18.0 [2020-06-20]
--------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Allow multiple overlay windows per normal window
@@ -788,7 +1095,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.17.4 [2020-05-09]
--------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Allow showing the name of the current layout and the number of windows
in tab titles (:iss:`2634`)
@@ -815,7 +1122,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.17.3 [2020-04-23]
--------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Allow individually setting margins and padding for each edge (left, right,
top, bottom). Margins can also be controlled per window via remote control
@@ -869,7 +1176,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- Fix :option:`--title` not being applied at window creation time (:iss:`2570`)
0.17.2 [2020-03-29]
--------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Add a :option:`launch --watcher` option that allows defining callbacks
that are called for various events in the window's life-cycle (:iss:`2440`)
@@ -900,7 +1207,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.17.1 [2020-03-24]
--------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Fix :opt:`cursor_underline_thickness` not working (:iss:`2465`)
@@ -915,7 +1222,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.17.0 [2020-03-24]
--------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- :ref:`splits_layout` to arrange windows in arbitrary splits
(:iss:`2308`)
@@ -1006,7 +1313,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.16.0 [2020-01-28]
--------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- A new :doc:`marks` feature that allows highlighting and scrolling to arbitrary
text in the terminal window.
@@ -1053,7 +1360,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
them. (:iss:`2310`)
0.15.1 [2019-12-21]
--------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Fix a crash/incorrect rendering when detaching a window in some circumstances
(:iss:`2173`)
@@ -1078,7 +1385,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.15.0 [2019-11-27]
--------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Add a new action :ref:`detach_window <detach_window>` that can be used to move the current
window into a different tab (:iss:`1310`)
@@ -1128,7 +1435,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.14.6 [2019-09-25]
---------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- macOS: Fix a regression in the previous release that caused a crash when
pressing a unprintable key, such as the POWER key (:iss:`1997`)
@@ -1138,7 +1445,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.14.5 [2019-09-23]
---------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Implement a hack to (mostly) preserve tabs when cat-ting a file with them and then
copying the text or passing screen contents to another program (:iss:`1829`)
@@ -1161,7 +1468,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- Use selection foreground color for underlines as well (:iss:`1982`)
0.14.4 [2019-08-31]
---------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- hints kitten: Add a :option:`kitty +kitten hints --alphabet` option to
control what alphabets are used for hints (:iss:`1879`)
@@ -1200,7 +1507,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.14.3 [2019-07-29]
---------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Remote control: Add a command `kitty @ scroll-window` to scroll windows
@@ -1255,7 +1562,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.14.2 [2019-06-09]
---------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Add an option :opt:`placement_strategy` to control how the cell area is
aligned inside the window when the window size is not an exact multiple
@@ -1297,7 +1604,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.14.1 [2019-05-29]
---------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Add an option :opt:`command_on_bell` to run an arbitrary command when
a bell occurs (:iss:`1660`)
@@ -1332,7 +1639,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.14.0 [2019-05-24]
---------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- macOS: The default behavior of the Option key has changed. It now generates
unicode characters rather than acting as the :kbd:`Alt` modifier. See
@@ -1467,7 +1774,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
characters not working well (:iss:`1616`)
0.13.3 [2019-01-19]
------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- icat kitten: Add a ``--stdin`` option to control if image data is read from
STDIN (:iss:`1308`)
@@ -1505,7 +1812,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.13.2 [2019-01-04]
------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Add a new option :opt:`tab_title_template` to control how tab titles
are formatted. In particular the template can be used to display
@@ -1547,7 +1854,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.13.1 [2018-12-06]
------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Fix passing input via the pipe action to a program without a window not
working.
@@ -1560,7 +1867,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
be properly unwrapped (:iss:`1206`)
0.13.0 [2018-12-05]
------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Add an option :opt:`scrollback_pager_history_size` to tell kitty to store
extended scrollback to use when viewing the scrollback buffer in a pager
@@ -1657,7 +1964,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
and slash characters in short URLs (:iss:`1201`)
0.12.3 [2018-09-29]
------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- macOS: Fix kitty window not being rendered on macOS Mojave until the window is
moved or resized at least once (:iss:`887`)
@@ -1666,7 +1973,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.12.2 [2018-09-24]
------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- A new ``last_used_layout`` function that can be mapped to a shortcut to
switch to the previously used window layout (:iss:`870`)
@@ -1733,7 +2040,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
mouse to malfunction when using multiple kitty windows (:iss:`1002`)
0.12.1 [2018-09-08]
------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Add a new ``--start-in-fullscreen`` command line flag to start
kitty in full screen mode (:iss:`856`)
@@ -1776,7 +2083,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
a bug in the 0.12.0 macOS package
0.12.0 [2018-09-01]
------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Preserve the mouse selection even when the contents of the screen are
scrolled or overwritten provided the new text does not intersect the
@@ -1786,7 +2093,8 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
using standard keyboards) via `IBus
<https://github.com/ibus/ibus/wiki/ReadMe>`_ (:iss:`469`)
- Implement completion for the kitty command in bash and zsh
- Implement completion for the kitty command in bash and zsh. See
:ref:`shell_integration`.
- Render the text under the cursor in a fixed color, configurable via
the option :opt:`cursor_text_color` (:iss:`126`)
@@ -1850,7 +2158,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.11.3 [2018-07-10]
------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Draw only the minimum borders needed for inactive windows. That is only the borders
that separate the inactive window from a neighbor. Note that setting
@@ -1884,7 +2192,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.11.2 [2018-07-01]
------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Linux: Allow using XKB key names to bind shortcuts to keys not supported by GLFW (:pull:`665`)
@@ -1921,7 +2229,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.11.1 [2018-06-17]
------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- diff kitten: Implement searching for text in the diff (:iss:`574`)
@@ -1949,7 +2257,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.11.0 [2018-06-12]
------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- A new tab bar style "fade" in which each tab's edges fade into the background.
See :opt:`tab_bar_style` and :opt:`tab_fade` for details. The old look can be
@@ -2040,7 +2348,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.10.1 [2018-05-24]
------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Add a kitten to easily ssh into servers that automatically copies the
terminfo files over. ``kitty +kitten ssh myserver``.
@@ -2065,7 +2373,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.10.0 [2018-05-21]
------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- A diff kitten to show side-by-side diffs with syntax highlighting and support
for images. See :doc:`diff kitten <kittens/diff>`.
@@ -2115,7 +2423,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.9.1 [2018-05-05]
------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Show a bell symbol on the tab if a bell occurs in one of the windows in the tab and
the window is not the currently focused window
@@ -2183,7 +2491,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.9.0 [2018-04-15]
------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- A new kitty command shell to allow controlling kitty via commands. Press
`ctrl+shift+escape` to run the shell.
@@ -2227,7 +2535,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.8.4 [2018-03-31]
-----------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Fix presence of XDG_CONFIG_DIRS and absence of XDG_CONFIG_HOME preventing
kitty from starting
@@ -2237,7 +2545,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.8.3 [2018-03-29]
-----------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Fix a regression that broke the visual bell and invert screen colors escape
code
@@ -2262,7 +2570,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.8.2 [2018-03-17]
-----------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Allow extending existing selections by right clicking
@@ -2285,7 +2593,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
- Fix a crash when getting the contents of the scrollback buffer as text
0.8.1 [2018-03-09]
-----------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Extend kitty's remote control feature to work over both UNIX and TCP sockets,
so now you can control kitty from across the internet, if you want to.
@@ -2317,7 +2625,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.8.0 [2018-02-24]
-----------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- A framework for kittens, that is, small terminal programs designed to run
inside kitty and extend its capabilities. Examples include unicode input and
@@ -2362,7 +2670,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
new window/tab.
0.7.1 [2018-01-31]
---------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Add an option to adjust the width of character cells
@@ -2374,7 +2682,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.7.0 [2018-01-24]
---------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Allow controlling kitty from the shell prompt/scripts. You can
open/close/rename windows and tabs and even send input to specific windows.
@@ -2419,7 +2727,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.6.1 [2017-12-28]
---------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Add an option to fade the text in inactive windows
@@ -2447,7 +2755,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.6.0 [2017-12-18]
---------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Support background transparency via the background_opacity option. Provided
that your OS/window manager supports transparency, you can now have kitty
@@ -2498,7 +2806,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.5.1 [2017-12-01]
---------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Add an option to control the thickness of lines in box drawing characters
@@ -2515,7 +2823,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.5.0 [2017-11-19]
---------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Add support for ligature fonts such as Fira Code, Hasklig, etc. kitty now
uses harfbuzz for text shaping which allow it to support advanced OpenType
@@ -2549,7 +2857,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.4.2 [2017-10-23]
---------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Fix a regression in 0.4.0 that broke custom key mappings
@@ -2560,7 +2868,7 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
0.4.0 [2017-10-22]
---------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Support for drawing arbitrary raster graphics (images) in the terminal via a
new graphics protocol. kitty can draw images with full 32-bit color using both

View File

@@ -21,8 +21,11 @@ from pygments.lexer import RegexLexer, bygroups # type: ignore
from pygments.token import ( # type: ignore
Comment, Keyword, Literal, Name, Number, String, Whitespace
)
from sphinx import addnodes, version_info # type: ignore
from sphinx.util.logging import getLogger # type: ignore
from sphinx import addnodes, version_info
from sphinx.builders.html.transforms import KeyboardTransform
from sphinx.util.logging import getLogger
KeyboardTransform.builders = ('html', 'dirhtml') # type: ignore
kitty_src = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
if kitty_src not in sys.path:
@@ -98,13 +101,10 @@ rst_prolog = '''
.. |kitty| replace:: *kitty*
.. |version| replace:: VERSION
.. _tarball: https://github.com/kovidgoyal/kitty/releases/download/vVERSION/kitty-VERSION.tar.xz
.. role:: green
.. role:: italic
.. role:: bold
.. role:: cyan
.. role:: title
'''.replace('VERSION', str_version)
smartquotes_action = 'qe' # educate quotes and ellipses but not dashes
# -- Options for HTML output -------------------------------------------------
@@ -170,7 +170,9 @@ texinfo_documents = [
# GitHub linking inline roles {{{
def num_role(which: str, name: str, rawtext: str, text: str, lineno: int, inliner: Any, options: Any = {}, content: Any = []) -> Tuple[List, List]:
def num_role(
which: str, name: str, rawtext: str, text: str, lineno: int, inliner: Any, options: Any = {}, content: Any = []
) -> Tuple[List[nodes.reference], List[nodes.problematic]]:
' Link to a github issue '
try:
issue_num = int(text)
@@ -188,7 +190,9 @@ def num_role(which: str, name: str, rawtext: str, text: str, lineno: int, inline
return [node], []
def commit_role(name: str, rawtext: str, text: str, lineno: int, inliner: Any, options: Any = {}, content: Any = []) -> Tuple[List, List]:
def commit_role(
name: str, rawtext: str, text: str, lineno: int, inliner: Any, options: Any = {}, content: Any = []
) -> Tuple[List[nodes.reference], List[nodes.problematic]]:
' Link to a github commit '
try:
commit_id = subprocess.check_output(
@@ -264,7 +268,7 @@ def write_remote_control_protocol_docs() -> None: # {{{
)
field_pat = re.compile(r'\s*([a-zA-Z0-9_+]+)\s*:\s*(.+)')
def format_cmd(p: Callable, name: str, cmd: RemoteCommand) -> None:
def format_cmd(p: Callable[..., None], name: str, cmd: RemoteCommand) -> None:
p(name)
p('-' * 80)
lines = (cmd.__doc__ or '').strip().splitlines()
@@ -304,7 +308,7 @@ def write_remote_control_protocol_docs() -> None: # {{{
# config file docs {{{
class ConfLexer(RegexLexer):
class ConfLexer(RegexLexer): # type: ignore
name = 'Conf'
aliases = ['conf']
filenames = ['*.conf']
@@ -343,7 +347,7 @@ class ConfLexer(RegexLexer):
}
class SessionLexer(RegexLexer):
class SessionLexer(RegexLexer): # type: ignore
name = 'Session'
aliases = ['session']
filenames = ['*.session']
@@ -359,7 +363,9 @@ class SessionLexer(RegexLexer):
}
def link_role(name: str, rawtext: str, text: str, lineno: int, inliner: Any, options: Any = {}, content: Any = []) -> Tuple[List, List]:
def link_role(
name: str, rawtext: str, text: str, lineno: int, inliner: Any, options: Any = {}, content: Any = []
) -> Tuple[List[nodes.reference], List[nodes.problematic]]:
text = text.replace('\n', ' ')
m = re.match(r'(.+)\s+<(.+?)>', text)
if m is None:
@@ -376,7 +382,7 @@ def link_role(name: str, rawtext: str, text: str, lineno: int, inliner: Any, opt
def expand_opt_references(conf_name: str, text: str) -> str:
conf_name += '.'
def expand(m: Match) -> str:
def expand(m: Match[str]) -> str:
ref = m.group(1)
if '<' not in ref and '.' not in ref:
full_ref = conf_name + ref
@@ -518,3 +524,7 @@ def setup(app: Any) -> None:
app.add_role('pull', partial(num_role, 'pull'))
app.add_role('disc', partial(num_role, 'discussions'))
app.add_role('commit', commit_role)
# monkey patch sphinx_inline_tabs to avoid a warning about parallel reads
# see https://github.com/pradyunsg/sphinx-inline-tabs/issues/26
inline_tabs = app.extensions['sphinx_inline_tabs']
inline_tabs.parallel_read_safe = inline_tabs.parallel_write_safe = True

View File

@@ -9,8 +9,9 @@ possibilities.
You can open the config file within kitty by pressing :sc:`edit_config_file`.
You can reload the config file within kitty by pressing
:sc:`reload_config_file` or sending kitty the ``SIGUSR1`` signal. You can also
display the current configuration by pressing the :sc:`debug_config` key.
:sc:`reload_config_file` (:kbd:`⌃+⌘+,` on macOS) or sending kitty the ``SIGUSR1`` signal.
You can also display the current configuration by pressing the :sc:`debug_config`
(:kbd:`⌘+⌥+f6` on macOS) key.
.. _confloc:

View File

@@ -51,6 +51,9 @@ type it each time::
alias ssh="kitty +kitten ssh"
Remember to also setup :ref:`shell_integration` for completion and other
niceties.
If for some reason that does not work (typically because the server is using a
non POSIX compliant shell as ``/bin/sh``), you can try using it with ``python``
instead::
@@ -117,9 +120,14 @@ explicitly set a UTF-8 locale, like::
How do I change the colors in a running kitty instance?
------------------------------------------------------------
You can either use the
`OSC terminal escape codes <https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands>`_
to set colors or you can define keyboard shortcuts to set colors, for example::
The easiest way to do it is to use the :doc:`themes kitten </kittens/themes>`,
to choose a new color theme. Simply run::
kitty +kitten themes
And choose your theme from the list.
You can also define keyboard shortcuts to set colors, for example::
map f1 set_colors --configured /path/to/some/config/file/colors.conf
@@ -127,10 +135,9 @@ Or you can enable :doc:`remote control <remote-control>` for |kitty| and use :re
The shortcut mapping technique has the same syntax as the remote control
command, for details, see :ref:`at_set-colors`.
A list of pre-made color themes for kitty is available at:
`kitty-themes <https://github.com/dexpota/kitty-themes>`_
Examples of using OSC escape codes to set colors::
Additionally, You can use the
`OSC terminal escape codes <https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands>`_
to set colors. Examples of using OSC escape codes to set colors::
Change the default foreground color:
printf '\x1b]10;#ff0000\x1b\\'
@@ -185,13 +192,22 @@ If you do want to cat unknown data, use ``cat -v``.
kitty is not able to use my favorite font?
---------------------------------------------
|kitty| achieves its stellar performance by caching alpha masks of each rendered
character on the GPU, so that every character needs to be rendered only once.
This means it is a strictly character cell based display. As such it can use
only monospace fonts, since every cell in the grid has to be the same size.
|kitty| achieves its stellar performance by caching alpha masks of each
rendered character on the GPU, and rendering them all in parallel. This means
it is a strictly character cell based display. As such it can use only
monospace fonts, since every cell in the grid has to be the same size.
Furthermore, it needs fonts to be freely resizable, so it does not support
bitmapped fonts.
.. note::
If you are trying to use a font patched with NERD font symbols, dont do that
as patching destroys fonts. There is no need, simply install the standalone
NERD font, kitty should pick up symbols from it automatically, and you can
tell it to do so explicitly in case it doesnt with the :opt:`symbol_map`
directive::
symbol_map U+23FB-U+23FE,U+2B58,U+E200-U+E2A9,U+E0A0-U+E0A3,U+E0B0-U+E0BF,U+E0C0-U+E0C8,U+E0CC-U+E0CF,U+E0D0-U+E0D2,U+E0D4,U+E700-U+E7C5,U+F000-U+F2E0,U+2665,U+26A1,U+F400-U+F4A8,U+F67C,U+E000-U+E00A,U+F300-U+F313,U+E5FA-U+E62B Symbols Nerd Font
If your font is not listed in ``kitty list-fonts`` it means that it is not
monospace or is a bitmapped font. On Linux you can list all monospace fonts with::
@@ -232,6 +248,37 @@ terminal) in different environments,
see `here <https://github.com/kovidgoyal/kitty/issues/45>`_.
I do not like the kitty icon!
-------------------------------
There are many alternate icons available, click on an icon to visit its
homepage:
.. image:: https://github.com/k0nserv/kitty-icon/raw/main/icon_512x512.png
:target: https://github.com/k0nserv/kitty-icon
:width: 256
.. image:: https://github.com/DinkDonk/kitty-icon/raw/main/kitty-dark.png
:target: https://github.com/DinkDonk/kitty-icon
:width: 256
.. image:: https://github.com/DinkDonk/kitty-icon/raw/main/kitty-light.png
:target: https://github.com/DinkDonk/kitty-icon
:width: 256
.. image:: https://github.com/hristost/kitty-alternative-icon/raw/main/kitty_icon.png
:target: https://github.com/hristost/kitty-alternative-icon
:width: 256
On macOS you can change the icon by following the steps:
#. Find :file:`kitty.app` in the Applications folder, select it and press :kbd:`⌘+i`
#. Drag :file:`kitty.icns` onto the application icon in the kitty info pane
#. Delete the icon cache and restart Dock::
$ rm /var/folders/*/*/*/com.apple.dock.iconcache; killall Dock
How do I map key presses in kitty to different keys in the terminal program?
--------------------------------------------------------------------------------------
@@ -253,7 +300,7 @@ How do I open a new window or tab with the same working directory as the current
In :file:`kitty.conf` add the following::
map f1 launch --cwd=current
map f2 launch --cwd=current --type=tab
map f2 launch --cwd=current --type=tab
Pressing :kbd:`F1` will open a new kitty window with the same working directory
as the current window. The :doc:`launch command <launch>` is very powerful,
@@ -299,6 +346,9 @@ If you still want to use tmux, read on.
Image display will not work, see `tmux issue
<https://github.com/tmux/tmux/issues/1391>`_.
Using ancient versions of tmux such as 1.8 will
cause gibberish on screen when pressing keys (:iss:`3541`).
If you are using tmux with multiple terminals or you start it under one
terminal and then switch to another and these terminals have different TERM
variables, tmux will break. You will need to restart it as tmux does not
@@ -345,3 +395,28 @@ remaining used memory can be investigated using valgrind again, and it will
come from arenas in the GPU drivers and the per thread arenas glibc's malloc
maintains. These too allocate memory in large blocks and dont release it back
to the OS immediately.
Why does kitty sometimes start slowly on my Linux system?
-------------------------------------------------------------------------------------------
|kitty| takes no longer (within 100ms) to start than other similar GPU terminal
emulators, (and may be faster than some). If |kitty| occasionally takes a long
time to start, it could be a power management issue with the graphics card. On
a multi-GPU system (which many modern laptops are, having a power efficient GPU
that's built into the processor and a power hungry dedicated one that's usually
off), even if the answer of the GPU will only be "don't use me".
For example, if you have a system with an AMD CPU and an NVIDIA GPU, and you
know that you want to use the lower powered card to save battery life and
because kitty does not require a powerful GPU to function, you can choose not
to wake up the dedicated card, which has been reported on at least one system
(:iss:`4292`) to take ≈2 seconds, by running |kitty| as::
MESA_LOADER_DRIVER_OVERRIDE=radeonsi __EGL_VENDOR_LIBRARY_FILENAMES=/usr/share/glvnd/egl_vendor.d/50_mesa.json kitty
The correct command will depend on your situation and hardware.
``__EGL_VENDOR_LIBRARY_FILENAMES`` instructs the GL dispatch library to use
:file:`libEGL_mesa.so` and ignore :file:`libEGL_nvidia.so` also available on the
system, which will wake the NVIDIA card during device enumeration.
``MESA_LOADER_DRIVER_OVERRIDE`` also assures that Mesa won't offer any NVIDIA
card during enumeration, and will instead just use `/lib/dri/radeonsi_dri.so`.

View File

@@ -0,0 +1,535 @@
File transfer over the TTY
===============================
There are sometimes situations where the TTY is the only convenient pipe
between two connected systems, for example, nested SSH sessions, a serial
line, etc. In such scenarios, it is useful to be able to transfer files
over the TTY.
This protocol provides the ability to transfer regular files, directories and
links (both symbolic and hard) preserving most of their metadata. It can
optionally use compression and transmit only binary diffs to speed up
transfers. However, since all data is base64 encoded for transmission over the
TTY, this protocol will never be competitive with more direct file transfer
mechanisms.
Overall design
----------------
The basic design of this protocol is around transfer "sessions". Since
untrusted software should not be able to read/write to another machines
filesystem, a session must be approved by the user in the terminal emulator
before any actual data is transmitted, unless a :ref:`pre-shared password is
provided <bypass_auth>`.
There can be either send or receive sessions. In send sessions files are sent
from remote client to the terminal emulator and vice versa for receive sessions.
Every session basically consists of sending metadata for the files first and
then sending the actual data. The session is a series of commands, every command
carrying the session id (which should be a random unique-ish identifier, to
avoid conflicts). The session is bi-directional with commands going both to and
from the terminal emulator. Every command in a session also carries an
``action`` field that specifies what the command does. The remaining fields in
the command are dependent on the nature of the command.
Let's look at some simple examples of sessions to get a feel for the protocol.
Sending files to the computer running the terminal emulator
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The client starts by sending a start send command::
→ action=send id=someid
It then waits for a status message from the terminal either
allowing the transfer or refusing it. Until this message is received
the client is not allowed to send any more commands for the session.
The terminal emulator should drop a session if it receives any commands
before sending an ``OK`` response. If the user accepts the transfer,
the terminal will send::
← action=status id=someid status=OK
Or if the transfer is refused::
← action=status id=someid status=EPERM:User refused the transfer
The client then sends one or more ``file`` commands with the metadata of the file it wants
to transfer::
→ action=file id=someid file_id=f1 name=/path/to/destination
→ action=file id=someid file_id=f2 name=/path/to/destination2 ftype=directory
The terminal responds with either ``OK`` for directories or ``STARTED`` for
files::
← action=status id=someid file_id=f1 status=STARTED
← action=status id=someid file_id=f2 status=OK
If there was an error with the file, for example, if the terminal does not have
permission to write to the specified location, it will instead respond with an
error, such as::
← action=status id=someid file_id=f1 status=EPERM:No permission
The client sends data for files using ``data`` commands. It does not need to
wait for the ``STARTED`` from the terminal for this, the terminal must discard data
for files that are not ``STARTED``. Data for a file is sent in individual
chunks of no larger than ``4096`` bytes. For example::
→ action=data id=someid file_id=f1 data=chunk of bytes
→ action=data id=someid file_id=f1 data=chunk of bytes
...
→ action=end_data id=someid file_id=f1 data=chunk of bytes
The sequence of data transmission for a file is ended with an ``end_data``
command. After each data packet is received the terminal replies with
an acknowledgement of the form::
← action=status id=someid file_id=f1 status=PROGRESS size=bytes written
After ``end_data`` the terminal replies with::
← action=status id=someid file_id=f1 status=OK size=bytes written
If an error occurs while writing the data, the terminal replies with an error
code and ignores further commands about that file, for example::
← action=status id=someid file_id=f1 status=EIO:Failed to write to file
Once the client has finished sending as many files as it wants to, it ends
the session with::
→ action=finish id=someid
At this point the terminal commits the session, applying file metadata,
creating links, etc. If any errors occur it responds with an error message,
such as::
← action=status id=someid status=Some error occurred
Receiving files from the computer running terminal emulator
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The client starts by sending a start receive command::
→ action=receive id=someid size=num_of_paths
It then sends a list of ``num_of_paths`` paths it is interested in
receiving::
→ action=file id=someid file_id=f1 name=/some/path
→ action=file id=someid file_id=f2 name=/some/path2
...
The client must then wait for responses from the terminal emulator. It
is an error to send anymore commands to to the terminal until an ``OK``
response is received from the terminal. The terminal wait for the user to accept
the request. If accepted, it sends::
← action=status id=someid status=OK
If permission is denied it sends::
← action=status id=someid status=EPERM:User refused the transfer
The terminal then sends the metadata for all requested files. If any of them
are directories, it traverses the directories recursively, listing all files.
Note that symlinks must not be followed, but sent as symlinks::
← action=file id=someid file_id=f1 mtime=XXX permissions=XXX name=/absolute/path status=file_id1 size=size_in_bytes file_type=type parent=file_id of parent
← action=file id=someid file_id=f1 mtime=XXX permissions=XXX name=/absolute/path2 status=file_id2 size=size_in_bytes file_type=type parent=file_id of parent
...
Here the ``file_id`` field is set to the ``file_id`` value sent from the client
and the ``status`` field is set to the actual file id for each file. This is
because a file query sent from the client can result in multiple actual files if
it is a directory. The ``parent`` field is the actual ``file_id`` of the directory
containing this file and is set for entries that are generated from client
requests that match directories. This allows the client to build an unambiguous picture
of the file tree.
Once all the files are listed, the terminal sends an ``OK`` response that also
specifies the absolute path to the home directory for the user account running
the terminal::
← action=status id=someid status=OK name=/path/to/home
If an error occurs while listing any of the files asked for by the client,
the terminal will send an error response like::
← action=status id=someid file_id=f1 status=ENOENT: Does not exist
Here, ``file_id`` is the same as was sent by the client in its initial query.
Now, the client can send requests for file data using the paths sent by the
terminal emulator::
→ action=file id=someid file_id=f1 name=/some/path
...
The terminal emulator replies with the data for the files, as a sequence of
``data`` commands each with a chunk of data no larger than ``4096`` bytes,
for each file (the terminal emulator should send the data for
one file at a time)::
← action=data id=someid file_id=f1 data=chunk of bytes
...
← action=end_data id=someid file_id=f1 data=chunk of bytes
If any errors occur reading file data, the terminal emulator sends an error
message for the file, for example::
← action=status id=someid file_id=f1 status=EIO:Could not read
Once the client is done reading data for all the files it expects, it
terminates the session with::
→ action=finished id=someid
Canceling a session
----------------------
A client can decide to cancel a session at any time (for example if the user
presses :kbd:`ctrl+c`). To cancel a session it sends a ``cancel`` action to the
terminal emulator::
→ action=cancel id=someid
The terminal emulator drops the session and sends a cancel acknowledgement::
← action=status id=someid status=CANCELED
The client **must** wait for the canceled response from the emulator discarding
any other responses till the cancel is received. If it does not wait, after
it quits the responses might end up being printed to screen.
Quieting responses from the terminal
-------------------------------------
The above protocol includes lots of messages from the terminal acknowledging
receipt of data, granting permission etc., acknowledging cancel requests, etc.
For extremely simple clients like shell scripts, it might be useful to suppress
these responses, which can be done by adding the ``quiet`` key to the start
session command::
→ action=send id=someid quiet=1
The key can take the values ``1`` - meaning suppress acknowledgement responses
or ``2`` - meaning suppress all responses including errors. Only actual data
responses are sent. Note that in particular this means acknowledgement of
permission for the transfer to go ahead is suppressed, so this is typically
useful only with :ref:`bypass_auth`.
.. _file_metadata:
File metadata
-----------------
File metadata includes file paths, permissions and modification times. They are
somewhat tricky as different operating systems support different kinds of
metadata. This specification defines a common minimum set which should work
across most operating systems.
File paths
File paths must be valid UTF-8 encoded POSIX paths (i.e. using the forward slash
``/`` as a separator). Linux systems allow non UTF-8 file paths, these
are not supported. A leading ``~/`` means a path is relative to the
``HOME`` directory. All path must be either absolute (i.e. with a leading
``/``) or relative to the HOME directory. Individual components of the
path must be no longer than 255 UTF-8 bytes. Total path length must be no
more than 4096 bytes. Paths from Windows systems must use the forward slash
as the separator, the first path component must be the drive letter with a
colon. For example: :file:`C:\some\file.txt` is represented as
:file:`/C:/some/file.txt`. For maximum portability, the following
characters *should* be omitted from paths (however implementations are free
to try to support them returning errors for non-representable paths)::
\ * : < > ? | /
File modification times
Must be represented as the number of nanoseconds since the UNIX epoch. An
individual file system may not store file metadata with this level of
accuracy in which case it should use the closest possible approximation.
File permissions
Represented as a number with the usual UNIX read, write and execute bits.
In addition, the sticky, set-group-id and set-user-id bits may be present.
Implementations should make a best effort to preserve as many bits as
possible. On Windows, there is only a read-only bit. When reading file
metadata all the ``WRITE`` bits should be set if the read only bit is clear
and cleared if it is set. When writing files, the read-only bit should be
set if the bit indicating write permission for the user is clear. The other
UNIX bits must be ignored when writing. When reading, all the ``READ`` bits
should always be set and all the ``EXECUTE`` bits should be set if the file is
directly executable by the Windows Operating system. There is no attempt to
map Window's ACLs to permission bits.
Symbolic and hard links
---------------------------
Symbolic and hard links can be preserved by this protocol.
.. note::
In the following when target paths of symlinks are sent as actual paths, they must be
encoded in the same way as discussed in :ref:`file_metadata`. It is up to
the receiving side to translate them into appropriate paths for the local
operating system. This may not always be possible, in which case either the
symlink should not be created or a broken symlink should be created.
Sending links to the terminal emulator
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
When sending files to the terminal emulator, the file command has the form::
→ action=file id=someid file_id=f1 name=/path/to/link file_type=link
→ action=file id=someid file_id=f2 name=/path/to/symlink file_type=symlink
Then, when the client is sending data for the files, for hardlinks, the data
will be the ``file_id`` of the target file (assuming the target file is also
being transmitted, otherwise the hard link should be transmitted as a plain
file)::
→ action=end_data id=someid file_id=f1 data=target_file_id_encoded_as_utf8
For symbolic links, the data is a little more complex. If the symbolic link is
to a destination being transmitted, the data has the form::
→ action=end_data id=someid file_id=f1 data=fid:target_file_id_encoded_as_utf8
→ action=end_data id=someid file_id=f1 data=fid_abs:target_file_id_encoded_as_utf8
The ``fid_abs`` form is used if the symlink uses an absolute path, ``fid`` if
it uses a relative path. If the symlink is to a destination that is not being
transmitted, then the prefix ``path:`` and the actual path in the symlink is
transmitted.
Receiving links from the terminal emulator
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
When receiving files from the terminal emulator, link data is transmitted in
two parts. First when the emulator sends the initial file listing to the
client, the ``file_type`` is set to the link type and the ``data`` field is set
to file_id of the target file if the target file is included in the listing.
For example::
← action=file id=someid file_id=f1 status=file_id1 ...
← action=file id=someid file_id=f1 status=file_id2 file_type=symlink data=file_id1 ...
Here the rest of the metadata has been left out for clarity. Notice that the
second file is symlink whose ``data`` field is set to the file id of the first
file (the value of the ``status`` field of the first file). The same technique
is used for hard links.
The client should not request data for hard links, instead creating them
directly after transmission is complete. For symbolic links the terminal
must send the actual symbolic link target as a UTF-8 encoded path in the
data field. The client can use this path either as-is (when the target is not
a transmitted file) or to decide whether to create the symlink with a relative
or absolute path when the target is a transmitted file.
Transmitting binary deltas
-----------------------------
Repeated transfer of large files that have only changed a little between
the receiving and sending side can be sped up significantly by transmitting
binary deltas of only the changed portions. This protocol has built-in support
for doing that. This support uses the `rsync algorithm
<https://github.com/librsync/librsync>`__. In this algorithm first the
receiving side sends a file signature that contains hashes of blocks
in the file. Then the sending side sends only those blocks that have changed.
The receiving side applies these deltas to the file to update it till it matches
the file on the sending side.
The modification to the basic protocol consists of setting the
``transmission_type`` key to ``rsync`` when requesting a file. This triggers
transmission of signatures and deltas instead of file data. The details are
different for sending and receiving.
Sending to the terminal emulator
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
When sending the metadata of the file it wants to transfer, the client adds the
``transmission_type`` key::
→ action=file id=someid file_id=f1 name=/path/to/destination transmission_type=rsync
The ``STARTED`` response from the terminal will have ``transmission_type`` set
to ``rsync`` if the file exists and the terminal is able to send signature data::
← action=status id=someid file_id=f1 status=STARTED transmission_type=rsync
The terminal then transmits the signature using ``data`` commands::
← action=data id=someid file_id=f1 data=...
...
← action=end_data id=someid file_id=f1 data=...
Once the client receives and processes the full signature, it transmits the
file delta to the terminal as ``data`` commands::
→ action=data id=someid file_id=f1 data=...
→ action=data id=someid file_id=f1 data=...
...
→ action=end_data id=someid file_id=f1 data=...
The terminal then uses this delta to update the file.
Receiving from the terminal emulator
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
When the client requests file data from the terminal emulator, it can
add the ``transmission_type=rsync`` key to indicate it will be sending
a signature for that file::
→ action=file id=someid file_id=f1 name=/some/path transmission_type=rsync
The client then sends the signature using ``data`` commands::
→ action=data id=someid file_id=f1 data=...
...
→ action=end_data id=someid file_id=f1 data=...
After receiving the signature the terminal replies with the delta as a series
of ``data`` commands::
← action=data id=someid file_id=f1 data=...
...
← action=end_data id=someid file_id=f1 data=...
The client then uses this delta to update the file.
The format of signatures and deltas
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
These come from `librsync <https://github.com/librsync/librsync>`__. If this
specification gains wider adoption, these formats should be documented here.
Compression
--------------
Individual files can be transmitted compressed if needed.
Currently, only :rfc:`1950` ZLIB based deflate compression is
supported, which is specified using the ``compression=zlib`` key when
requesting a file. For example when sending files to the terminal emulator,
when sending the file metadata the ``compression`` key can also be
specified::
→ action=file id=someid file_id=f1 name=/path/to/destination compression=zlib
Similarly when receiving files from the terminal emulator, the final file
command that the client sends to the terminal requesting the start of the
transfer of data for the file can include the ``compression`` key::
→ action=file id=someid file_id=f1 name=/some/path compression=zlib
.. _bypass_auth:
Bypassing explicit user authorization
------------------------------------------
In order to bypass the requirement of interactive user authentication,
this protocol has the ability to use a pre-shared secret (password).
When initiating a transfer session the client sends a hash of the password and
the session id::
→ action=send id=someid bypass=sha256:hash_value
For example, suppose that the session id is ``mysession`` and the
shared secret is ``mypassword``. Then the value of the ``bypass``
key above is ``sha256:SHA256("mysession" + ";" + "mypassword")``, which
is::
→ action=send id=mysession bypass=sha256:192bd215915eeaa8c2b2a4c0f8f851826497d12b30036d8b5b1b4fc4411caf2c
The value of ``bypass`` is of the form ``hash_function_name : hash_value``
(without spaces). Currently, only the SHA256 hash function is supported.
.. warning::
Hashing does not effectively hide the value of the password. So this
functionality should only be used in secure/trusted contexts. While there
exist hash functions harder to compute than SHA256, they are unsuitable as
they will introduce a lot of latency to starting a session and in any case
there is no mathematical proof that **any** hash function is not brute-forceable.
Encoding of transfer commands as escape codes
------------------------------------------------
Transfer commands are encoded as ``OSC`` escape codes of the form::
<OSC> 5113 ; key=value ; key=value ... <ST>
Here ``OSC`` is the bytes ``0x1b 0x5d`` and ``ST`` is the bytes
``0x1b 0x5c``. Keys are words containing only the characters ``[a-zA-Z0-9_]``
and ``value`` is arbitrary data, whose encoding is dependent on the value of
``key``. Unknown keys **must** be ignored when decoding a command.
The number ``5113`` is a constant and is unused by any known OSC codes. It is
the numeralization of the word ``file``.
.. table:: The keys and value types for this protocol
:align: left
================= ======== ============== =======================================================================
Key Key name Value type Notes
================= ======== ============== =======================================================================
action ac enum send, file, data, end_data, receive, cancel, status, finish
compression zip enum none, zlib
file_type ft enum regular, directory, symlink, link
transmission_type tt enum simple, rsync
id id safe_string A unique-ish value, to avoid collisions
file_id fid safe_string Must be unique per file in a session
bypass pw safe_string hash of the bypass password and the session id
quiet q integer 0 - verbose, 1 - only errors, 2 - totally silent
mtime mod integer the modification time of file in nanoseconds since the UNIX epoch
permissions prm integer the UNIX file permissions bits
size sz integer size in bytes
name n base64_string The path to a file
status st base64_string Status messages
parent pr safe_string The file id of the parent directory
data d base64_bytes Binary data
================= ======== ============== =======================================================================
The ``Key name`` is the actual serialized name of the key sent in the escape
code. So for example, ``permissions=123`` is serialized as ``prm=123``. This
is done to reduce overhead.
The value types are:
enum
One from a permitted set of values, for example::
ac=file
safe_string
A string consisting only of characters from the set ``[0-9a-zA-Z_:.,/!@#$%^&*()[]{}~`?"'\\|=+-]``
Note that the semi-colon is missing from this set.
integer
A base-10 number composed of the characters ``[0-9]`` with a possible
leading ``-`` sign
base64_string
A base64 encoded UTF-8 string using the standard base64 encoding
base64_bytes
Binary data encoded using the standard base64 encoding
An example of serializing an escape code is shown below::
action=send id=test name=somefile size=3 data=01 02 03
becomes::
<OSC> 5113 ; ac=send ; id=test ; n=c29tZWZpbGU= ; sz=3 ; d=AQID <ST>
Here ``c29tZWZpbGU`` is the base64 encoded form of somefile and ``AQID`` is the
base64 encoded form of the bytes ``0x01 0x02 0x03``. The spaces in the encoded
form are present for clarity and should be ignored.

View File

@@ -32,7 +32,7 @@ Glossary
top of an existing kitty window, entirely covering it. Overlays are used
throught kitty, for example, to display the :ref:`the scrollback buffer <scrollback>`,
to display :doc:`hints </kittens/hints>`, for :doc:`unicode input
</kittens/unicode-input>` etc.
</kittens/unicode_input>` etc.
hyperlinks
Terminals can have hyperlinks, just like the internet. In kitty you can
@@ -52,6 +52,10 @@ Variables that influence kitty behavior
files. Defaults to :file:`~/.config/kitty`. For full details of the config
directory lookup mechanism see, :option:`kitty --config`.
.. envvar:: KITTY_CACHE_DIRECTORY
Controls where kitty stores cache files. Defaults to :file:`~/.cache/kitty`
or :file:`~/Library/Caches/kitty` on macOS.
.. envvar:: VISUAL
@@ -63,15 +67,39 @@ Variables that influence kitty behavior
Same as :envvar:`VISUAL`. Used if :envvar:`VISUAL` is not set.
.. envvar:: GLFW_IM_MODULE
Set this to ``ibus`` to enable support for IME under X11.
.. envvar:: KITTY_WAYLAND_DETECT_MODIFIERS
When set to a non-empty value, kitty attempts to autodiscover XKB modifiers
under Wayland. This is useful if using non-standard modifers like hyper. It
is possible for the autodiscovery to fail; the default Wayland XKB mappings
are used in this case. See :pull:`3943` for details.
Variables that kitty sets when running child programs
.. envvar:: LANG
This is set only on macOS, and only if the country and language from the
macOS user settings form a valid locale.
.. envvar:: KITTY_WINDOW_ID
An integer that is the id for the kitty :term:`window` the program is running in.
Can be used with the :doc:`kitty remote control facility <remote-control>`.
.. envvar:: KITTY_PID
An integer that is the process id for the kitty process in which the program
is running. Allows programs to tell kitty to reload its config by sending it
the SIGUSR1 signal.
.. envvar:: WINDOWID
The id for the :term:`OS Window <os_window>` the program is running in. Only available
@@ -88,6 +116,11 @@ Variables that kitty sets when running child programs
Path to a directory containing the kitty terminfo database.
.. envvar:: KITTY_INSTALLATION_DIR
Path to the kitty installation directory.
.. envvar:: COLORTERM
Set to the value ``truecolor`` to indicate that kitty supports 16 million
@@ -120,3 +153,9 @@ Variables that kitty sets when running child programs
Set with the values of some common kitty options when running
kittens, so kittens can use them without needing to load kitty.conf.
.. envvar:: KITTY_SHELL_INTEGRATION
Set when enabling :ref:`shell_integration`. It is automatically removed by
the shell integration scripts.

View File

@@ -40,7 +40,13 @@ Some programs and libraries that use the kitty graphics protocol:
* `ctx.graphics <https://ctx.graphics/>`_ - Library for drawing graphics
* `timg <https://github.com/hzeller/timg>`_ - a terminal image and video viewer
* `notcurses <https://github.com/dankamongmen/notcurses>`_ - C library for terminal graphics with bindings for C++, Rust and Python
* `rasterm <https://github.com/BourgeoisBear/rasterm>`_ - Go library to display images in the the terminal
* `rasterm <https://github.com/BourgeoisBear/rasterm>`_ - Go library to display images in the terminal
* `chafa <https://github.com/hpjansson/chafa>`_ - a terminal image viewer
* `hologram.nvim <https://github.com/edluffy/hologram.nvim>`_ - view images inside nvim
Other terminals that have implemented the graphics protocol:
* `WezTerm <https://github.com/wez/wezterm/issues/986>`_
Getting the window size
@@ -223,7 +229,7 @@ and can take the values:
Value of `t` Meaning
================== ============
``d`` Direct (the data is transmitted within the escape code itself)
``f`` A simple file
``f`` A simple file (regular files only, not named pipes or similar)
``t`` A temporary file, the terminal emulator will delete the file after reading the pixel data. For security reasons
the terminal emulator should only delete the file if it
is in a known temporary directory, such as :file:`/tmp`,
@@ -238,6 +244,10 @@ Value of `t` Meaning
close it on Windows.
================== ============
When opening files, the terminal emulator must follow symlinks. In case of
symlink loops or too many symlinks, it should fail and respond with an error,
similar to reporting any other kind of I/O error.
Local client
^^^^^^^^^^^^^^
@@ -316,9 +326,9 @@ use the *query action*, set ``a=q``. Then the terminal emulator will try to load
the image and respond with either OK or an error, as above, but it will not
replace an existing image with the same id, nor will it store the image.
While as of May 2020, kitty is the only terminal emulator to support this
graphics protocol, we intend that any terminal emulator that wishes to support
it can. To check if a terminal emulator supports the graphics protocol the best way
As of September 2021, kitty and WezTerm are the only terminal emulators to support this
graphics protocol. We intend that any terminal emulator that wishes to support
it can do so. To check if a terminal emulator supports the graphics protocol the best way
is to send the above *query action* followed by a request for the
`primary device attributes <https://vt100.net/docs/vt510-rm/DA1.html>`_. If you
get back an answer for the device attributes without getting back an answer for

View File

@@ -19,7 +19,8 @@ kitty
.. tab:: Fast
* Offloads rendering to the GPU for :doc:`lower system load <performance>`
* Uses threaded rendering for absolutely minimal latency
* Uses threaded rendering for
`absolutely minimal latency <https://github.com/kovidgoyal/kitty/issues/2701#issuecomment-636497270>`_
* Performance tradeoffs can be :ref:`tuned <conf-kitty-performance>`
.. tab:: Capable
@@ -36,8 +37,9 @@ kitty
.. tab:: Composable
* Programmble tabs, :ref:`splits <splits_layout>` and multiple :doc:`layouts <layouts>` to manage windows
* Browse the :ref:`entire history <scrollback>` or the output from the last command comfortably in pagers and editors
* Programmable tabs, :ref:`splits <splits_layout>` and multiple :doc:`layouts <layouts>` to manage windows
* Browse the :ref:`entire history <scrollback>` or the :sc:`output from the last command <show_last_command_output>`
comfortably in pagers and editors
* Edit or download :doc:`remote files <kittens/remote_file>` in an existing SSH session
.. tab:: Cross-platform
@@ -55,12 +57,18 @@ kitty
* Lots more in :doc:`protocol-extensions`
.. figure:: screenshots/screenshot.png
:alt: Screenshot, showing three programs in the 'Tall' layout
:align: center
:width: 100%
.. only:: dirhtml
Screenshot, showing vim, tig and git running in |kitty| with the 'Tall' layout
.. raw:: html
<video controls width="640" height="360">
<source src="https://download.calibre-ebook.com/videos/kitty.mp4" type="video/mp4">
<source src="https://download.calibre-ebook.com/videos/kitty.webm" type="video/webm">
</video>
.. rst-class:: caption caption-text
Watch kitty in action!
To get started see :doc:`quickstart`.

View File

@@ -20,10 +20,16 @@ import tempfile
py3 = sys.version_info[0] > 2
is64bit = platform.architecture()[0] == '64bit'
is_macos = 'darwin' in sys.platform.lower()
is_linux_arm = is_linux_arm64 = False
if is_macos:
mac_ver = tuple(map(int, platform.mac_ver()[0].split('.')))
if mac_ver[:2] < (10, 12):
raise SystemExit('Your version of macOS is too old, at least 10.12 is required')
else:
machine = (os.uname()[4] or '').lower()
if machine.startswith('arm') or machine.startswith('aarch64'):
is_linux_arm = True
is_linux_arm64 = machine.startswith('arm64') or machine.startswith('aarch64')
try:
__file__
@@ -73,9 +79,11 @@ class Reporter: # {{{
# }}}
def get_latest_release_data():
def get_release_data(relname='latest'):
print('Checking for latest release on GitHub...')
req = urllib.Request('https://api.github.com/repos/kovidgoyal/kitty/releases/latest', headers={'Accept': 'application/vnd.github.v3+json'})
req = urllib.Request(
'https://api.github.com/repos/kovidgoyal/kitty/releases/' + relname,
headers={'Accept': 'application/vnd.github.v3+json'})
try:
res = urllib.urlopen(req).read().decode('utf-8')
except Exception as err:
@@ -90,7 +98,8 @@ def get_latest_release_data():
else:
if name.endswith('.txz'):
if is64bit:
if name.endswith('-x86_64.txz'):
q = '-arm64.txz' if is_linux_arm64 else '-x86_64.txz'
if name.endswith(q):
return html_url + '/' + name, asset['size']
else:
if name.endswith('-i686.txz'):
@@ -184,19 +193,22 @@ def main(dest=None, launch=True, installer=None):
dest = '/Applications'
else:
dest = os.path.expanduser('~/.local')
machine = os.uname()[4]
if machine and machine.lower().startswith('arm'):
if is_linux_arm and not is_linux_arm64:
raise SystemExit(
'You are running on an ARM system. The kitty binaries are only'
' available for x86 systems. You will have to build from'
'You are running on a 32-bit ARM system. The kitty binaries are only'
' available for 64 bit ARM systems. You will have to build from'
' source.')
if not installer:
url, size = get_latest_release_data()
url, size = get_release_data()
installer = download_installer(url, size)
else:
installer = os.path.abspath(installer)
if not os.access(installer, os.R_OK):
raise SystemExit('Could not read from: {}'.format(installer))
if installer == 'nightly':
url, size = get_release_data('tags/nightly')
installer = download_installer(url, size)
else:
installer = os.path.abspath(installer)
if not os.access(installer, os.R_OK):
raise SystemExit('Could not read from: {}'.format(installer))
if is_macos:
macos_install(installer, dest=dest, launch=launch)
else:
@@ -227,7 +239,7 @@ def script_launch():
main(**kwargs)
def update_intaller_wrapper():
def update_installer_wrapper():
# To run: python3 -c "import runpy; runpy.run_path('installer.py', run_name='update_wrapper')" installer.sh
with open(__file__, 'rb') as f:
src = f.read().decode('utf-8')
@@ -244,6 +256,6 @@ def update_intaller_wrapper():
if __name__ == '__main__' and from_file:
main()
elif __name__ == 'update_wrapper':
update_intaller_wrapper()
update_installer_wrapper()
elif __name__ == 'script_launch':
script_launch()

View File

@@ -25,6 +25,268 @@ echo Using python executable: $python
$python -c "import sys; script_launch=lambda:sys.exit('Download of installer failed!'); exec(sys.stdin.read()); script_launch()" "$@" <<'INSTALLER_HEREDOC'
# {{{
# HEREDOC_START
#!/usr/bin/env python3
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
import atexit
import json
import os
import platform
import re
import shlex
import shutil
import subprocess
import sys
import tempfile
py3 = sys.version_info[0] > 2
is64bit = platform.architecture()[0] == '64bit'
is_macos = 'darwin' in sys.platform.lower()
is_linux_arm = is_linux_arm64 = False
if is_macos:
mac_ver = tuple(map(int, platform.mac_ver()[0].split('.')))
if mac_ver[:2] < (10, 12):
raise SystemExit('Your version of macOS is too old, at least 10.12 is required')
else:
machine = (os.uname()[4] or '').lower()
if machine.startswith('arm') or machine.startswith('aarch64'):
is_linux_arm = True
is_linux_arm64 = machine.startswith('arm64') or machine.startswith('aarch64')
try:
__file__
from_file = True
except NameError:
from_file = False
if py3:
unicode = str
raw_input = input
import urllib.request as urllib
def encode_for_subprocess(x):
return x
else:
from future_builtins import map
import urllib2 as urllib
def encode_for_subprocess(x):
if isinstance(x, unicode):
x = x.encode('utf-8')
return x
def run(*args):
if len(args) == 1:
args = shlex.split(args[0])
args = list(map(encode_for_subprocess, args))
ret = subprocess.Popen(args).wait()
if ret != 0:
raise SystemExit(ret)
class Reporter: # {{{
def __init__(self, fname):
self.fname = fname
self.last_percent = 0
def __call__(self, blocks, block_size, total_size):
percent = (blocks*block_size)/float(total_size)
report = '\rDownloaded {:.1%} '.format(percent)
if percent - self.last_percent > 0.05:
self.last_percent = percent
print(report, end='')
sys.stdout.flush()
# }}}
def get_release_data(relname='latest'):
print('Checking for latest release on GitHub...')
req = urllib.Request(
'https://api.github.com/repos/kovidgoyal/kitty/releases/' + relname,
headers={'Accept': 'application/vnd.github.v3+json'})
try:
res = urllib.urlopen(req).read().decode('utf-8')
except Exception as err:
raise SystemExit('Failed to contact {} with error: {}'.format(req.get_full_url(), err))
data = json.loads(res)
html_url = data['html_url'].replace('/tag/', '/download/').rstrip('/')
for asset in data.get('assets', ()):
name = asset['name']
if is_macos:
if name.endswith('.dmg'):
return html_url + '/' + name, asset['size']
else:
if name.endswith('.txz'):
if is64bit:
q = '-arm64.txz' if is_linux_arm64 else '-x86_64.txz'
if name.endswith(q):
return html_url + '/' + name, asset['size']
else:
if name.endswith('-i686.txz'):
return html_url + '/' + name, asset['size']
raise SystemExit('Failed to find the installer package on github')
def do_download(url, size, dest):
print('Will download and install', os.path.basename(dest))
reporter = Reporter(os.path.basename(dest))
# Get content length and check if range is supported
rq = urllib.urlopen(url)
headers = rq.info()
sent_size = int(headers['content-length'])
if sent_size != size:
raise SystemExit('Failed to download from {} Content-Length ({}) != {}'.format(url, sent_size, size))
with open(dest, 'wb') as f:
while f.tell() < size:
raw = rq.read(8192)
if not raw:
break
f.write(raw)
reporter(f.tell(), 1, size)
rq.close()
if os.path.getsize(dest) < size:
raise SystemExit('Download failed, try again later')
print('\rDownloaded {} bytes'.format(os.path.getsize(dest)))
def clean_cache(cache, fname):
for x in os.listdir(cache):
if fname not in x:
os.remove(os.path.join(cache, x))
def download_installer(url, size):
fname = url.rpartition('/')[-1]
tdir = tempfile.gettempdir()
cache = os.path.join(tdir, 'kitty-installer-cache')
if not os.path.exists(cache):
os.makedirs(cache)
clean_cache(cache, fname)
dest = os.path.join(cache, fname)
if os.path.exists(dest) and os.path.getsize(dest) == size:
print('Using previously downloaded', fname)
return dest
if os.path.exists(dest):
os.remove(dest)
do_download(url, size, dest)
return dest
def macos_install(dmg, dest='/Applications', launch=True):
mp = tempfile.mkdtemp()
atexit.register(shutil.rmtree, mp)
run('hdiutil', 'attach', dmg, '-mountpoint', mp)
try:
os.chdir(mp)
app = 'kitty.app'
d = os.path.join(dest, app)
if os.path.exists(d):
shutil.rmtree(d)
dest = os.path.join(dest, app)
run('ditto', '-v', app, dest)
print('Successfully installed kitty into', dest)
if launch:
run('open', dest)
finally:
os.chdir('/')
run('hdiutil', 'detach', mp)
def linux_install(installer, dest=os.path.expanduser('~/.local'), launch=True):
dest = os.path.join(dest, 'kitty.app')
if os.path.exists(dest):
shutil.rmtree(dest)
os.makedirs(dest)
print('Extracting tarball...')
run('tar', '-C', dest, '-xJof', installer)
print('kitty successfully installed to', dest)
kitty = os.path.join(dest, 'bin', 'kitty')
print('Use', kitty, 'to run kitty')
if launch:
run(kitty, '--detach')
def main(dest=None, launch=True, installer=None):
if not dest:
if is_macos:
dest = '/Applications'
else:
dest = os.path.expanduser('~/.local')
if is_linux_arm and not is_linux_arm64:
raise SystemExit(
'You are running on a 32-bit ARM system. The kitty binaries are only'
' available for 64 bit ARM systems. You will have to build from'
' source.')
if not installer:
url, size = get_release_data()
installer = download_installer(url, size)
else:
if installer == 'nightly':
url, size = get_release_data('tags/nightly')
installer = download_installer(url, size)
else:
installer = os.path.abspath(installer)
if not os.access(installer, os.R_OK):
raise SystemExit('Could not read from: {}'.format(installer))
if is_macos:
macos_install(installer, dest=dest, launch=launch)
else:
linux_install(installer, dest=dest, launch=launch)
def script_launch():
# To test: python3 -c "import runpy; runpy.run_path('installer.py', run_name='script_launch')"
def path(x):
return os.path.expandvars(os.path.expanduser(x))
def to_bool(x):
return x.lower() in {'y', 'yes', '1', 'true'}
type_map = {x: path for x in 'dest installer'.split()}
type_map['launch'] = to_bool
kwargs = {}
for arg in sys.argv[1:]:
if arg:
m = re.match('([a-z_]+)=(.+)', arg)
if m is None:
raise SystemExit('Unrecognized command line argument: ' + arg)
k = m.group(1)
if k not in type_map:
raise SystemExit('Unrecognized command line argument: ' + arg)
kwargs[k] = type_map[k](m.group(2))
main(**kwargs)
def update_installer_wrapper():
# To run: python3 -c "import runpy; runpy.run_path('installer.py', run_name='update_wrapper')" installer.sh
with open(__file__, 'rb') as f:
src = f.read().decode('utf-8')
wrapper = sys.argv[-1]
with open(wrapper, 'r+b') as f:
raw = f.read().decode('utf-8')
nraw = re.sub(r'^# HEREDOC_START.+^# HEREDOC_END', lambda m: '# HEREDOC_START\n{}\n# HEREDOC_END'.format(src), raw, flags=re.MULTILINE | re.DOTALL)
if 'update_intaller_wrapper()' not in nraw:
raise SystemExit('regex substitute of HEREDOC failed')
f.seek(0), f.truncate()
f.write(nraw.encode('utf-8'))
if __name__ == '__main__' and from_file:
main()
elif __name__ == 'update_wrapper':
update_installer_wrapper()
elif __name__ == 'script_launch':
script_launch()
# HEREDOC_END
# }}}
INSTALLER_HEREDOC

View File

@@ -32,6 +32,13 @@ You can see this protocol with all enhancements in action by running::
inside the kitty terminal to report key events.
In addition to kitty, this protocol is also implemented in:
* The `foot terminal <https://codeberg.org/dnkl/foot/issues/319>`__
* The `notcurses library
<https://github.com/dankamongmen/notcurses/issues/2131>`__
* The `kakoune text editor <https://github.com/mawww/kakoune/issues/4103>`__
.. versionadded:: 0.20.0
Quickstart
@@ -66,10 +73,11 @@ key, such as ``97`` for the :kbd:`a` key, or one of the numbers from the
modifiers pressed for the key event. The encoding is described in the
:ref:`modifiers` section.
The second form is used for a few functional keys, such as the :kbd:`Home, End,
Arrow keys and F1-F4`, they are enumerated in the :ref:`functional` table below.
Note that if no modifiers are present the parameters are omitted entirely
giving an escape code of the form ``CSI [ABCDEFHPQRS]``.
The second form is used for a few functional keys, such as the :kbd:`Home`,
:kbd:`End`, :kbd:`Arrow` keys and :kbd:`F1` ... :kbd:`F4`, they are enumerated in
the :ref:`functional` table below. Note that if no modifiers are present the
parameters are omitted entirely giving an escape code of the form ``CSI
[ABCDEFHPQRS]``.
If you want support for more advanced features such as repeat and release
events, alternate keys for shortcut matching et cetera, these can be turned on
@@ -142,11 +150,13 @@ sub-field for the shifted key, like this::
Modifiers
~~~~~~~~~~~~~~
This protocol supports six modifier keys, :kbd:`shift, alt, ctrl, super, hyper
and meta` as well as :kbd:`num_lock and caps_lock`. Here :kbd:`super` is either
the *Windows/Linux* key or the *Cmd* key on mac keyboards. :kbd:`hyper` and
:kbd:`meta` are typically present only on X11 based systems with special XKB
rules. Modifiers are encoded as a bit field with::
This protocol supports six modifier keys, :kbd:`shift`, :kbd:`alt`,
:kbd:`ctrl`, :kbd:`super`, :kbd:`hyper`, :kbd:`meta`, :kbd:`num_lock` and
:kbd:`caps_lock`. Here :kbd:`super` is either the *Windows/Linux* key or the
:kbd:`command` key on mac keyboards. The :kbd:`alt` key is the :kbd:`option`
key on mac keyboards. :kbd:`hyper` and :kbd:`meta` are typically present only
on X11/Wayland based systems with special XKB rules. Modifiers are encoded as a
bit field with::
shift 0b1 (1)
alt 0b10 (2)
@@ -209,9 +219,9 @@ Non-Unicode keys
There are many keys that don't correspond to letters from human languages, and
thus aren't represented in Unicode. Think of functional keys, such as
:kbd:`Escape, Play, Pause, F1, Home, etc`. These are encoded using Unicode code
points from the Private Use Area (``57344 - 63743``). The mapping of key
names to code points for these keys is in the
:kbd:`Escape`, :kbd:`Play`, :kbd:`Pause`, :kbd:`F1`, :kbd:`Home`, etc. These
are encoded using Unicode code points from the Private Use Area (``57344 -
63743``). The mapping of key names to code points for these keys is in the
:ref:`Functional key definition table below <functional>`.
@@ -277,11 +287,6 @@ oldest entry from the stack must be evicted.
the editor would have to somehow know what the keyboard mode of the main
screen is and restore to that mode on exit.
.. note:: In the interests of interoperation, the XTerm specific sequences
`CSI > 4; 1 m` and `CSI > 4; 0 m` are treated as `CSI > 1 u` and `CSI < 1 u`.
These codes cause XTerm to use the CSI u encoding for more keys and are therefore
treated as similar to the disambiguate progressive enhancement.
.. _disambiguate:
Disambiguate escape codes
@@ -293,8 +298,8 @@ encodings overlapping with other control codes. For instance, pressing the
start of an escape code. Similarly pressing the key :kbd:`alt+[` will generate
the bytes used for CSI control codes.
Turning on this flag will cause the terminal to report the :kbd:`Esc, alt+key,
ctrl+key, ctrl+alt+key, shift+alt+key` keys using ``CSI u`` sequences instead
Turning on this flag will cause the terminal to report the :kbd:`Esc`, :kbd:`alt+key`,
:kbd:`ctrl+key`, :kbd:`ctrl+alt+key`, :kbd:`shift+alt+key` keys using ``CSI u`` sequences instead
of legacy ones. Here key is any ASCII key as described in :ref:`legacy_text`.
Additionally, all keypad keys will be reported as separate keys with ``CSI u``
encoding, using dedicated numbers from the :ref:`table below <functional>`.
@@ -309,7 +314,7 @@ This makes it very easy to parse key events in an application. In particular,
:kbd:`ctrl+c` will no longer generate the ``SIGINT`` signal, but instead be
delivered as a ``CSI u`` escape code. This has the nice side effect of making it
much easier to integrate into the application event loop. The only exceptions
are the :kbd:`Enter, Tab and Backspace` keys which still generate the same
are the :kbd:`Enter`, :kbd:`Tab` and :kbd:`Backspace` keys which still generate the same
bytes as in legacy mode this is to allow the user to type and execute commands
in the shell such as ``reset`` after a program that sets this mode crashes
without clearing it.
@@ -349,8 +354,8 @@ only key events are sent. If the text is needed as well, combine with the
Report associated text enhancement below.
Additionally, with this mode, events for pressing modifier keys are reported.
Note that *all* keys are reported as escape codes, including :kbd:`Enter, Tab,
Backspace` etc.
Note that *all* keys are reported as escape codes, including :kbd:`Enter`,
:kbd:`Tab`, :kbd:`Backspace` etc.
.. _report_text:
@@ -462,10 +467,11 @@ distinguish these, use the :ref:`disambiguate <disambiguate>` flag.
Legacy text keys
~~~~~~~~~~~~~~~~~~~
For legacy compatibility, the keys
:kbd:`a-z 0-9 \` - = [ ] \ ; ' , . /` with the modifiers
:kbd:`shift, alt, ctrl, shift+alt, ctrl+alt` are output using the
following algorithm:
For legacy compatibility, the keys :kbd:`a`-:kbd:`z` :kbd:`0`-:kbd:`9`
:kbd:`\`` :kbd:`-` :kbd:`=` :kbd:`[` :kbd:`]` :kbd:`\\` :kbd:`;` :kbd:`'`
:kbd:`,` :kbd:`.` :kbd:`/` with the modifiers :kbd:`shift`, :kbd:`alt`,
:kbd:`ctrl`, :kbd:`shift+alt`, :kbd:`ctrl+alt` are output using the following
algorithm:
#. If the :kbd:`alt` key is pressed output the byte for ``ESC (0x1b)``
#. If the :kbd:`ctrl` modifier is pressed map the key using the table
@@ -637,8 +643,8 @@ specification.
* Incorrectly encoding shifted keys when shift modifier is used, for instance,
for :kbd:`ctrl+shift+i` is encoded as :kbd:`ctrl+I`.
* No way to have non-conflicting escape codes for :kbd:`alt+letter,
ctrl+letter, ctrl+alt+letter` key presses
* No way to have non-conflicting escape codes for :kbd:`alt+letter`,
:kbd:`ctrl+letter`, :kbd:`ctrl+alt+letter` key presses
* No way to specify both shifted and unshifted keys for robust shortcut
matching (think matching :kbd:`ctrl+shift+equal` and :kbd:`ctrl+plus`)

View File

@@ -88,11 +88,41 @@ function, telling kitty what kind of input your kitten would like. For example:
This will send the plain text of the active window to the kitten's
:file:`STDIN`. For text with formatting escape codes, use ``ansi``
instead. If you want line wrap markers as well, use ``screen-ansi``
or just ``screen``. For the scrollback buffer as well, use
``history``, ``ansi-history`` or ``screen-history``. To get
the currently selected text, use ``selection``.
:file:`STDIN`. There are many other types of input you can ask for,
described in the table below:
.. table:: Types of input to kittens
:align: left
=========================== =======================================================================================================
Keyword Type of :file:`STDIN` input
=========================== =======================================================================================================
``text`` Plain text of active window
``ansi`` Formatted text of active window
``screen`` Plain text of active window with line wrap markers
``screen-ansi`` Formatted text of active window with line wrap markers
``history`` Plain text of active window and its scrollback
``ansi-history`` Formatted text of active window and its scrollback
``screen-history`` Plain text of active window and its scrollback with line wrap markers
``screen-ansi-history`` Formatted text of active window and its scrollback with line wrap markers
``output`` Plain text of the output from the last run command
``output-screen`` Plain text of the output from the last run command with wrap markers
``output-ansi`` Formatted text of the output from the last run command
``output-screen-ansi`` Formatted text of the output from the last run command with wrap markers
``selection`` The text currently selected with the mouse
=========================== =======================================================================================================
In addition to ``output``, that gets the output of the last run command,
``last_visited_output`` gives the output of the command last jumped to
and ``first_output`` gives the output of the first command currently on screen.
These can also be combined with ``screen`` and ``ansi`` for formatting.
.. note::
For the types based on the output of a command,
:ref:`shell_integration` is required.
Using kittens to script kitty, without any terminal UI

View File

@@ -35,7 +35,7 @@ Simply :ref:`install kitty <quickstart>`. You also need
to have either the `git <https://git-scm.com/>`_ program or the ``diff`` program
installed. Additionally, for syntax highlighting to work,
`pygments <https://pygments.org/>`_ must be installed (note that pygments is
included in the macOS kitty app).
included in the official kitty binary builds).
Usage
@@ -67,14 +67,14 @@ Keyboard controls
========================= ===========================
Action Shortcut
========================= ===========================
Quit :kbd:`q, Ctrl+c, Esc`
Scroll line up :kbd:`k, up`
Scroll line down :kbd:`j, down`
Quit :kbd:`q`, :kbd:`ctrl+c`, :kbd:`Esc`
Scroll line up :kbd:`k`, :kbd:`Up`
Scroll line down :kbd:`j`, :kbd:`Down`
Scroll page up :kbd:`PgUp`
Scroll page down :kbd:`PgDn`
Scroll to top :kbd:`Home`
Scroll to bottom :kbd:`End`
Scroll to next page :kbd:`Space, PgDn`
Scroll to next page :kbd:`Space`, :kbd:`PgDn`
Scroll to previous page :kbd:`PgUp`
Scroll to next change :kbd:`n`
Scroll to previous change :kbd:`p`
@@ -85,8 +85,8 @@ Restore default context :kbd:`=`
Search forwards :kbd:`/`
Search backwards :kbd:`?`
Clear search :kbd:`Esc`
Scroll to next match :kbd:`>, .`
Scroll to previous match :kbd:`<, ,`
Scroll to next match :kbd:`>`, :kbd:`.`
Scroll to previous match :kbd:`<`, :kbd:`,`
========================= ===========================

View File

@@ -36,7 +36,7 @@ taken for different types of URLs <../open_actions>`.
The hints kitten is very powerful to see more detailed help on its various
options and modes of operation, see below. You can use these options to
create mappings in :file:`kitty.conf` to select various different text
snippets. See :sc:`insert_selected_path` for examples.
snippets. See :sc:`insert_selected_path <insert_selected_path>` for examples.
Completely customizing the matching and actions of the kitten
@@ -92,10 +92,9 @@ look it up in the Google dictionary.
.. note::
To avoid having to specify the same command line options on ever invocation,
you can use the :opt:`kitten_alias` option in :file:`kitty.conf` to create aliases
To avoid having to specify the same command line options on every invocation,
you can use the :opt:`action_alias` option in :file:`kitty.conf`, creating aliases
that have common sets of options. For example::
kitten_alias myhints hints --alphabet qfjdkslaureitywovmcxzpq1234567890
Documentation for the full set of options is below.
action_alias myhints kitten hints --alphabet qfjdkslaureitywovmcxzpq1234567890
map f1 myhints --customize-processing custom-hints.py

View File

@@ -3,7 +3,7 @@ Hyperlinked grep
This kitten allows you to search your files using `ripgrep
<https://www.google.com/search?q=ripgrep>`_ and open the results
<https://github.com/BurntSushi/ripgrep>`_ and open the results
directly in your favorite editor in the terminal, at the line containing
the search result, simply by clicking on the result you want.

View File

@@ -22,12 +22,15 @@ transferred to the remote computer. Note that this happens without needing
to install *any* special software on the server, beyond ``ls`` that supports
hyperlinks.
.. seealso:: See the :doc:`transfer` kitten
.. versionadded:: 0.19.0
.. note::
Nested SSH sessions are not supported. The kitten will always try to copy
remote files from the first SSH host. This is because there is no way for
|kitty| to detect and follow a nested SSH session robustly.
|kitty| to detect and follow a nested SSH session robustly. Use the
:doc:`transfer` kitten for such situations.
.. note::
If you have not setup automatic password-less SSH access, then, when

78
docs/kittens/themes.rst Normal file
View File

@@ -0,0 +1,78 @@
Changing kitty colors
========================
The themes kitten allows you to easily change color themes, from a collection
of almost two hundred pre-built themes available at `kitty-themes
<https://github.com/kovidgoyal/kitty-themes>`_. To use it, simply run::
kitty +kitten themes
.. image:: ../screenshots/themes.png
:alt: The themes kitten in action
:width: 600
The kitten allows you to pick a theme, with live previews of the colors. You
can choose between light and dark themes and search by theme name by just
typing a few characters from the name.
The kitten maintains a list of recently used themes to allow quick switching.
If you want to restore the colors to default, you can do so by choosing the
``Default`` theme.
.. versionadded:: 0.23.0
The themes kitten
How it works
----------------
A theme in kitty is just a :file:`.conf` file containing kitty settings.
When you select a theme, the kitten simply copies the :file:`.conf` file
to :file:`~/.config/kitty/current-theme.conf` and adds an include for
:file:`current-theme.conf` to :file:`kitty.conf`. It also comments out
any existing color settings in :file:`kitty.conf` so they do not interfere.
Once that's done, the kitten sends kitty a signal to make it reload its config.
Using your own themes
-----------------------
You can also create your own themes as :file:`.conf` files. Put them in the
:file:`themes` sub-directory of the kitty config directory, usually,
:file:`~/.config/kitty/themes` and the kitten will automatically add them to
the list of themes. You can use this to modify the builtin themes, by giving
the conf file the name :file:`Some theme name.conf` to override the builtin
theme of that name. Note that after doing so you have to run the kitten and
choose that theme once for your changes to be applied.
Contributing new themes
-------------------------
If you wish to contribute a new theme to the kitty theme repository, start by
going to the `kitty-themes <https://github.com/kovidgoyal/kitty-themes>`__
repository. `Fork it
<https://docs.github.com/en/get-started/quickstart/fork-a-repo>`_, and use the
file :download:`template.conf
<https://github.com/kovidgoyal/kitty-themes/raw/master/template.conf>` as a
template when creating your theme. Once you are satisfied with how it looks,
`submit a pull request
<https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request>`_
to have your theme merged into the `kitty-themes
<https://github.com/kovidgoyal/kitty-themes>`__ repository, which will make it
available in this kitten automatically.
Changing the theme non-interactively
---------------------------------------
You can specify the theme name as an argument when invoking the kitten
to have it change to that theme instantly. For example::
kitty +kitten themes --reload-in=all Dimmed Monokai
Will change the theme to ``Dimmed Monokai`` in all running kitty
instances. See below for more details on non-interactive operation.
.. include:: ../generated/cli-kitten-themes.rst

97
docs/kittens/transfer.rst Normal file
View File

@@ -0,0 +1,97 @@
Transfer files
================
.. _rsync: https://en.wikipedia.org/wiki/Rsync
.. warning::
This kitten is currently experimental, use with care.
Transfer files to and from remote computers over the ``TTY`` device itself.
This means that file transfer works over nested SSH sessions, serial links,
etc. Anywhere you have a terminal device, you can transfer files.
.. image:: ../screenshots/transfer.png
:alt: The transfer kitten at work
This kitten supports transferring entire directory trees, preserving soft and
hard links, file permissions, times, etc. It even supports the rsync_
protocol to transfer only changes to large files.
.. seealso:: See the :doc:`remote_file` kitten
.. note::
This kitten (which practically means kitty) must be installed on the other
machine as well. If that is not possible you can use the :doc:`remote_file`
kitten instead. Or write your own script to use the underlying :doc:`file transfer
protocol </file-transfer-protocol>`.
.. versionadded:: 0.24.0
Basic usage
---------------
In what follows, the *local computer* is the computer running this kitten and
the *remote computer* is the computer connected to the other end of the TTY pipe.
To send a file from the local computer to the remote computer, simply run::
kitty +kitten transfer /path/to/local/file /path/to/destination/on/remote/computer
You will be prompted by kitty for confirmation on allowing the transfer, and if
you grant permission, the file will be copied.
Similarly, to get a file from the remote computer to the local computer, use
the :option:`kitty +kitten transfer --direction` option::
kitty +kitten transfer --direction=receive /path/to/remote/file /path/to/destination/on/local/computer
Multiple files and even directories can be transferred::
kitty +kitten transfer file1 dir1 destination/
Here :file:`file1` will be copied inside :file:`destination` and :file:`dir1`
will be recursively copied into :file:`destination`. Note the trailing slash on
:file:`destination`. This tells kitty the destination is a directory. While not
strictly necessary (kitty will infer the need for a destination directory from
the fact that you are copying multiple things) it is good practice to always
use a trailing slash when the destination is supposed to be a directory.
Also, when transferring multiple files/directories it is a good idea to
use the :option:`kitty +kitten transfer --confirm-paths` option which will give
you an opportunity to review and confirm the files that will be touched.
Avoiding the confirmation prompt
------------------------------------
Normally, when you start a file transfer kitty will prompt you for
confirmation. This is to ensure that hostile programs running on a remote
machine cannot read/write files on your computer without your permission.
If the remote machine is trusted and the connection between your computer
and the remote machine is secure, then you can disable the confirmation prompt
by:
#. Setting the :opt:`file_transfer_confirmation_bypass` option to some
password.
#. When invoking the kitten use the :option:`kitty +kitten transfer --permissions-bypass`
to supply the password you set in step one.
.. warning:: Using a password to bypass confirmation means any software running
on the remote machine could potentially learn that password and use it to
gain full access to your computer. Also anyone that can intercept the data
stream between your computer and the remote machine can also learn this
password. So use it only with secure connections to trusted computers.
Delta transfers
-----------------------------------
This kitten has the ability to use the rsync_ protocol to only transfer the
differences between files. To turn it on use the :option:`kitty +kitten
transfer --transmit-deltas` option. Note that this will actually be slower when
transferring small files because of round trip overhead, so use with care.
.. include:: ../generated/cli-kitten-transfer.rst

View File

@@ -23,9 +23,9 @@ the arrow keys/tab to select the character from the displayed matches. You can
also type a space followed by a period and the index for the match if you don't
like to use arrow keys.
You can switch between modes using either the function keys or by pressing
:kbd:`Ctrl+[` and :kbd:`Ctrl+]` or by pressing :kbd:`Ctrl+Tab` and
:kbd:`Ctrl+Shift+Tab`.
You can switch between modes using either the keys :kbd:`F1` ... :kbd:`F4` or
:kbd:`Ctrl+1` ... :kbd:`Ctrl+4` or by pressing :kbd:`Ctrl+[` and :kbd:`Ctrl+]`
or by pressing :kbd:`Ctrl+Tab` and :kbd:`Ctrl+Shift+Tab`.
.. include:: ../generated/cli-kitten-unicode_input.rst

View File

@@ -9,10 +9,12 @@ Extend with kittens
kittens/icat
kittens/diff
kittens/unicode-input
kittens/unicode_input
kittens/themes
kittens/hints
kittens/remote_file
kittens/hyperlinked_grep
kittens/transfer
kittens/custom
kittens/*
@@ -30,7 +32,7 @@ Some prominent kittens:
images
:doc:`Unicode Input <kittens/unicode-input>`
:doc:`Unicode Input <kittens/unicode_input>`
Easily input arbitrary unicode characters in |kitty| by name or hex code.
@@ -44,6 +46,11 @@ Some prominent kittens:
the filename.
:doc:`Transfer files <kittens/transfer>`
Transfer files and directories seamlessly and easily from remote machines over your existing
SSH sessions with a simple command.
:doc:`Hyperlinked grep <kittens/hyperlinked_grep>`
Search your files using `ripgrep <https://github.com/BurntSushi/ripgrep>`_
and open the results directly in your favorite editor in the terminal,

View File

@@ -38,6 +38,18 @@ To pass the contents of the current screen and scrollback to the started process
There are many more powerful options, refer to the complete list below.
.. note::
To avoid duplicating launch actions with frequently used parameters, you can
use :opt:`action_alias` to define launch action aliases. For example::
action_alias launch_tab launch --cwd=current --type=tab
map f1 launch_tab vim
map f2 launch_tab emacs
The :kbd:`F1` key will now open vim in a new tab with the current windows
working directory
The piping environment
--------------------------
@@ -89,6 +101,8 @@ For example::
map f1 launch my-program @active-kitty-window-id
.. _watchers:
Watching launched windows
---------------------------
@@ -103,7 +117,7 @@ functions for the events you are interested in, for example:
# Here data will contain old_geometry and new_geometry
def on_focus_change(boss, window, data):
# Here data kill contain focused
# Here data will contain focused
def on_close(boss, window, data):
# called when window is closed, typically when the program running in
@@ -112,7 +126,7 @@ functions for the events you are interested in, for example:
Every callback is passed a reference to the global ``Boss`` object as well as
the ``Window`` object the action is occurring on. The ``data`` object is
mapping that contains event dependent data. Some useful methods and attributes
a dict that contains event dependent data. Some useful methods and attributes
for the ``Window`` object are: ``as_text(as_ans=False, add_history=False,
add_wrap_markers=False, alternate_screen=False)`` with which you can get the
contents of the window and its scrollback buffer. Similarly,
@@ -130,6 +144,7 @@ this **may not** be the value of ``PATH`` inside a shell, as shell startup scrip
often change the value of this variable. If it is not found there, then a
system specific list of default paths is searched. If it is still not found,
then your shell is run and the value of ``PATH`` inside the shell is used.
See :opt:`exe_search_path` for details and how to control this.
Syntax reference
------------------

View File

@@ -145,11 +145,14 @@ define a few extra keybindings in :file:`kitty.conf`::
map ctrl+down neighboring_window down
Now you can create horizontal and vertical splits by using :kbd:`F5` and
:kbd:`F6`. You can move them around using :kbd:`shift+arrow keys`
and you can move focus to neighboring windows using :kbd:`ctrl+arrow keys`.
:kbd:`F6`. You can move them around using :kbd:`shift+arrow` keys
and you can move focus to neighboring windows using :kbd:`ctrl+arrow` keys.
You can switch an existing split from horizontal to vertical and vice versa
using :kbd:`F7`. Finally, windows can be resized using :ref:`window_resizing`.
Note that you can swap the windows in a split using the ``rotate`` action with
an argument of ``180`` and rotate and swap with an argument of ``270``.
This layout takes one option, ``split_axis`` that controls whether new windows
are placed into vertical or horizontal splits, by default::

View File

@@ -58,6 +58,12 @@ some special variables, documented below:
``FRAGMENT``
The fragment (unquoted), if any of the URL or the empty string.
.. note::
You can use the :opt:`action_alias` option just as in kitty.conf to
define aliases for frequently used actions.
.. _matching_criteria:
Matching criteria

View File

@@ -79,7 +79,7 @@ Extending kitty
kitty has a powerful framework for scripting. You can create small terminal
programs called :doc:`kittens <kittens_intro>`. These can used to add features
to kitty, for example, :doc:`editing remote files <kittens/remote_file>` or
:doc:`inputting unicode characters <kittens/unicode-input>`. They can also be
:doc:`inputting unicode characters <kittens/unicode_input>`. They can also be
used to create programs that leverage kitty's powerful features, for example,
:doc:`viewing images <kittens/icat>` or :doc:`diffing files with images
<kittens/diff>`.
@@ -116,7 +116,7 @@ endless. See the :doc:`tutorial <remote-control>` to get started.
Startup Sessions
------------------
You can control the :term:`tabs <tab>`, `:term:`kitty window <window>` layout,
You can control the :term:`tabs <tab>`, :term:`kitty window <window>` layout,
working directory, startup programs,
etc. by creating a "session" file and using the :option:`kitty --session`
command line flag or the :opt:`startup_session` option in :file:`kitty.conf`.
@@ -191,8 +191,10 @@ Mouse features
platforms with a primary clipboard).
* You can middle click to paste from the primary clipboard (on platforms
with a primary clipboard).
* You can right click while holding :kbd:`ctrl+shift` to open the output
of the clicked on command in a pager (requires :ref:`shell_integration`)
* You can select text with kitty even when a terminal program has grabbed
the mouse by holding down the :kbd:`shift` key.
the mouse by holding down the :kbd:`shift` key
All these actions can be customized in :file:`kitty.conf` as described
:ref:`here <conf-kitty-mouse.mousemap>`.
@@ -242,15 +244,31 @@ for example::
map f1 launch --stdin-source=@screen_scrollback --stdin-add-formatting less +G -R
Would open the scrollback buffer in a new :term:`window` when you press the :kbd:`F1`
key. See :sc:`show_scrollback` for details.
key. See :sc:`show_scrollback <show_scrollback>` for details.
If you want to use it with an editor such as vim to get more powerful features,
you can see tips for doing so, in
`this thread <https://github.com/kovidgoyal/kitty/issues/719>`_.
If you wish to store very large amounts of scrollback to view using the piping or
:sc:`show_scrollback` features, you can use the :opt:`scrollback_pager_history_size`
option.
:sc:`show_scrollback <show_scrollback>` features, you can use the
:opt:`scrollback_pager_history_size` option.
Integration with shells
---------------------------------
kitty has the ability to integrate closely within common shells, such as `zsh
<https://www.zsh.org/>`_, `fish <https://fishshell.com>`_ and `bash
<https://www.gnu.org/software/bash/>`_ to enable features such as jumping to
previous prompts in the scrollback, viewing the output of the last command in
:program:`less`, using the mouse to move the cursor while editing prompts, etc.
See :doc:`shell-integration` for details.
.. toctree::
:hidden:
shell-integration
.. _cpbuf:

View File

@@ -26,6 +26,7 @@ please do so by opening issues in the `GitHub
underlines
graphics-protocol
keyboard-protocol
file-transfer-protocol
desktop-notifications
unscroll
color-stack

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

After

Width:  |  Height:  |  Size: 118 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

After

Width:  |  Height:  |  Size: 958 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 40 KiB

BIN
docs/screenshots/themes.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

265
docs/shell-integration.rst Normal file
View File

@@ -0,0 +1,265 @@
.. _shell_integration:
Shell integration
-------------------
kitty has the ability to integrate closely within common shells, such as `zsh
<https://www.zsh.org/>`_, `fish <https://fishshell.com>`_ and `bash
<https://www.gnu.org/software/bash/>`_ to enable features such as jumping to
previous prompts in the scrollback, viewing the output of the last command in
:program:`less`, using the mouse to move the cursor while editing prompts, etc.
.. versionadded:: 0.24.0
Features
-------------
* Open the output of the last command in a pager such as :program:`less`
(:sc:`show_last_command_output`)
* Jump to the previous/next prompt in the scrollback
(:sc:`scroll_to_previous_prompt` / :sc:`scroll_to_next_prompt`)
* Click with the mouse anywhere in the current command to move the cursor there
* Hold :kbd:`ctrl+shift` and right-click on any command output in the scrollback
to view it in a pager
* The current working directory or the command being executed are automatically
displayed in the kitty window titlebar/tab title.
* The text cursor is changed to a bar when editing commands at the shell prompt
* Glitch free window resizing even with complex prompts. Achieved by erasing
the prompt on resize and allowing the shell to redraw it cleanly.
* Sophisticated completion for the :program:`kitty` command in the shell.
* When confirming a quit command if a window is sitting at a shell prompt,
it is optionally, not counted (see :opt:`confirm_os_window_close`)
Configuration
---------------
Shell integration is controlled by the :opt:`shell_integration` option. By
default, all shell integration is enabled. Individual features can be turned
off or it can be disabled entirely as well. The :opt:`shell_integration` option
takes a space separated list of keywords:
disabled
Turn off all shell integration
no-rc
Do not modify the shell's launch environment to enable integration. Useful if you prefer
to :ref:`manually enable integration <manual_shell_integration>`.
no-cursor
Turn off changing of the text cursor to a bar when editing text
no-title
Turn off setting the kitty window/tab title based on shell state
no-prompt-mark
Turn off marking of prompts. This disables jumping to prompt, browsing
output of last command and click to move cursor functionality.
no-complete
Turn off completion for the kitty command.
More ways to browse command output
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You can add further key and mouse bindings to browse the output of commands
easily. For example to select the output of a command by right clicking the mouse
on the output, define the following in :file:`kitty.conf`:
.. code:: conf
mouse_map right press ungrabbed mouse_select_command_output
Now, when you right click on the output, the entire output is selected, ready
to be copied.
The feature to jump to previous prompts (
:sc:`scroll_to_previous_prompt` and :sc:`scroll_to_next_prompt`) and mouse
actions (:ref:`action-mouse_select_command_output` and :ref:`action-mouse_show_command_output`) can
be integrated with browsing command output as well. For example, define the
following mapping in :file:`kitty.conf`:
.. code:: conf
map f1 show_last_visited_command_output
Now, pressing :kbd:`F1` will cause the output of the last jumped to command or
the last mouse clicked command output to be opened in a pager for easy browsing.
In addition, You can define shortcut to get the first command output on screen.
For example, define the following in :file:`kitty.conf`:
.. code:: conf
map f1 show_first_command_output_on_screen
Now, pressing :kbd:`F1` will cause the output of the first command output on
screen to be opened in a pager.
You can also add shortcut to scroll to the last jumped position. For example,
define the following in :file:`kitty.conf`:
.. code:: conf
map f1 scroll_to_prompt 0
How it works
-----------------
At startup, kitty detects if the shell you have configured (either system wide
or in kitty.conf) is a supported shell. If so, kitty injects some shell specific
code into the shell, to enable shell integration. How it does so varies for
different shells.
.. tab:: zsh
For zsh, kitty sets the ``ZDOTDIR`` environment variable to make zsh load
kitty's :file:`.zshenv` which restores the original value of ``ZDOTDIR``
and sources the original :file:`.zshenv`. It then loads the shell integration code.
The remainder of zsh's startup process proceeds as normal.
.. tab:: fish
For fish, to make it automatically load the integration code provided by
kitty, the integration script directory path is prepended to the
:code:`XDG_DATA_DIRS` environment variable. This is only applied to the fish
process and will be cleaned up by the integration script after startup. No files
are added or modified.
.. tab:: bash
For bash, kitty adds a couple of lines to the bottom of :file:`~/.bashrc`
(in an atomic manner) to load the shell integration code.
Then, when launching the shell, kitty sets the environment variable
:envvar:`KITTY_SHELL_INTEGRATION` to the value of the :opt:`shell_integration`
option. The shell integration code reads the environment variable, turns on the
specified integration functionality and then unsets the variable so as to not
pollute the system. This has the nice effect that the changes to the shell's rc
files become no-ops when running the shell in anything other than kitty itself.
The actual shell integration code uses hooks provided by each shell to send
special escape codes to kitty, to perform the various tasks. You can see the
code used for each shell below:
.. raw:: html
<details>
<summary>Click to toggle shell integration code</summary>
.. tab:: zsh
.. literalinclude:: ../shell-integration/zsh/kitty-integration
:language: zsh
.. tab:: fish
.. literalinclude:: ../shell-integration/fish/vendor_conf.d/kitty-shell-integration.fish
:language: fish
.. tab:: bash
.. literalinclude:: ../shell-integration/bash/kitty.bash
:language: bash
.. raw:: html
</details>
.. _manual_shell_integration:
Manual shell integration
----------------------------
The automatic shell integration is designed to be minimally intrusive, as such
it wont work for sub-shells, terminal multiplexers, containers, remote systems, etc.
For such systems, you should setup manual shell integration by adding some code
to your shells startup files to load the shell integration script.
First, in :file:`kitty.conf` set:
.. code-block:: conf
shell_integration disabled
Then in your shell's rc file, add the lines:
.. tab:: zsh
.. code-block:: sh
if test -n "$KITTY_INSTALLATION_DIR"; then
export KITTY_SHELL_INTEGRATION="enabled"
autoload -Uz -- "$KITTY_INSTALLATION_DIR"/shell-integration/zsh/kitty-integration
kitty-integration
unfunction kitty-integration
fi
.. tab:: fish
.. code-block:: fish
if set -q KITTY_INSTALLATION_DIR
set --global KITTY_SHELL_INTEGRATION enabled
source "$KITTY_INSTALLATION_DIR/shell-integration/fish/vendor_conf.d/kitty-shell-integration.fish"
set --prepend fish_complete_path "$KITTY_INSTALLATION_DIR/shell-integration/fish/vendor_completions.d"
end
.. tab:: bash
.. code-block:: sh
if test -n "$KITTY_INSTALLATION_DIR"; then
export KITTY_SHELL_INTEGRATION="enabled"
source "$KITTY_INSTALLATION_DIR/shell-integration/bash/kitty.bash"
fi
The value of :envvar:`KITTY_SHELL_INTEGRATION` is the same as that for
:opt:`shell_integration`, except if you want to disable shell integration
completely, in which case simply do not set the
:envvar:`KITTY_SHELL_INTEGRATION` variable at all.
If you want this to work while SSHing into a remote system, then you will
need to add some code to the snippets above to check if :code:`KITTY_INSTALLATION_DIR`
is empty and if so to set it to some hard coded location with the shell
integration scripts that need to be copied onto the remote system.
Notes for shell developers
-----------------------------
The protocol used for marking the prompt is very simple. You should consider
adding it to your shell as a builtin. Many modern terminals make use of it, for
example: kitty, iTerm2, WezTerm, DomTerm
Just before starting to draw the PS1 prompt send the escape code::
<OSC>133;A<ST>
Just before starting to draw the PS2 prompt send the escape code::
<OSC>133;A;k=s<ST>
Just before running a command/program, send the escape code::
<OSC>133;C<ST>
Here ``<OSC>`` is the bytes ``0x1b 0x5d`` and ``<ST>`` is the bytes ``0x1b
0x5c``. This is exactly what is needed for shell integration in kitty. For the
full protocol, that also marks the command region, see `the iTerm2 docs
<https://iterm2.com/documentation-escape-codes.html>`_.

View File

@@ -1,7 +1,12 @@
<style>
#support-buttons {
display: flex;
flex-wrap: wrap;
}
.support-button {
box-sizing: border-box;
border-radius: 6px;
box-shadow: rgb(255, 246, 175) 0px 1px 0px 0px;
display: inline-block;
cursor: pointer;
color: rgb(51, 51, 51);
@@ -10,15 +15,16 @@
font-weight: bold;
padding: 8px 24px;
text-decoration: none;
margin-left: 1em;
outline: 0;
border-width: 0;
}
.support-button:hover {
transform: scale(1.5);
transform: scale(1.2);
border: solid 1px rgb(92, 184, 92);
}
.support-button {
outline: 0;
}
.support-button:visited {
color: rgb(51, 51, 51);
outline: 0;
@@ -30,28 +36,34 @@
}
#paypal input[type=submit] {
background: linear-gradient(rgb(255, 236, 100) 5%, rgb(255, 171, 35) 100%) rgb(255, 236, 100);
border: 1px solid rgb(255, 171, 35);
background: linear-gradient(rgb(92, 184, 92) 5%, rgb(62, 142, 62) 100%) rgb(92, 184, 92);
padding-top: 10px; padding-bottom: 10px;
color: rgb(51, 51, 51);
border: 1px solid rgb(92, 184, 92);
}
#liberapay a {
a.support-button {
background: linear-gradient(rgb(92, 184, 92) 5%, rgb(62, 142, 62) 100%) rgb(92, 184, 92);
border: 1px solid rgb(62, 142, 62);
color: rgb(51, 51, 51);
}
#patreon a {
background: linear-gradient(rgb(11, 100, 163) 5%, rgb(5, 45, 73) 100%) rgb(11, 100, 163);
border: 1px solid rgb(5, 45, 73);
color: #eee;
}
</style>
<div id="support-buttons">
<div id="github">
<a class="support-button" href="https://github.com/sponsors/kovidgoyal">Patronage via GitHub</a>
</div>
<div id="patreon">
<a class="support-button" href="https://www.patreon.com/bePatron?u=917933">Patronage via Patreon</a>
</div>
<div id="liberapay">
<a class="support-button" href="https://liberapay.com/kovidgoyal/donate">Patronage via Liberapay</a>
</div>
<div>
<form id="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" title="Contribute to support calibre development">
<input type="hidden" name="cmd" value="_s-xclick" />
@@ -61,9 +73,5 @@
</form>
</div>
<div id="liberapay">
<a class="support-button" href="https://liberapay.com/kovidgoyal/donate">Patronage via Liberapay</a>
</div>
</div>

View File

@@ -1,5 +1,5 @@
Support kitty development
===========================
Support kitty development ❤️
==============================
My goal with |kitty| is to move the stagnant terminal ecosystem forward. To that
end kitty has many foundational features, such as: :doc:`image support
@@ -7,7 +7,7 @@ end kitty has many foundational features, such as: :doc:`image support
:doc:`various enhancements to the terminal protocol <protocol-extensions>`,
etc. These features allow the development of rich terminal applications, such
as :doc:`Side-by-side diff <kittens/diff>` and :doc:`Unicode input
<kittens/unicode-input>`.
<kittens/unicode_input>`.
If you wish to support this mission and see the terminal ecosystem evolve,
consider donating so that I can devote more time to |kitty| development.
@@ -15,8 +15,7 @@ I have personally written `almost all kitty code
<https://github.com/kovidgoyal/kitty/graphs/contributors>`_.
You can choose to make either a one-time payment via PayPal or become a
*patron* of kitty development via the Patreon or Liberapay services
below:
*patron* of kitty development via one of the services below:
.. raw:: html

View File

@@ -32,3 +32,7 @@ See `discussion here
<https://gitlab.freedesktop.org/terminal-wg/specifications/-/issues/30>`_.
.. versionadded:: 0.20.2
Also supported by the terminals:
* `mintty <https://github.com/mintty/mintty/releases/tag/3.5.2>`_

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# vim:fileencoding=utf-8
# License: GPLv3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
import subprocess

View File

@@ -1,14 +1,41 @@
#!/usr/bin/env python
# vim:fileencoding=utf-8
# License: GPLv3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
import re
from typing import List
from kitty.conf.generate import write_output
def patch_color_list(path: str, colors: List[str], name: str, spc: str = ' ') -> None:
with open(path, 'r+') as f:
raw = f.read()
nraw = re.sub(
fr'(# {name}_COLORS_START).+?(\s+# {name}_COLORS_END)',
r'\1' + f'\n{spc}' + f'\n{spc}'.join(map(lambda x: f'{x!r},', sorted(colors))) + r'\2',
raw, flags=re.DOTALL | re.MULTILINE)
if nraw != raw:
f.seek(0)
f.truncate()
f.write(nraw)
def main() -> None:
from kitty.options.definition import definition
write_output('kitty', definition)
nullable_colors = []
all_colors = []
for opt in definition.iter_all_options():
if callable(opt.parser_func):
if opt.parser_func.__name__ in ('to_color_or_none', 'cursor_text_color'):
nullable_colors.append(opt.name)
all_colors.append(opt.name)
elif opt.parser_func.__name__ in ('to_color', 'titlebar_color', 'macos_titlebar_color'):
all_colors.append(opt.name)
patch_color_list('kitty/rc/set_colors.py', nullable_colors, 'NULLABLE')
patch_color_list('kittens/themes/collection.py', all_colors, 'ALL', ' ' * 8)
from kittens.diff.options.definition import definition as kd
write_output('kittens.diff', kd)

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python
# vim:fileencoding=utf-8
# License: GPLv3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
import string
@@ -245,7 +244,7 @@ def patch_file(path: str, what: str, text: str, start_marker: str = '/* ', end_m
f.write(raw)
def serialize_dict(x: dict) -> str:
def serialize_dict(x: Dict[Any, Any]) -> str:
return pformat(x, indent=4).replace('{', '{\n ', 1)
@@ -349,7 +348,7 @@ def generate_legacy_text_key_maps() -> None:
patch_file('kitty_tests/keys.py', 'legacy letter tests', '\n'.join(tests), start_marker='# ', end_marker='')
def chunks(lst: List, n: int) -> Any:
def chunks(lst: List[Any], n: int) -> Any:
"""Yield successive n-sized chunks from lst."""
for i in range(0, len(lst), n):
yield lst[i:i + n]

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
import os
@@ -50,10 +49,25 @@ class_maps: Dict[str, Set[int]] = {}
all_symbols: Set[int] = set()
name_map: Dict[int, str] = {}
word_search_map: DefaultDict[str, Set[int]] = defaultdict(set)
zwj = 0x200d
soft_hyphen = 0xad
flag_codepoints = frozenset(range(0x1F1E6, 0x1F1E6 + 26))
marks = set(emoji_skin_tone_modifiers) | {zwj} | flag_codepoints
# See https://github.com/harfbuzz/harfbuzz/issues/169
marks = set(emoji_skin_tone_modifiers) | flag_codepoints
not_assigned = set(range(0, sys.maxunicode))
property_maps: Dict[str, Set[int]] = defaultdict(set)
def parse_prop_list() -> None:
global marks
for line in get_data('ucd/PropList.txt'):
if line.startswith('#'):
continue
cp_or_range, rest = line.split(';', 1)
chars = parse_range_spec(cp_or_range.strip())
name = rest.strip().split()[0]
property_maps[name] |= chars
# see https://www.unicode.org/faq/unsup_char.html#3
marks |= property_maps['Other_Default_Ignorable_Code_Point']
def parse_ucd() -> None:
@@ -97,6 +111,12 @@ def parse_ucd() -> None:
marks.add(codepoint)
elif category.startswith('S'):
all_symbols.add(codepoint)
elif category == 'Cf':
# we add Cf to marks as it contains things like tags and zero
# width chars. Not sure if *all* of Cf should be treated as
# combining chars, might need to add individual exceptions in
# the future.
marks.add(codepoint)
with open('nerd-fonts-glyphs.txt') as f:
for line in f:
@@ -213,7 +233,7 @@ def parse_eaw() -> None:
if eaw == 'A':
ambiguous |= chars
seen |= chars
elif eaw == 'W' or eaw == 'F':
elif eaw in ('W', 'F'):
doublewidth |= chars
seen |= chars
doublewidth |= set(range(0x3400, 0x4DBF + 1)) - seen
@@ -234,15 +254,15 @@ def get_ranges(items: List[int]) -> Generator[Union[int, Tuple[int, int]], None,
yield a, b
def write_case(spec: Union[Tuple, int], p: Callable) -> None:
def write_case(spec: Union[Tuple[int, ...], int], p: Callable[..., None]) -> None:
if isinstance(spec, tuple):
p('\t\tcase 0x{:x} ... 0x{:x}:'.format(*spec))
else:
p('\t\tcase 0x{:x}:'.format(spec))
p(f'\t\tcase 0x{spec:x}:')
@contextmanager
def create_header(path: str, include_data_types: bool = True) -> Generator[Callable, None, None]:
def create_header(path: str, include_data_types: bool = True) -> Generator[Callable[..., None], None, None]:
with open(path, 'w') as f:
p = partial(print, file=f)
p('// unicode data, built from the unicode standard on:', date.today())
@@ -282,7 +302,7 @@ def gen_emoji() -> None:
def category_test(
name: str,
p: Callable,
p: Callable[..., None],
classes: Iterable[str],
comment: str,
use_static: bool = False,
@@ -312,7 +332,7 @@ def category_test(
p('\treturn false;\n}\n')
def codepoint_to_mark_map(p: Callable, mark_map: List[int]) -> Dict[int, int]:
def codepoint_to_mark_map(p: Callable[..., None], mark_map: List[int]) -> Dict[int, int]:
p('\tswitch(c) { // {{{')
rmap = {c: m for m, c in enumerate(mark_map)}
for spec in get_ranges(mark_map):
@@ -336,10 +356,10 @@ def classes_to_regex(classes: Iterable[str], exclude: str = '') -> Iterable[str]
def as_string(codepoint: int) -> str:
if codepoint < 256:
return r'\x{:02x}'.format(codepoint)
return fr'\x{codepoint:02x}'
if codepoint <= 0xffff:
return r'\u{:04x}'.format(codepoint)
return r'\U{:08x}'.format(codepoint)
return fr'\u{codepoint:04x}'
return fr'\U{codepoint:08x}'
for spec in get_ranges(list(chars)):
if isinstance(spec, tuple):
@@ -354,16 +374,21 @@ def gen_ucd() -> None:
p('#include "unicode-data.h"')
category_test(
'is_combining_char', p,
{c for c in class_maps if c.startswith('M')},
'M category (marks)',
# See https://github.com/harfbuzz/harfbuzz/issues/169
extra_chars=emoji_skin_tone_modifiers | {zwj},
(),
'Combining and default ignored characters',
extra_chars=marks,
least_check_return='false'
)
category_test(
'is_ignored_char', p, 'Cc Cf Cs'.split(),
'is_ignored_char', p, 'Cc Cs'.split(),
'Control characters and non-characters',
extra_chars=non_characters, exclude={zwj},
extra_chars=non_characters,
ascii_range='false'
)
category_test(
'is_non_rendered_char', p, 'Cc Cs Cf'.split(),
'Other_Default_Ignorable_Code_Point and soft hyphen',
extra_chars=property_maps['Other_Default_Ignorable_Code_Point'] | set(range(0xfe00, 0xfe0f + 1)),
ascii_range='false'
)
category_test('is_word_char', p, {c for c in class_maps if c[0] in 'LN'}, 'L and N categories')
@@ -378,15 +403,19 @@ def gen_ucd() -> None:
p('combining_type mark_for_codepoint(char_type c) {')
rmap = codepoint_to_mark_map(p, mark_map)
p('}\n')
with open('kitty/unicode-data.h') as f:
unicode_data = f.read()
m = re.search(r'^#define VS15 (\d+)', unicode_data, re.M)
if m is not None:
expected = int(m.group(1))
if rmap[0xfe0e] != expected:
raise ValueError('The mark for 0xfe0e has changed, you have to update VS15 to {} and VS16 to {} in unicode-data.h'.format(
rmap[0xfe0e], rmap[0xfe0f]
))
with open('kitty/unicode-data.h', 'r+') as f:
raw = f.read()
f.seek(0)
raw, num = re.subn(
r'^// START_KNOWN_MARKS.+?^// END_KNOWN_MARKS',
'// START_KNOWN_MARKS\nstatic const combining_type '
f'VS15 = {rmap[0xfe0e]}, VS16 = {rmap[0xfe0f]};'
'\n// END_KNOWN_MARKS', raw, flags=re.MULTILINE | re.DOTALL)
if not num:
raise SystemExit('Faile dto patch mark definitions in unicode-data.h')
f.truncate()
f.write(raw)
with open('kittens/hints/url_regex.py', 'w') as f:
f.write('# generated by gen-wcwidth.py, do not edit\n\n')
f.write("url_delimiters = '{}' # noqa".format(''.join(classes_to_regex(cz, exclude='\n\r'))))
@@ -496,7 +525,7 @@ def gen_names() -> None:
def gen_wcwidth() -> None:
seen: Set[int] = set()
def add(p: Callable, comment: str, chars_: Union[Set[int], FrozenSet[int]], ret: int) -> None:
def add(p: Callable[..., None], comment: str, chars_: Union[Set[int], FrozenSet[int]], ret: int) -> None:
chars = chars_ - seen
seen.update(chars)
p(f'\t\t// {comment} ({len(chars)} codepoints)' + ' {{' '{')
@@ -537,6 +566,7 @@ def gen_wcwidth() -> None:
parse_ucd()
parse_prop_list()
parse_emoji()
parse_eaw()
gen_ucd()

View File

@@ -91,7 +91,7 @@ compare_timers(const void *a_, const void *b_) {
return (a->trigger_at > b->trigger_at) ? 1 : (a->trigger_at < b->trigger_at) ? -1 : 0;
}
static inline void
static void
update_timers(EventLoopData *eld) {
if (eld->timers_count > 1) qsort(eld->timers, eld->timers_count, sizeof(eld->timers[0]), compare_timers);
}
@@ -164,7 +164,7 @@ prepareForPoll(EventLoopData *eld, monotonic_t timeout) {
return timeout;
}
static inline struct timespec
static struct timespec
calc_time(monotonic_t nsec) {
struct timespec result;
result.tv_sec = nsec / (1000LL * 1000LL * 1000LL);
@@ -271,7 +271,7 @@ wakeupEventLoop(EventLoopData *eld) {
}
#ifndef HAS_EVENT_FD
static inline void
static void
closeFds(int *fds, size_t count) {
while(count--) {
if (*fds > 0) {

View File

@@ -453,24 +453,74 @@ void* _glfwLoadLocalVulkanLoaderNS(void)
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
static inline bool
is_ctrl_tab(NSEvent *event, NSEventModifierFlags modifierFlags) {
static bool
is_modified_tab(NSEvent *event, NSEventModifierFlags modifierFlags) {
switch ((NSUInteger)modifierFlags) {
// No need to handle shift+tab, [shift]+option+tab
case NSEventModifierFlagShift:
case NSEventModifierFlagOption:
case (NSEventModifierFlagShift | NSEventModifierFlagOption):
// Do not intercept cmd+tab, shift+cmd+tab
case NSEventModifierFlagCommand:
case (NSEventModifierFlagShift | NSEventModifierFlagCommand):
return false;
default:
break;
}
// ctrl+whatever+tab, option+cmd+tab
if (
(modifierFlags == NSEventModifierFlagControl &&
[event.charactersIgnoringModifiers isEqualToString:@"\t"]) ||
(modifierFlags == (NSEventModifierFlagControl | NSEventModifierFlagShift) &&
[event.charactersIgnoringModifiers isEqualToString:@"\x19"])
(
(modifierFlags & NSEventModifierFlagControl) ||
modifierFlags == (NSEventModifierFlagOption | NSEventModifierFlagCommand)
) && [event.charactersIgnoringModifiers isEqualToString:@"\t"]
) return true;
// shift+whatever+tab
if (
(modifierFlags & NSEventModifierFlagShift) &&
[event.charactersIgnoringModifiers isEqualToString:@"\x19"]
) return true;
return false;
}
static inline bool
static bool
is_cmd_period(NSEvent *event, NSEventModifierFlags modifierFlags) {
if (modifierFlags != NSEventModifierFlagCommand) return false;
if ([event.charactersIgnoringModifiers isEqualToString:@"."]) return true;
return false;
}
static bool
is_modified_special_key(NSEvent *event, NSEventModifierFlags modifierFlags) {
// really one should use [[NSUserDefaults standardUserDefaults] valueForDefaultsDomain:@"com.apple.symbolichotkeys" key:@"AppleSymbolicHotKeys"]
// to get the list of global shortcuts and pass through the important ones,
// see https://stackoverflow.com/questions/21878482/what-do-the-parameter-values-in-applesymbolichotkeys-plist-dict-represent
// however given that in order to know which integers are which actions in that dict one needs reverse engineering
// see https://stackoverflow.com/questions/866056/how-do-i-programmatically-get-the-shortcut-keys-reserved-by-mac-os-x
// it's too much effort.
if ([event.charactersIgnoringModifiers length] != 1) return false;
const unichar ch = [event.charactersIgnoringModifiers characterAtIndex:0];
if (modifierFlags == (NSEventModifierFlagControl | NSEventModifierFlagShift)) {
switch (ch) {
case 0x1b: // Esc
case NSF1FunctionKey: case NSF2FunctionKey: case NSF3FunctionKey: case NSF4FunctionKey:
case NSF5FunctionKey: case NSF6FunctionKey: case NSF7FunctionKey: case NSF8FunctionKey:
case NSF9FunctionKey: case NSF10FunctionKey: case NSF11FunctionKey: case NSF12FunctionKey:
case NSF13FunctionKey: case NSF14FunctionKey: case NSF15FunctionKey: case NSF16FunctionKey:
case NSF17FunctionKey: case NSF18FunctionKey: case NSF19FunctionKey:
return true;
}
}
switch (ch) {
case 0x1b: // Esc
if (modifierFlags & (NSEventModifierFlagCommand | NSEventModifierFlagControl)) return true;
break;
case NSHelpFunctionKey: // For some reason keyboards with an insert key have it mapped to help
if (!modifierFlags || modifierFlags == NSEventModifierFlagShift) return true;
break;
}
return false;
}
GLFWAPI GLFWapplicationshouldhandlereopenfun glfwSetApplicationShouldHandleReopen(GLFWapplicationshouldhandlereopenfun callback) {
GLFWapplicationshouldhandlereopenfun previous = handle_reopen_callback;
handle_reopen_callback = callback;
@@ -510,10 +560,11 @@ int _glfwPlatformInit(void)
NSEvent* (^keydown_block)(NSEvent*) = ^ NSEvent* (NSEvent* event)
{
NSEventModifierFlags modifierFlags = [event modifierFlags] & NSEventModifierFlagDeviceIndependentFlagsMask;
if (is_ctrl_tab(event, modifierFlags) || is_cmd_period(event, modifierFlags)) {
// Cocoa swallows Ctrl+Tab to cycle between views
NSEventModifierFlags modifierFlags = [event modifierFlags] & (NSEventModifierFlagShift | NSEventModifierFlagOption | NSEventModifierFlagCommand | NSEventModifierFlagControl);
if (is_modified_special_key(event, modifierFlags) || is_modified_tab(event, modifierFlags) || is_cmd_period(event, modifierFlags)) {
// Cocoa swallows various key presses, so route them explicitly
[[NSApp keyWindow].contentView keyDown:event];
return nil;
}
return event;
@@ -521,16 +572,17 @@ int _glfwPlatformInit(void)
NSEvent* (^keyup_block)(NSEvent*) = ^ NSEvent* (NSEvent* event)
{
NSEventModifierFlags modifierFlags = [event modifierFlags] & NSEventModifierFlagDeviceIndependentFlagsMask;
NSEventModifierFlags modifierFlags = [event modifierFlags] & (NSEventModifierFlagShift | NSEventModifierFlagOption | NSEventModifierFlagCommand | NSEventModifierFlagControl);
if (modifierFlags & NSEventModifierFlagCommand) {
// From http://cocoadev.com/index.pl?GameKeyboardHandlingAlmost
// From https://cocoadev.github.io/GameKeyboardHandlingAlmost/
// This works around an AppKit bug, where key up events while holding
// down the command key don't get sent to the key window.
[[NSApp keyWindow] sendEvent:event];
}
if (is_ctrl_tab(event, modifierFlags) || is_cmd_period(event, modifierFlags)) {
// Cocoa swallows Ctrl+Tab to cycle between views
if (is_modified_special_key(event, modifierFlags) || is_modified_tab(event, modifierFlags) || is_cmd_period(event, modifierFlags)) {
// Cocoa swallows various key presses, so route them explicitly
[[NSApp keyWindow].contentView keyUp:event];
return nil;
}
return event;
@@ -703,7 +755,7 @@ typedef struct {
static Timer timers[128] = {{0}};
static size_t num_timers = 0;
static inline void
static void
remove_timer_at(size_t idx) {
if (idx < num_timers) {
Timer *t = timers + idx;

View File

@@ -61,7 +61,7 @@ getDisplayName(CGDirectDisplayID displayID, NSScreen* screen)
io_service_t service;
CFDictionaryRef info;
if (IOServiceGetMatchingServices(kIOMainPortDefault,
if (IOServiceGetMatchingServices(0,
IOServiceMatching("IODisplayConnect"),
&it) != 0)
{
@@ -259,7 +259,7 @@ static double getFallbackRefreshRate(CGDirectDisplayID displayID)
io_iterator_t it;
io_service_t service;
if (IOServiceGetMatchingServices(kIOMainPortDefault,
if (IOServiceGetMatchingServices(0,
IOServiceMatching("IOFramebuffer"),
&it) != 0)
{

View File

@@ -39,9 +39,6 @@ typedef void* CVDisplayLinkRef;
// NOTE: Many Cocoa enum values have been renamed and we need to build across
// SDK versions where one is unavailable or the other deprecated
// We use the newer names in code and these macros to handle compatibility
#if (MAC_OS_X_VERSION_MAX_ALLOWED < 120000) // Before macOS 12 Monterey
#define kIOMainPortDefault kIOMasterPortDefault
#endif
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
#define NSBitmapFormatAlphaNonpremultiplied NSAlphaNonpremultipliedBitmapFormat
#define NSEventMaskAny NSAnyEventMask

View File

@@ -38,6 +38,16 @@
#define NSControlStateValueMixed NSMixedState
#endif
static const char*
polymorphic_string_as_utf8(id string) {
if (string == nil) return "(nil)";
NSString* characters;
if ([string isKindOfClass:[NSAttributedString class]])
characters = [string string];
else
characters = (NSString*) string;
return [characters UTF8String];
}
static uint32_t
vk_code_to_functional_key_code(uint8_t key_code) { // {{{
@@ -233,10 +243,10 @@ mac_ucode_to_functional(uint32_t key_code) { // {{{
}
} // }}}
static inline bool
static bool
is_surrogate(UniChar uc) { return (uc - 0xd800u) < 2048u; }
static inline uint32_t
static uint32_t
get_first_codepoint(UniChar *utf16, UniCharCount num) {
if (!num) return 0;
if (!is_surrogate(*utf16)) return *utf16;
@@ -244,7 +254,7 @@ get_first_codepoint(UniChar *utf16, UniCharCount num) {
return 0;
}
static inline bool
static bool
is_pua_char(uint32_t ch) {
return (0xE000 <= ch && ch <= 0xF8FF) || (0xF0000 <= ch && ch <= 0xFFFFF) || (0x100000 <= ch && ch <= 0x10FFFF);
}
@@ -321,7 +331,7 @@ _glfwShutdownCVDisplayLink(unsigned long long timer_id UNUSED, void *user_data U
}
}
static inline void
static void
requestRenderFrame(_GLFWwindow *w, GLFWcocoarenderframefun callback) {
if (!callback) {
w->ns.renderFrameRequested = false;
@@ -505,7 +515,7 @@ translateFlags(NSUInteger flags)
#define debug_key(...) if (_glfw.hints.init.debugKeyboard) { fprintf(stderr, __VA_ARGS__); fflush(stderr); }
static inline const char*
static const char*
format_mods(int mods) {
static char buf[128];
char *p = buf, *s;
@@ -525,7 +535,7 @@ format_mods(int mods) {
return buf;
}
static inline const char*
static const char*
format_text(const char *src) {
static char buf[256];
char *p = buf;
@@ -561,6 +571,11 @@ translateKey(uint16_t vk_key, bool apply_keymap)
return ans;
}
static NSRect
get_window_size_without_border_in_logical_pixels(_GLFWwindow *window) {
return [window->ns.object contentRectForFrameRect:[window->ns.object frame]];
}
// Translate a GLFW keycode to a Cocoa modifier flag
//
static NSUInteger
@@ -766,7 +781,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
_glfwInputWindowMaximize(window, maximized);
}
const NSRect contentRect = [window->ns.view frame];
const NSRect contentRect = get_window_size_without_border_in_logical_pixels(window);
const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect];
if (fbRect.size.width != window->ns.fbWidth ||
@@ -849,6 +864,12 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
showCursor(window);
_glfwInputWindowFocus(window, false);
// IME is cancelled when losing the focus
if ([window->ns.view hasMarkedText]) {
[window->ns.view unmarkText];
GLFWkeyevent dummy = {.action = GLFW_RELEASE, .ime_state = GLFW_IME_PREEDIT_CHANGED};
_glfwInputKeyboard(window, &dummy);
}
}
- (void)windowDidChangeScreen:(NSNotification *)notification
@@ -872,6 +893,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
NSTrackingArea* trackingArea;
NSMutableAttributedString* markedText;
NSRect markedRect;
bool marked_text_cleared_by_insert;
NSString *input_source_at_last_key_event;
}
@@ -1088,7 +1110,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
- (void)viewDidChangeBackingProperties
{
if (!window) return;
const NSRect contentRect = [window->ns.view frame];
const NSRect contentRect = get_window_size_without_border_in_logical_pixels(window);
const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect];
if (fbRect.size.width != window->ns.fbWidth ||
@@ -1144,7 +1166,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
[super updateTrackingAreas];
}
static inline UInt32
static UInt32
convert_cocoa_to_carbon_modifiers(NSUInteger flags) {
UInt32 mods = 0;
if (flags & NSEventModifierFlagShift)
@@ -1161,7 +1183,7 @@ convert_cocoa_to_carbon_modifiers(NSUInteger flags) {
return (mods >> 8) & 0xFF;
}
static inline void
static void
convert_utf16_to_utf8(UniChar *src, UniCharCount src_length, char *dest, size_t dest_sz) {
CFStringRef string = CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault,
src,
@@ -1174,12 +1196,12 @@ convert_utf16_to_utf8(UniChar *src, UniCharCount src_length, char *dest, size_t
CFRelease(string);
}
static inline bool
static bool
alternate_key_is_ok(uint32_t key, uint32_t akey) {
return akey > 31 && akey != key && !is_pua_char(akey);
}
static inline void
static void
add_alternate_keys(GLFWkeyevent *ev, NSEvent *event) {
ev->alternate_key = translateKey(ev->native_key, false);
if (!alternate_key_is_ok(ev->key, ev->alternate_key)) ev->alternate_key = 0;
@@ -1198,19 +1220,27 @@ add_alternate_keys(GLFWkeyevent *ev, NSEvent *event) {
}
}
static inline bool
static bool
is_ascii_control_char(char x) {
return x == 0 || (1 <= x && x <= 31) || x == 127;
}
- (void)keyDown:(NSEvent *)event
{
#define CLEAR_PRE_EDIT_TEXT glfw_keyevent.text = NULL; glfw_keyevent.ime_state = GLFW_IME_PREEDIT_CHANGED; _glfwInputKeyboard(window, &glfw_keyevent);
#define UPDATE_PRE_EDIT_TEXT glfw_keyevent.text = [[markedText string] UTF8String]; glfw_keyevent.ime_state = GLFW_IME_PREEDIT_CHANGED; _glfwInputKeyboard(window, &glfw_keyevent);
const bool previous_has_marked_text = [self hasMarkedText];
bool input_source_changed = false;
NSTextInputContext *inpctx = [NSTextInputContext currentInputContext];
if (inpctx && (!input_source_at_last_key_event || ![input_source_at_last_key_event isEqualToString:inpctx.selectedKeyboardInputSource])) {
if (input_source_at_last_key_event) {
debug_key("Input source changed, clearing pre-edit text and resetting deadkey state\n");
GLFWkeyevent dummy = {.action = GLFW_RELEASE, .ime_state = GLFW_IME_PREEDIT_CHANGED};
window->ns.deadKeyState = 0;
_glfwInputKeyboard(window, &dummy); // clear pre-edit text
}
input_source_at_last_key_event = [inpctx.selectedKeyboardInputSource retain];
input_source_changed = true;
[self unmarkText];
}
const unsigned int keycode = [event keyCode];
@@ -1218,9 +1248,9 @@ is_ascii_control_char(char x) {
const int mods = translateFlags(flags);
const uint32_t key = translateKey(keycode, true);
const bool process_text = !window->ns.textInputFilterCallback || window->ns.textInputFilterCallback(key, mods, keycode, flags) != 1;
[self unmarkText];
_glfw.ns.text[0] = 0;
GLFWkeyevent glfw_keyevent = {.key = key, .native_key = keycode, .action = GLFW_PRESS, .mods = mods};
if (keycode == 0x33 /* backspace */ || keycode == 0x35 /* escape */) [self unmarkText];
GLFWkeyevent glfw_keyevent = {.key = key, .native_key = keycode, .native_key_id = keycode, .action = GLFW_PRESS, .mods = mods};
if (!_glfw.ns.unicodeData) {
// Using the cocoa API for key handling is disabled, as there is no
// reliable way to handle dead keys using it. Only use it if the
@@ -1230,14 +1260,6 @@ is_ascii_control_char(char x) {
[self interpretKeyEvents:[NSArray arrayWithObject:event]];
}
} else {
if (input_source_changed) {
debug_key("Input source changed, clearing pre-edit text and resetting deadkey state\n");
glfw_keyevent.text = NULL;
glfw_keyevent.ime_state = GLFW_IME_PREEDIT_CHANGED;
window->ns.deadKeyState = 0;
_glfwInputKeyboard(window, &glfw_keyevent); // clear pre-edit text
}
static UniChar text[256];
UniCharCount char_count = 0;
const bool in_compose_sequence = window->ns.deadKeyState != 0;
@@ -1260,6 +1282,7 @@ is_ascii_control_char(char x) {
}
debug_key("\x1b[31mPress:\x1b[m native_key: 0x%x (%s) glfw_key: 0x%x %schar_count: %lu deadKeyState: %u repeat: %d ",
keycode, safe_name_for_keycode(keycode), key, format_mods(mods), char_count, window->ns.deadKeyState, event.ARepeat);
marked_text_cleared_by_insert = false;
if (process_text) {
// this will call insertText which will fill up _glfw.ns.text
[self interpretKeyEvents:[NSArray arrayWithObject:event]];
@@ -1268,41 +1291,46 @@ is_ascii_control_char(char x) {
}
if (window->ns.deadKeyState && (char_count == 0 || keycode == 0x75)) {
// 0x75 is the delete key which needs to be ignored during a compose sequence
glfw_keyevent.text = [[markedText string] UTF8String];
debug_key("Sending pre-edit text for dead key (text: %s markedText: %s).\n", format_text(_glfw.ns.text), glfw_keyevent.text);
glfw_keyevent.ime_state = GLFW_IME_PREEDIT_CHANGED;
_glfwInputKeyboard(window, &glfw_keyevent); // update pre-edit text
UPDATE_PRE_EDIT_TEXT;
return;
}
if (in_compose_sequence) {
debug_key("Clearing pre-edit text at end of compose sequence\n");
glfw_keyevent.text = NULL;
glfw_keyevent.ime_state = GLFW_IME_PREEDIT_CHANGED;
_glfwInputKeyboard(window, &glfw_keyevent); // clear pre-edit text
CLEAR_PRE_EDIT_TEXT;
}
}
if (is_ascii_control_char(_glfw.ns.text[0])) _glfw.ns.text[0] = 0; // don't send text for ascii control codes
debug_key("text: %s glfw_key: %s marked_text: %s\n",
debug_key("text: %s glfw_key: %s marked_text: (%s)\n",
format_text(_glfw.ns.text), _glfwGetKeyName(key), [[markedText string] UTF8String]);
bool bracketed_ime = false;
if (!window->ns.deadKeyState) {
if ([self hasMarkedText]) {
glfw_keyevent.text = [[markedText string] UTF8String];
glfw_keyevent.ime_state = GLFW_IME_PREEDIT_CHANGED;
_glfwInputKeyboard(window, &glfw_keyevent); // update pre-edit text
if (!marked_text_cleared_by_insert) {
UPDATE_PRE_EDIT_TEXT;
} else bracketed_ime = true;
} else if (previous_has_marked_text) {
glfw_keyevent.text = NULL;
glfw_keyevent.ime_state = GLFW_IME_PREEDIT_CHANGED;
_glfwInputKeyboard(window, &glfw_keyevent); // clear pre-edit text
CLEAR_PRE_EDIT_TEXT;
}
if (([self hasMarkedText] || previous_has_marked_text) && !_glfw.ns.text[0]) {
// do not pass keys like BACKSPACE while there's pre-edit text, let IME handle it
return;
}
}
if (bracketed_ime) {
// insertText followed by setMarkedText
CLEAR_PRE_EDIT_TEXT;
}
glfw_keyevent.text = _glfw.ns.text;
glfw_keyevent.ime_state = GLFW_IME_NONE;
add_alternate_keys(&glfw_keyevent, event);
_glfwInputKeyboard(window, &glfw_keyevent);
if (bracketed_ime) {
// insertText followed by setMarkedText
UPDATE_PRE_EDIT_TEXT;
}
#undef CLEAR_PRE_EDIT_TEXT
#undef UPDATE_PRE_EDIT_TEXT
}
- (void)flagsChanged:(NSEvent *)event
@@ -1329,7 +1357,7 @@ is_ascii_control_char(char x) {
action = GLFW_PRESS;
}
GLFWkeyevent glfw_keyevent = {.key = key, .native_key = [event keyCode], .action = action, .mods = mods};
GLFWkeyevent glfw_keyevent = {.key = key, .native_key = [event keyCode], .native_key_id = [event keyCode], .action = action, .mods = mods};
_glfwInputKeyboard(window, &glfw_keyevent);
}
@@ -1339,7 +1367,7 @@ is_ascii_control_char(char x) {
const uint32_t key = translateKey(keycode, true);
const int mods = translateFlags([event modifierFlags]);
GLFWkeyevent glfw_keyevent = {.key = key, .native_key = keycode, .action = GLFW_RELEASE, .mods = mods};
GLFWkeyevent glfw_keyevent = {.key = key, .native_key = keycode, .native_key_id = keycode, .action = GLFW_RELEASE, .mods = mods};
add_alternate_keys(&glfw_keyevent, event);
debug_key("\x1b[32mRelease:\x1b[m native_key: 0x%x (%s) glfw_key: 0x%x %s\n",
keycode, safe_name_for_keycode(keycode), key, format_mods(mods));
@@ -1444,12 +1472,17 @@ is_ascii_control_char(char x) {
selectedRange:(NSRange)selectedRange
replacementRange:(NSRange)replacementRange
{
(void)selectedRange; (void)replacementRange;
[markedText release];
if ([string isKindOfClass:[NSAttributedString class]])
debug_key("\n\tsetMarkedText: %s selectedRange: (%lu, %lu) replacementRange: (%lu, %lu)\n", polymorphic_string_as_utf8(string), selectedRange.location, selectedRange.length, replacementRange.location, replacementRange.length);
if (string == nil) { [self unmarkText]; return; }
if ([string isKindOfClass:[NSAttributedString class]]) {
if (((NSMutableAttributedString*)string).length == 0) { [self unmarkText]; return; }
[markedText release];
markedText = [[NSMutableAttributedString alloc] initWithAttributedString:string];
else
} else {
if (((NSString*)string).length == 0) { [self unmarkText]; return; }
[markedText release];
markedText = [[NSMutableAttributedString alloc] initWithString:string];
}
}
- (void)unmarkText
@@ -1467,17 +1500,18 @@ void _glfwPlatformUpdateIMEState(_GLFWwindow *w, const GLFWIMEUpdateEvent *ev) {
cellWidth:(CGFloat)cellWidth
cellHeight:(CGFloat)cellHeight
{
(void) which;
if (which != GLFW_IME_UPDATE_CURSOR_POSITION) return;
left /= window->ns.xscale;
top /= window->ns.yscale;
cellWidth /= window->ns.xscale;
cellHeight /= window->ns.yscale;
debug_key("updateIMEState: %f, %f, %f, %f\n", left, top, cellWidth, cellHeight);
debug_key("updateIMEPosition: left=%f, top=%f, width=%f, height=%f\n", left, top, cellWidth, cellHeight);
const NSRect frame = [window->ns.view frame];
const NSRect rectInView = NSMakeRect(left,
frame.size.height - top - cellHeight,
cellWidth, cellHeight);
markedRect = [window->ns.object convertRectToScreen: rectInView];
if (_glfwPlatformWindowFocused(window)) [[window->ns.view inputContext] invalidateCharacterCoordinates];
}
- (NSArray*)validAttributesForMarkedText
@@ -1507,21 +1541,21 @@ void _glfwPlatformUpdateIMEState(_GLFWwindow *w, const GLFWIMEUpdateEvent *ev) {
- (void)insertText:(id)string replacementRange:(NSRange)replacementRange
{
(void)replacementRange;
NSString* characters;
if ([string isKindOfClass:[NSAttributedString class]])
characters = [string string];
else
characters = (NSString*) string;
const char *utf8 = polymorphic_string_as_utf8(string);
debug_key("\n\tinsertText: %s replacementRange: (%lu, %lu)\n", utf8, replacementRange.location, replacementRange.length);
if ([self hasMarkedText]) {
[self unmarkText];
marked_text_cleared_by_insert = true;
}
// insertText can be called multiple times for a single key event
char *s = _glfw.ns.text + strnlen(_glfw.ns.text, sizeof(_glfw.ns.text));
snprintf(s, sizeof(_glfw.ns.text) - (s - _glfw.ns.text), "%s", [characters UTF8String]);
snprintf(s, sizeof(_glfw.ns.text) - (s - _glfw.ns.text), "%s", utf8);
_glfw.ns.text[sizeof(_glfw.ns.text) - 1] = 0;
}
- (void)doCommandBySelector:(SEL)selector
{
(void)selector;
debug_key("\n\tdoCommandBySelector: (%s)\n", [NSStringFromSelector(selector) UTF8String]);
}
@end
@@ -1605,7 +1639,14 @@ void _glfwPlatformUpdateIMEState(_GLFWwindow *w, const GLFWIMEUpdateEvent *ev) {
{
if (glfw_window && glfw_window->ns.toggleFullscreenCallback && glfw_window->ns.toggleFullscreenCallback((GLFWwindow*)glfw_window) == 1)
return;
// When resizeIncrements is set, Cocoa cannot restore the original window size after returning from fullscreen.
const NSSize original = [self resizeIncrements];
[self setResizeIncrements:NSMakeSize(1.0, 1.0)];
[super toggleFullScreen:sender];
[self setResizeIncrements:original];
// When the window decoration is hidden, toggling fullscreen causes the style mask to be changed,
// and causes the first responder to be cleared.
if (glfw_window && !glfw_window->decorated && glfw_window->ns.view) [self makeFirstResponder:glfw_window->ns.view];
}
@end
@@ -1809,8 +1850,7 @@ void _glfwPlatformSetWindowIcon(_GLFWwindow* window UNUSED,
void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
{
const NSRect contentRect =
[window->ns.object contentRectForFrameRect:[window->ns.object frame]];
const NSRect contentRect = get_window_size_without_border_in_logical_pixels(window);
if (xpos)
*xpos = (int)contentRect.origin.x;
@@ -1820,7 +1860,7 @@ void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int x, int y)
{
const NSRect contentRect = [window->ns.view frame];
const NSRect contentRect = get_window_size_without_border_in_logical_pixels(window);
const NSRect dummyRect = NSMakeRect(x, _glfwTransformYNS(y + contentRect.size.height - 1), 0, 0);
const NSRect frameRect = [window->ns.object frameRectForContentRect:dummyRect];
[window->ns.object setFrameOrigin:frameRect.origin];
@@ -1828,7 +1868,7 @@ void _glfwPlatformSetWindowPos(_GLFWwindow* window, int x, int y)
void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height)
{
const NSRect contentRect = [window->ns.view frame];
const NSRect contentRect = get_window_size_without_border_in_logical_pixels(window);
if (width)
*width = (int)contentRect.size.width;
@@ -1845,8 +1885,9 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
}
else
{
NSRect contentRect =
[window->ns.object contentRectForFrameRect:[window->ns.object frame]];
// Disable window resizing in fullscreen.
if ([window->ns.object styleMask] & NSWindowStyleMaskFullScreen || window->ns.in_traditional_fullscreen) return;
NSRect contentRect = get_window_size_without_border_in_logical_pixels(window);
contentRect.origin.y += contentRect.size.height - height;
contentRect.size = NSMakeSize(width, height);
[window->ns.object setFrame:[window->ns.object frameRectForContentRect:contentRect]
@@ -1879,15 +1920,18 @@ void _glfwPlatformSetWindowAspectRatio(_GLFWwindow* window, int numer, int denom
void _glfwPlatformSetWindowSizeIncrements(_GLFWwindow* window, int widthincr, int heightincr)
{
if (widthincr != GLFW_DONT_CARE && heightincr != GLFW_DONT_CARE)
[window->ns.object setResizeIncrements:NSMakeSize(widthincr, heightincr)];
else
if (widthincr != GLFW_DONT_CARE && heightincr != GLFW_DONT_CARE) {
float xscale = 1, yscale = 1;
_glfwPlatformGetWindowContentScale(window, &xscale, &yscale);
[window->ns.object setResizeIncrements:NSMakeSize(widthincr / xscale, heightincr / yscale)];
} else {
[window->ns.object setResizeIncrements:NSMakeSize(1.0, 1.0)];
}
}
void _glfwPlatformGetFramebufferSize(_GLFWwindow* window, int* width, int* height)
{
const NSRect contentRect = [window->ns.view frame];
const NSRect contentRect = get_window_size_without_border_in_logical_pixels(window);
const NSRect fbRect = [window->ns.view convertRectToBacking:contentRect];
if (width)
@@ -1900,7 +1944,7 @@ void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
int* left, int* top,
int* right, int* bottom)
{
const NSRect contentRect = [window->ns.view frame];
const NSRect contentRect = get_window_size_without_border_in_logical_pixels(window);
const NSRect frameRect = [window->ns.object frameRectForContentRect:contentRect];
if (left)
@@ -1918,7 +1962,7 @@ void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
float* xscale, float* yscale)
{
const NSRect points = [window->ns.view frame];
const NSRect points = get_window_size_without_border_in_logical_pixels(window);
const NSRect pixels = [window->ns.view convertRectToBacking:points];
if (xscale)
@@ -2402,13 +2446,21 @@ void _glfwPlatformSetCursor(_GLFWwindow* window, _GLFWcursor* cursor UNUSED)
updateCursorImage(window);
}
bool _glfwPlatformIsFullscreen(_GLFWwindow* w, unsigned int flags) {
NSWindow *window = w->ns.object;
bool traditional = !(flags & 1);
if (traditional) { if(@available(macOS 11.0, *)) return w->ns.in_traditional_fullscreen; }
NSWindowStyleMask sm = [window styleMask];
return sm & NSWindowStyleMaskFullScreen;
}
bool _glfwPlatformToggleFullscreen(_GLFWwindow* w, unsigned int flags) {
NSWindow *window = w->ns.object;
bool made_fullscreen = true;
bool traditional = !(flags & 1);
NSWindowStyleMask sm = [window styleMask];
if (traditional) {
if (@available(macOS 10.16, *)) {
if (@available(macOS 11.0, *)) {
// As of Big Turd NSWindowStyleMaskFullScreen is no longer useable
if (!w->ns.in_traditional_fullscreen) {
w->ns.pre_full_screen_style_mask = sm;
@@ -2422,9 +2474,6 @@ bool _glfwPlatformToggleFullscreen(_GLFWwindow* w, unsigned int flags) {
[[NSApplication sharedApplication] setPresentationOptions: NSApplicationPresentationDefault];
w->ns.in_traditional_fullscreen = false;
}
// for some reason despite calling this selector, the window doesnt actually get keyboard focus till you click on it.
// presumably a bug with NSWindowStyleMaskBorderless windows
[window performSelector:@selector(makeKeyAndOrderFront:) withObject:nil afterDelay:0];
} else {
bool in_fullscreen = sm & NSWindowStyleMaskFullScreen;
if (!(in_fullscreen)) {
@@ -2437,6 +2486,12 @@ bool _glfwPlatformToggleFullscreen(_GLFWwindow* w, unsigned int flags) {
}
[window setStyleMask: sm];
}
// Changing the style mask causes the first responder to be cleared
[window makeFirstResponder:w->ns.view];
// If the dock and menubar are hidden going from maximized to fullscreen doesnt change the window size
// and macOS forgets to trigger windowDidResize, so call it ourselves
NSNotification *notification = [NSNotification notificationWithName:NSWindowDidResizeNotification object:window];
[w->ns.delegate performSelector:@selector(windowDidResize:) withObject:notification afterDelay:0];
} else {
bool in_fullscreen = sm & NSWindowStyleMaskFullScreen;
if (in_fullscreen) made_fullscreen = false;

4
glfw/dbus_glfw.c vendored
View File

@@ -31,7 +31,7 @@
#include <stdlib.h>
#include <string.h>
static inline void
static void
report_error(DBusError *err, const char *fmt, ...) {
static char buf[1024];
va_list args;
@@ -64,7 +64,7 @@ on_dbus_watch_ready(int fd UNUSED, int events, void *data) {
dbus_watch_handle(watch, flags);
}
static inline int
static int
events_for_watch(DBusWatch *watch) {
int events = 0;
unsigned int flags = dbus_watch_get_flags(watch);

View File

@@ -6,7 +6,7 @@ import json
import os
import re
import sys
from typing import Callable, Dict, List, Optional, Tuple
from typing import Callable, Dict, List, NamedTuple, Optional, Sequence, Tuple
_plat = sys.platform.lower()
is_linux = 'linux' in _plat
@@ -14,9 +14,23 @@ is_openbsd = 'openbsd' in _plat
base = os.path.dirname(os.path.abspath(__file__))
class CompileKey(NamedTuple):
src: str
dest: str
class Command(NamedTuple):
desc: str
cmd: Sequence[str]
is_newer_func: Callable[[], bool]
on_success: Callable[[], None] = lambda: None
key: Optional[CompileKey] = None
keyfile: Optional[str] = None
class Env:
cc: str = ''
cc: List[str] = []
cppflags: List[str] = []
cflags: List[str] = []
ldflags: List[str] = []
@@ -33,11 +47,12 @@ class Env:
wayland_protocols: Tuple[str, ...] = ()
def __init__(
self, cc: str = '', cppflags: List[str] = [], cflags: List[str] = [], ldflags: List[str] = [],
self, cc: List[str] = [], cppflags: List[str] = [], cflags: List[str] = [], ldflags: List[str] = [],
library_paths: Dict[str, List[str]] = {}, ldpaths: Optional[List[str]] = None, ccver: Tuple[int, int] = (0, 0)
):
self.cc, self.cppflags, self.cflags, self.ldflags, self.library_paths = cc, cppflags, cflags, ldflags, library_paths
self.ldpaths, self.ccver = [] if ldpaths is None else ldpaths, ccver
self.ldpaths = ldpaths or []
self.ccver = ccver
def copy(self) -> 'Env':
ans = Env(self.cc, list(self.cppflags), list(self.cflags), list(self.ldflags), dict(self.library_paths), list(self.ldpaths), self.ccver)
@@ -55,7 +70,14 @@ def wayland_protocol_file_name(base: str, ext: str = 'c') -> str:
return 'wayland-{}-client-protocol.{}'.format(base, ext)
def init_env(env: Env, pkg_config: Callable, pkg_version: Callable, at_least_version: Callable, test_compile: Callable, module: str = 'x11') -> Env:
def init_env(
env: Env,
pkg_config: Callable[..., List[str]],
pkg_version: Callable[[str], Tuple[int, int]],
at_least_version: Callable[..., None],
test_compile: Callable[..., bool],
module: str = 'x11'
) -> Env:
ans = env.copy()
ans.cflags.append('-fPIC')
ans.cppflags.append('-D_GLFW_' + module.upper())
@@ -117,7 +139,13 @@ def init_env(env: Env, pkg_config: Callable, pkg_version: Callable, at_least_ver
return ans
def build_wayland_protocols(env: Env, Command: Callable, parallel_run: Callable, emphasis: Callable, newer: Callable, dest_dir: str) -> None:
def build_wayland_protocols(
env: Env,
parallel_run: Callable[[List[Command]], None],
emphasis: Callable[[str], str],
newer: Callable[..., bool],
dest_dir: str
) -> None:
items = []
for protocol in env.wayland_protocols:
src = os.path.join(env.wayland_packagedir, protocol)
@@ -130,8 +158,7 @@ def build_wayland_protocols(env: Env, Command: Callable, parallel_run: Callable,
q = 'client-header' if ext == 'h' else env.wayland_scanner_code
items.append(Command(
'Generating {} ...'.format(emphasis(os.path.basename(dest))),
[env.wayland_scanner, q, src, dest],
lambda: True, None, None, None))
[env.wayland_scanner, q, src, dest], lambda: True))
if items:
parallel_run(items)

5
glfw/glfw3.h vendored
View File

@@ -1245,6 +1245,10 @@ typedef struct GLFWkeyevent
// A value of GLFW_IME_PREEDIT_CHANGED means the pre-edit text for the input event has been changed.
// A value of GLFW_IME_COMMIT_TEXT means the text should be committed.
GLFWIMEState ime_state;
// For internal use only. On Linux it is the actual keycode reported by the windowing system, in contrast
// to native_key which can be the result of a compose operation. On macOS it is the same as native_key.
uint32_t native_key_id;
} GLFWkeyevent;
/*! @brief The function pointer type for error callbacks.
@@ -2752,6 +2756,7 @@ GLFWAPI void glfwWindowHintString(int hint, const char* value);
*/
GLFWAPI GLFWwindow* glfwCreateWindow(int width, int height, const char* title, GLFWmonitor* monitor, GLFWwindow* share);
GLFWAPI bool glfwToggleFullscreen(GLFWwindow *window, unsigned int flags);
GLFWAPI bool glfwIsFullscreen(GLFWwindow *window, unsigned int flags);
/*! @brief Destroys the specified window and its context.
*

26
glfw/glx_context.c vendored
View File

@@ -48,7 +48,7 @@ static int getGLXFBConfigAttrib(GLXFBConfig fbconfig, int attrib)
}
static GLXFBConfig*
choose_fb_config(const _GLFWfbconfig* desired, bool trust_window_bit, int *nelements) {
choose_fb_config(const _GLFWfbconfig* desired, bool trust_window_bit, int *nelements, bool use_best_color_depth) {
int attrib_list[64];
int pos = 0;
#define ATTR(x, y) { attrib_list[pos++] = x; attrib_list[pos++] = y; }
@@ -59,10 +59,16 @@ choose_fb_config(const _GLFWfbconfig* desired, bool trust_window_bit, int *nelem
if (_glfw.glx.ARB_multisample && desired->samples > 0) ATTR(GLX_SAMPLES, desired->samples);
if (desired->depthBits != GLFW_DONT_CARE) ATTR(GLX_DEPTH_SIZE, desired->depthBits);
if (desired->stencilBits != GLFW_DONT_CARE) ATTR(GLX_STENCIL_SIZE, desired->stencilBits);
if (desired->redBits != GLFW_DONT_CARE) ATTR(GLX_RED_SIZE, desired->redBits);
if (desired->greenBits != GLFW_DONT_CARE) ATTR(GLX_GREEN_SIZE, desired->greenBits);
if (desired->blueBits != GLFW_DONT_CARE) ATTR(GLX_BLUE_SIZE, desired->blueBits);
if (desired->alphaBits != GLFW_DONT_CARE) ATTR(GLX_ALPHA_SIZE, desired->alphaBits);
if (use_best_color_depth) {
// we just ask for the highest available R+G+B+A color depth. This hopefully
// works with 10bit (r=10, g=10, b=19, a=2) visuals
ATTR(GLX_RED_SIZE, 1); ATTR(GLX_GREEN_SIZE, 1); ATTR(GLX_BLUE_SIZE, 1); ATTR(GLX_ALPHA_SIZE, 1);
} else {
if (desired->redBits != GLFW_DONT_CARE) ATTR(GLX_RED_SIZE, desired->redBits);
if (desired->greenBits != GLFW_DONT_CARE) ATTR(GLX_GREEN_SIZE, desired->greenBits);
if (desired->blueBits != GLFW_DONT_CARE) ATTR(GLX_BLUE_SIZE, desired->blueBits);
if (desired->alphaBits != GLFW_DONT_CARE) ATTR(GLX_ALPHA_SIZE, desired->alphaBits);
}
if (desired->accumRedBits != GLFW_DONT_CARE) ATTR(GLX_ACCUM_RED_SIZE, desired->accumRedBits);
if (desired->accumGreenBits != GLFW_DONT_CARE) ATTR(GLX_ACCUM_GREEN_SIZE, desired->accumGreenBits);
if (desired->accumBlueBits != GLFW_DONT_CARE) ATTR(GLX_ACCUM_BLUE_SIZE, desired->accumBlueBits);
@@ -96,11 +102,15 @@ static bool chooseGLXFBConfig(const _GLFWfbconfig* desired,
vendor = glXGetClientString(_glfw.x11.display, GLX_VENDOR);
if (vendor && strcmp(vendor, "Chromium") == 0)
trustWindowBit = false;
nativeConfigs = choose_fb_config(desired, trustWindowBit, &nativeCount);
nativeConfigs = choose_fb_config(desired, trustWindowBit, &nativeCount, false);
if (!nativeConfigs || !nativeCount)
{
_glfwInputError(GLFW_API_UNAVAILABLE, "GLX: No GLXFBConfigs returned");
return false;
nativeConfigs = choose_fb_config(desired, trustWindowBit, &nativeCount, true);
if (!nativeConfigs || !nativeCount) {
_glfwInputError(GLFW_API_UNAVAILABLE, "GLX: No GLXFBConfigs returned");
return false;
}
}
for (i = 0; i < nativeCount; i++)
{

196
glfw/ibus_glfw.c vendored
View File

@@ -49,14 +49,78 @@ enum Capabilities {
IBUS_CAP_SURROUNDING_TEXT = 1 << 5
};
typedef enum
{
IBUS_SHIFT_MASK = 1 << 0,
IBUS_LOCK_MASK = 1 << 1,
IBUS_CONTROL_MASK = 1 << 2,
IBUS_MOD1_MASK = 1 << 3,
IBUS_MOD2_MASK = 1 << 4,
IBUS_MOD3_MASK = 1 << 5,
IBUS_MOD4_MASK = 1 << 6,
IBUS_MOD5_MASK = 1 << 7,
IBUS_BUTTON1_MASK = 1 << 8,
IBUS_BUTTON2_MASK = 1 << 9,
IBUS_BUTTON3_MASK = 1 << 10,
IBUS_BUTTON4_MASK = 1 << 11,
IBUS_BUTTON5_MASK = 1 << 12,
static inline bool
/* The next few modifiers are used by XKB, so we skip to the end.
* Bits 15 - 23 are currently unused. Bit 29 is used internally.
*/
/* ibus mask */
IBUS_HANDLED_MASK = 1 << 24,
IBUS_FORWARD_MASK = 1 << 25,
IBUS_IGNORED_MASK = IBUS_FORWARD_MASK,
IBUS_SUPER_MASK = 1 << 26,
IBUS_HYPER_MASK = 1 << 27,
IBUS_META_MASK = 1 << 28,
IBUS_RELEASE_MASK = 1 << 30,
IBUS_MODIFIER_MASK = 0x5f001fff
} IBusModifierType;
static uint32_t
ibus_key_state_from_glfw(unsigned int glfw_modifiers, int action) {
uint32_t ans = action == GLFW_RELEASE ? IBUS_RELEASE_MASK : 0;
#define M(g, i) if(glfw_modifiers & GLFW_MOD_##g) ans |= i
M(SHIFT, IBUS_SHIFT_MASK);
M(CAPS_LOCK, IBUS_LOCK_MASK);
M(CONTROL, IBUS_CONTROL_MASK);
M(ALT, IBUS_MOD1_MASK);
M(NUM_LOCK, IBUS_MOD2_MASK);
M(SUPER, IBUS_MOD4_MASK);
/* To do: figure out how to get super/hyper/meta */
#undef M
return ans;
}
static unsigned int
glfw_modifiers_from_ibus_state(uint32_t ibus_key_state) {
unsigned int ans = 0;
#define M(g, i) if(ibus_key_state & i) ans |= GLFW_MOD_##g
M(SHIFT, IBUS_SHIFT_MASK);
M(CAPS_LOCK, IBUS_LOCK_MASK);
M(CONTROL, IBUS_CONTROL_MASK);
M(ALT, IBUS_MOD1_MASK);
M(NUM_LOCK, IBUS_MOD2_MASK);
M(SUPER, IBUS_MOD4_MASK);
/* To do: figure out how to get super/hyper/meta */
#undef M
return ans;
}
static bool
test_env_var(const char *name, const char *val) {
const char *q = getenv(name);
return (q && strcmp(q, val) == 0) ? true : false;
}
static inline size_t
static size_t
GLFW_MIN(size_t a, size_t b) {
return a < b ? a : b;
}
@@ -106,7 +170,30 @@ get_ibus_text_from_message(DBusMessage *msg) {
return text;
}
static inline void
static void
handle_ibus_forward_key_event(DBusMessage *msg) {
uint32_t keysym, keycode, state;
DBusMessageIter iter;
dbus_message_iter_init(msg, &iter);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT32) return;
dbus_message_iter_get_basic(&iter, &keysym);
dbus_message_iter_next(&iter);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT32) return;
dbus_message_iter_get_basic(&iter, &keycode);
dbus_message_iter_next(&iter);
if (dbus_message_iter_get_arg_type(&iter) != DBUS_TYPE_UINT32) return;
dbus_message_iter_get_basic(&iter, &state);
int mods = glfw_modifiers_from_ibus_state(state);
debug("IBUS: ForwardKeyEvent: keysym=%x, keycode=%x, state=%x, glfw_mods=%x\n", keysym, keycode, state, mods);
glfw_xkb_forwarded_key_from_ime(keysym, mods);
}
static void
send_text(const char *text, GLFWIMEState ime_state) {
_GLFWwindow *w = _glfwFocusedWindow();
if (w && w->callbacks.keyboard) {
@@ -126,7 +213,7 @@ message_handler(DBusConnection *conn UNUSED, DBusMessage *msg, void *user_data)
_GLFWIBUSData *ibus = (_GLFWIBUSData*)user_data;
(void)ibus;
const char *text;
switch(glfw_dbus_match_signal(msg, IBUS_INPUT_INTERFACE, "CommitText", "UpdatePreeditText", "HidePreeditText", "ShowPreeditText", NULL)) {
switch(glfw_dbus_match_signal(msg, IBUS_INPUT_INTERFACE, "CommitText", "UpdatePreeditText", "HidePreeditText", "ShowPreeditText", "ForwardKeyEvent", NULL)) {
case 0:
text = get_ibus_text_from_message(msg);
debug("IBUS: CommitText: '%s'\n", text ? text : "(nil)");
@@ -134,8 +221,8 @@ message_handler(DBusConnection *conn UNUSED, DBusMessage *msg, void *user_data)
break;
case 1:
text = get_ibus_text_from_message(msg);
send_text(text, GLFW_IME_PREEDIT_CHANGED);
debug("IBUS: UpdatePreeditText: '%s'\n", text ? text : "(nil)");
send_text(text, GLFW_IME_PREEDIT_CHANGED);
break;
case 2:
debug("IBUS: HidePreeditText\n");
@@ -143,11 +230,44 @@ message_handler(DBusConnection *conn UNUSED, DBusMessage *msg, void *user_data)
case 3:
debug("IBUS: ShowPreeditText\n");
break;
case 4:
handle_ibus_forward_key_event(msg);
break;
}
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
static inline const char*
static DBusHandlerResult
ibus_on_owner_change(DBusConnection* conn UNUSED, DBusMessage* msg, void* user_data) {
if (dbus_message_is_signal(msg, "org.freedesktop.DBus", "NameOwnerChanged")) {
const char* name;
const char* old_owner;
const char* new_owner;
if (!dbus_message_get_args(msg, NULL,
DBUS_TYPE_STRING, &name,
DBUS_TYPE_STRING, &old_owner,
DBUS_TYPE_STRING, &new_owner,
DBUS_TYPE_INVALID
)) {
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
if (strcmp(name, "org.freedesktop.IBus") != 0) {
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
_GLFWIBUSData* ibus = (_GLFWIBUSData*) user_data;
ibus->name_owner_changed = true;
return DBUS_HANDLER_RESULT_HANDLED;
}
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
static const char*
get_ibus_address_file_name(void) {
const char *addr;
static char ans[PATH_MAX];
@@ -196,7 +316,7 @@ get_ibus_address_file_name(void) {
}
static inline bool
static bool
read_ibus_address(_GLFWIBUSData *ibus) {
static char buf[1024];
struct stat s;
@@ -243,6 +363,8 @@ input_context_created(DBusMessage *msg, const char* errmsg, void *data) {
free((void*)ibus->input_ctx_path);
ibus->input_ctx_path = _glfw_strdup(path);
if (!ibus->input_ctx_path) return;
dbus_bus_add_match(ibus->conn, "type='signal',interface='org.freedesktop.DBus', member='NameOwnerChanged'", NULL);
dbus_connection_add_filter(ibus->conn, ibus_on_owner_change, ibus, free);
dbus_bus_add_match(ibus->conn, "type='signal',interface='org.freedesktop.IBus.InputContext'", NULL);
DBusObjectPathVTable ibus_vtable = {.message_function = message_handler};
dbus_connection_try_register_object_path(ibus->conn, ibus->input_ctx_path, &ibus_vtable, ibus, NULL);
@@ -285,6 +407,7 @@ glfw_connect_to_ibus(_GLFWIBUSData *ibus) {
if (ibus->inited) return;
if (!test_env_var("GLFW_IM_MODULE", "ibus")) return;
ibus->inited = true;
ibus->name_owner_changed = false;
setup_connection(ibus);
}
@@ -306,13 +429,12 @@ glfw_ibus_terminate(_GLFWIBUSData *ibus) {
static bool
check_connection(_GLFWIBUSData *ibus) {
if (!ibus->inited) return false;
if (ibus->conn && dbus_connection_get_is_connected(ibus->conn)) {
return ibus->ok;
}
if (ibus->conn && dbus_connection_get_is_connected(ibus->conn) && !ibus->name_owner_changed) return ibus->ok;
struct stat s;
ibus->name_owner_changed = false;
if (stat(ibus->address_file_name, &s) != 0 || s.st_mtime != ibus->address_file_mtime) {
if (!read_ibus_address(ibus)) return false;
setup_connection(ibus);
return setup_connection(ibus);
}
return false;
}
@@ -344,56 +466,6 @@ glfw_ibus_set_cursor_geometry(_GLFWIBUSData *ibus, int x, int y, int w, int h) {
}
}
typedef enum
{
IBUS_SHIFT_MASK = 1 << 0,
IBUS_LOCK_MASK = 1 << 1,
IBUS_CONTROL_MASK = 1 << 2,
IBUS_MOD1_MASK = 1 << 3,
IBUS_MOD2_MASK = 1 << 4,
IBUS_MOD3_MASK = 1 << 5,
IBUS_MOD4_MASK = 1 << 6,
IBUS_MOD5_MASK = 1 << 7,
IBUS_BUTTON1_MASK = 1 << 8,
IBUS_BUTTON2_MASK = 1 << 9,
IBUS_BUTTON3_MASK = 1 << 10,
IBUS_BUTTON4_MASK = 1 << 11,
IBUS_BUTTON5_MASK = 1 << 12,
/* The next few modifiers are used by XKB, so we skip to the end.
* Bits 15 - 23 are currently unused. Bit 29 is used internally.
*/
/* ibus mask */
IBUS_HANDLED_MASK = 1 << 24,
IBUS_FORWARD_MASK = 1 << 25,
IBUS_IGNORED_MASK = IBUS_FORWARD_MASK,
IBUS_SUPER_MASK = 1 << 26,
IBUS_HYPER_MASK = 1 << 27,
IBUS_META_MASK = 1 << 28,
IBUS_RELEASE_MASK = 1 << 30,
IBUS_MODIFIER_MASK = 0x5f001fff
} IBusModifierType;
static inline uint32_t
ibus_key_state(unsigned int glfw_modifiers, int action) {
uint32_t ans = action == GLFW_RELEASE ? IBUS_RELEASE_MASK : 0;
#define M(g, i) if(glfw_modifiers & GLFW_MOD_##g) ans |= i
M(SHIFT, IBUS_SHIFT_MASK);
M(CAPS_LOCK, IBUS_LOCK_MASK);
M(CONTROL, IBUS_CONTROL_MASK);
M(ALT, IBUS_MOD1_MASK);
M(NUM_LOCK, IBUS_MOD2_MASK);
M(SUPER, IBUS_MOD4_MASK);
/* To do: figure out how to get super/hyper/meta */
#undef M
return ans;
}
void
key_event_processed(DBusMessage *msg, const char* errmsg, void *data) {
uint32_t handled = 0;
@@ -422,7 +494,7 @@ ibus_process_key(const _GLFWIBUSKeyEvent *ev_, _GLFWIBUSData *ibus) {
// Put the key's text in a field IN the structure, for proper serialization.
if (ev->glfw_ev.text) strncpy(ev->__embedded_text, ev->glfw_ev.text, sizeof(ev->__embedded_text) - 1);
ev->glfw_ev.text = NULL;
uint32_t state = ibus_key_state(ev->glfw_ev.mods, ev->glfw_ev.action);
uint32_t state = ibus_key_state_from_glfw(ev->glfw_ev.mods, ev->glfw_ev.action);
if (!glfw_dbus_call_method_with_reply(
ibus->conn, IBUS_SERVICE, ibus->input_ctx_path, IBUS_INPUT_INTERFACE, "ProcessKeyEvent",
3000, key_event_processed, ev,

2
glfw/ibus_glfw.h vendored
View File

@@ -32,7 +32,7 @@
#include <xkbcommon/xkbcommon.h>
typedef struct {
bool ok, inited;
bool ok, inited, name_owner_changed;
time_t address_file_mtime;
DBusConnection *conn;
const char *input_ctx_path, *address_file_name, *address;

40
glfw/input.c vendored
View File

@@ -274,11 +274,11 @@ static bool parseMapping(_GLFWmapping* mapping, const char* string)
//////////////////////////////////////////////////////////////////////////
static void
set_key_action(_GLFWwindow *window, uint32_t key, int val, int idx) {
set_key_action(_GLFWwindow *window, const GLFWkeyevent *ev, int action, int idx) {
const unsigned sz = arraysz(window->activated_keys);
if (idx < 0) {
for (unsigned i = 0; i < sz; i++) {
if (window->activated_keys[i].key == 0) {
if (window->activated_keys[i].native_key_id == 0) {
idx = i;
break;
}
@@ -286,18 +286,18 @@ set_key_action(_GLFWwindow *window, uint32_t key, int val, int idx) {
if (idx < 0) {
idx = sz - 1;
memmove(window->activated_keys, window->activated_keys + 1, sizeof(window->activated_keys[0]) * (sz - 1));
window->activated_keys[sz - 1].key = key;
window->activated_keys[sz - 1].native_key_id = 0;
}
}
if (val == GLFW_RELEASE) {
if (action == GLFW_RELEASE) {
memset(window->activated_keys + idx, 0, sizeof(window->activated_keys[0]));
if (idx < (int)sz - 1) {
memmove(window->activated_keys + idx, window->activated_keys + idx + 1, sizeof(window->activated_keys[0]) * (sz - 1 - idx));
memset(window->activated_keys + sz - 1, 0, sizeof(window->activated_keys[0]));
}
} else {
window->activated_keys[idx].key = key;
window->activated_keys[idx].action = val;
window->activated_keys[idx] = *ev;
window->activated_keys[idx].text = NULL;
}
}
@@ -305,30 +305,39 @@ set_key_action(_GLFWwindow *window, uint32_t key, int val, int idx) {
//
void _glfwInputKeyboard(_GLFWwindow* window, GLFWkeyevent* ev)
{
if (ev->key > 0)
if (ev->native_key_id > 0)
{
bool repeated = false;
int idx = -1;
int current_action = GLFW_RELEASE;
const unsigned sz = arraysz(window->activated_keys);
for (unsigned i = 0; i < sz; i++) {
if (window->activated_keys[i].key == ev->key) {
if (window->activated_keys[i].native_key_id == ev->native_key_id) {
idx = i;
current_action = window->activated_keys[i].action;
break;
}
}
if (ev->action == GLFW_RELEASE && current_action == GLFW_RELEASE)
return;
if (ev->action == GLFW_RELEASE) {
if (current_action == GLFW_RELEASE) return;
if (idx > -1) {
const GLFWkeyevent *press_event = window->activated_keys + idx;
if (press_event->action == GLFW_PRESS || press_event->action == GLFW_REPEAT) {
// Compose sequences under X11 give a different key value for press and release events
// but we want the same key value so override it.
ev->native_key = press_event->native_key;
ev->key = press_event->key;
ev->shifted_key = press_event->shifted_key;
ev->alternate_key = press_event->alternate_key;
}
}
}
if (ev->action == GLFW_PRESS && current_action == GLFW_PRESS)
repeated = true;
if (ev->action == GLFW_RELEASE && window->stickyKeys)
set_key_action(window, ev->key, _GLFW_STICK, idx);
else
set_key_action(window, ev->key, ev->action, idx);
set_key_action(window, ev, (ev->action == GLFW_RELEASE && window->stickyKeys) ? _GLFW_STICK : ev->action, idx);
if (repeated)
ev->action = GLFW_REPEAT;
@@ -823,7 +832,8 @@ GLFWAPI GLFWKeyAction glfwGetKey(GLFWwindow* handle, uint32_t key)
if (current_action == _GLFW_STICK)
{
// Sticky mode: release key now
set_key_action(window, key, GLFW_RELEASE, idx);
GLFWkeyevent ev = {0};
set_key_action(window, &ev, GLFW_RELEASE, idx);
current_action = GLFW_PRESS;
}

8
glfw/internal.h vendored
View File

@@ -402,11 +402,6 @@ struct _GLFWcontext
_GLFWcontextOSMesa osmesa;
};
typedef struct GLFWKeyState {
uint32_t key;
char action;
} GLFWKeyState;
// Window and context structure
//
struct _GLFWwindow
@@ -437,7 +432,7 @@ struct _GLFWwindow
bool lockKeyMods;
int cursorMode;
char mouseButtons[GLFW_MOUSE_BUTTON_LAST + 1];
GLFWKeyState activated_keys[16];
GLFWkeyevent activated_keys[16];
// Virtual cursor position when cursor is disabled
double virtualCursorPosX, virtualCursorPosY;
bool rawMouseMotion;
@@ -717,6 +712,7 @@ void _glfwPlatformSetWindowMonitor(_GLFWwindow* window, _GLFWmonitor* monitor,
int xpos, int ypos, int width, int height,
int refreshRate);
bool _glfwPlatformToggleFullscreen(_GLFWwindow *w, unsigned int flags);
bool _glfwPlatformIsFullscreen(_GLFWwindow *w, unsigned int flags);
int _glfwPlatformWindowFocused(_GLFWwindow* window);
int _glfwPlatformWindowOccluded(_GLFWwindow* window);
int _glfwPlatformWindowIconified(_GLFWwindow* window);

12
glfw/linux_notify.c vendored
View File

@@ -35,10 +35,10 @@ notification_created(DBusMessage *msg, const char* errmsg, void *data) {
if (data) free(data);
return;
}
uint32_t notification_id;
if (!glfw_dbus_get_args(msg, "Failed to get Notification uid", DBUS_TYPE_UINT32, &notification_id, DBUS_TYPE_INVALID)) return;
uint32_t id;
if (!glfw_dbus_get_args(msg, "Failed to get Notification uid", DBUS_TYPE_UINT32, &id, DBUS_TYPE_INVALID)) return;
NotificationCreatedData *ncd = (NotificationCreatedData*)data;
if (ncd->callback) ncd->callback(ncd->next_id, notification_id, ncd->data);
if (ncd->callback) ncd->callback(ncd->next_id, id, ncd->data);
if (data) free(data);
}
@@ -46,12 +46,12 @@ static DBusHandlerResult
message_handler(DBusConnection *conn UNUSED, DBusMessage *msg, void *user_data UNUSED) {
/* printf("session_bus message_handler invoked interface: %s member: %s\n", dbus_message_get_interface(msg), dbus_message_get_member(msg)); */
if (dbus_message_is_signal(msg, NOTIFICATIONS_IFACE, "ActionInvoked")) {
uint32_t notification_id;
uint32_t id;
const char *action;
if (glfw_dbus_get_args(msg, "Failed to get args from ActionInvoked notification signal",
DBUS_TYPE_UINT32, &notification_id, DBUS_TYPE_STRING, &action, DBUS_TYPE_INVALID)) {
DBUS_TYPE_UINT32, &id, DBUS_TYPE_STRING, &action, DBUS_TYPE_INVALID)) {
if (activated_handler) {
activated_handler(notification_id, action);
activated_handler(id, action);
return DBUS_HANDLER_RESULT_HANDLED;
}
}

4
glfw/window.c vendored
View File

@@ -1058,6 +1058,10 @@ GLFWAPI bool glfwToggleFullscreen(GLFWwindow* wh, unsigned int flags) {
return false;
}
GLFWAPI bool glfwIsFullscreen(GLFWwindow* wh, unsigned int flags) {
return _glfwPlatformIsFullscreen((_GLFWwindow*)wh, flags);
}
GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* handle, void* pointer)
{
_GLFWwindow* window = (_GLFWwindow*) handle;

2
glfw/wl_init.c vendored
View File

@@ -54,7 +54,7 @@
#endif
static inline int min(int n1, int n2)
static int min(int n1, int n2)
{
return n1 < n2 ? n1 : n2;
}

2
glfw/wl_platform.h vendored
View File

@@ -230,7 +230,7 @@ typedef struct _GLFWWaylandDataOffer
size_t idx;
bool is_self_offer;
bool is_primary;
const char *plain_text_mime, *mime_for_drop;
const char *mime_for_drop;
uint32_t source_actions;
uint32_t dnd_action;
struct wl_surface *surface;

24
glfw/wl_text_input.c vendored
View File

@@ -25,25 +25,25 @@ static void commit(void) {
}
static void
text_input_enter(void *data UNUSED, struct zwp_text_input_v3 *text_input UNUSED, struct wl_surface *surface UNUSED) {
text_input_enter(void *data UNUSED, struct zwp_text_input_v3 *txt_input, struct wl_surface *surface UNUSED) {
debug("text-input: enter event\n");
if (text_input) {
zwp_text_input_v3_enable(text_input);
zwp_text_input_v3_set_content_type(text_input, ZWP_TEXT_INPUT_V3_CONTENT_HINT_NONE, ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_TERMINAL);
if (txt_input) {
zwp_text_input_v3_enable(txt_input);
zwp_text_input_v3_set_content_type(txt_input, ZWP_TEXT_INPUT_V3_CONTENT_HINT_NONE, ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_TERMINAL);
commit();
}
}
static void
text_input_leave(void *data UNUSED, struct zwp_text_input_v3 *text_input UNUSED, struct wl_surface *surface UNUSED) {
text_input_leave(void *data UNUSED, struct zwp_text_input_v3 *txt_input, struct wl_surface *surface UNUSED) {
debug("text-input: leave event\n");
if (text_input) {
zwp_text_input_v3_disable(text_input);
if (txt_input) {
zwp_text_input_v3_disable(txt_input);
commit();
}
}
static inline void
static void
send_text(const char *text, GLFWIMEState ime_state) {
_GLFWwindow *w = _glfwFocusedWindow();
if (w && w->callbacks.keyboard) {
@@ -57,7 +57,7 @@ send_text(const char *text, GLFWIMEState ime_state) {
static void
text_input_preedit_string(
void *data UNUSED,
struct zwp_text_input_v3 *text_input UNUSED,
struct zwp_text_input_v3 *txt_input UNUSED,
const char *text,
int32_t cursor_begin,
int32_t cursor_end
@@ -68,7 +68,7 @@ text_input_preedit_string(
}
static void
text_input_commit_string(void *data UNUSED, struct zwp_text_input_v3 *text_input UNUSED, const char *text) {
text_input_commit_string(void *data UNUSED, struct zwp_text_input_v3 *txt_input UNUSED, const char *text) {
debug("text-input: commit_string event: text: %s\n", text);
free(pending_commit);
pending_commit = text ? _glfw_strdup(text) : NULL;
@@ -77,14 +77,14 @@ text_input_commit_string(void *data UNUSED, struct zwp_text_input_v3 *text_input
static void
text_input_delete_surrounding_text(
void *data UNUSED,
struct zwp_text_input_v3 *zwp_text_input_v3 UNUSED,
struct zwp_text_input_v3 *txt_input UNUSED,
uint32_t before_length,
uint32_t after_length) {
debug("text-input: delete_surrounding_text event: before_length: %u after_length: %u\n", before_length, after_length);
}
static void
text_input_done(void *data UNUSED, struct zwp_text_input_v3 *zwp_text_input_v3 UNUSED, uint32_t serial UNUSED) {
text_input_done(void *data UNUSED, struct zwp_text_input_v3 *txt_input UNUSED, uint32_t serial UNUSED) {
debug("text-input: done event: serial: %u current_commit_serial: %u\n", serial, commit_serial);
if (serial != commit_serial) {
_glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: text_input_done serial mismatch, expected=%u got=%u\n", commit_serial, serial);

80
glfw/wl_window.c vendored
View File

@@ -413,9 +413,15 @@ static void setFullscreen(_GLFWwindow* window, _GLFWmonitor* monitor, bool on)
setIdleInhibitor(window, on);
}
bool
_glfwPlatformIsFullscreen(_GLFWwindow *window, unsigned int flags UNUSED) {
return window->wl.toplevel_states & TOPLEVEL_STATE_FULLSCREEN;
}
bool
_glfwPlatformToggleFullscreen(_GLFWwindow *window, unsigned int flags UNUSED) {
bool already_fullscreen = window->wl.toplevel_states & TOPLEVEL_STATE_FULLSCREEN;
bool already_fullscreen = _glfwPlatformIsFullscreen(window, flags);
setFullscreen(window, NULL, !already_fullscreen);
return !already_fullscreen;
}
@@ -890,9 +896,9 @@ void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
if (width != window->wl.width || height != window->wl.height) {
window->wl.user_requested_content_size.width = width;
window->wl.user_requested_content_size.height = height;
int32_t width = 0, height = 0;
set_csd_window_geometry(window, &width, &height);
window->wl.width = width; window->wl.height = height;
int32_t w = 0, h = 0;
set_csd_window_geometry(window, &w, &h);
window->wl.width = w; window->wl.height = h;
resizeFramebuffer(window);
ensure_csd_resources(window);
wl_surface_commit(window->wl.surface);
@@ -1561,11 +1567,6 @@ static void mark_primary_selection_offer(void *data UNUSED, struct zwp_primary_s
static void
set_offer_mimetype(_GLFWWaylandDataOffer* offer, const char* mime) {
if (strcmp(mime, "text/plain;charset=utf-8") == 0) {
offer->plain_text_mime = "text/plain;charset=utf-8";
} else if (!offer->plain_text_mime && strcmp(mime, "text/plain")) {
offer->plain_text_mime = "text/plain";
}
if (strcmp(mime, clipboard_mime()) == 0) {
offer->is_self_offer = true;
}
@@ -1666,9 +1667,9 @@ static void drag_enter(void *data UNUSED, struct wl_data_device *wl_data_device
while (window)
{
if (window->wl.surface == surface) {
for (size_t x = 0; x < d->mimes_count; x++) {
int prio = _glfwInputDrop(window, d->mimes[x], NULL, 0);
if (prio > format_priority) d->mime_for_drop = d->mimes[x];
for (size_t j = 0; j < d->mimes_count; j++) {
int prio = _glfwInputDrop(window, d->mimes[j], NULL, 0);
if (prio > format_priority) d->mime_for_drop = d->mimes[j];
}
break;
}
@@ -1694,8 +1695,8 @@ static void drop(void *data UNUSED, struct wl_data_device *wl_data_device UNUSED
for (size_t i = 0; i < arraysz(_glfw.wl.dataOffers); i++) {
if (_glfw.wl.dataOffers[i].offer_type == DRAG_AND_DROP && _glfw.wl.dataOffers[i].mime_for_drop) {
size_t sz = 0;
char *data = read_data_offer(_glfw.wl.dataOffers[i].id, _glfw.wl.dataOffers[i].mime_for_drop, &sz);
if (data) {
char *d = read_data_offer(_glfw.wl.dataOffers[i].id, _glfw.wl.dataOffers[i].mime_for_drop, &sz);
if (d) {
// We dont do finish as this requires version 3 for wl_data_device_manager
// which then requires more work with calling set_actions for drag and drop to function
// wl_data_offer_finish(_glfw.wl.dataOffers[i].id);
@@ -1704,13 +1705,13 @@ static void drop(void *data UNUSED, struct wl_data_device *wl_data_device UNUSED
while (window)
{
if (window->wl.surface == _glfw.wl.dataOffers[i].surface) {
_glfwInputDrop(window, _glfw.wl.dataOffers[i].mime_for_drop, data, sz);
_glfwInputDrop(window, _glfw.wl.dataOffers[i].mime_for_drop, d, sz);
break;
}
window = window->next;
}
free(data);
free(d);
}
destroy_data_offer(&_glfw.wl.dataOffers[i]);
break;
@@ -1762,7 +1763,7 @@ void _glfwSetupWaylandPrimarySelectionDevice() {
if (_glfw.wl.primarySelectionDevice) zwp_primary_selection_device_v1_add_listener(_glfw.wl.primarySelectionDevice, &primary_selection_device_listener, NULL);
}
static inline bool _glfwEnsureDataDevice(void) {
static bool _glfwEnsureDataDevice(void) {
if (!_glfw.wl.dataDeviceManager)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
@@ -1814,16 +1815,38 @@ void _glfwPlatformSetClipboardString(const char* string)
wl_callback_add_listener(callback, &clipboard_copy_callback_listener, _glfw.wl.dataSourceForClipboard);
}
static bool
offer_has_mime(const _GLFWWaylandDataOffer *d, const char *mime) {
for (unsigned i = 0; i < d->mimes_count; i++) {
if (strcmp(d->mimes[i], mime) == 0) return true;
}
return false;
}
static const char*
plain_text_mime_for_offer(const _GLFWWaylandDataOffer *d) {
#define A(x) if (offer_has_mime(d, x)) return x;
A("text/plain;charset=utf-8");
A("text/plain");
A("UTF8_STRING");
A("STRING");
#undef A
return NULL;
}
const char* _glfwPlatformGetClipboardString(void)
{
for (size_t i = 0; i < arraysz(_glfw.wl.dataOffers); i++) {
_GLFWWaylandDataOffer *d = _glfw.wl.dataOffers + i;
if (d->id && d->offer_type == CLIPBOARD && d->plain_text_mime) {
if (d->id && d->offer_type == CLIPBOARD) {
if (d->is_self_offer) return _glfw.wl.clipboardString;
free(_glfw.wl.pasteString);
size_t sz = 0;
_glfw.wl.pasteString = read_data_offer(d->id, d->plain_text_mime, &sz);
return _glfw.wl.pasteString;
const char *mime = plain_text_mime_for_offer(d);
if (mime) {
free(_glfw.wl.pasteString);
size_t sz = 0;
_glfw.wl.pasteString = read_data_offer(d->id, mime, &sz);
return _glfw.wl.pasteString;
}
}
}
return NULL;
@@ -1871,13 +1894,14 @@ const char* _glfwPlatformGetPrimarySelectionString(void)
for (size_t i = 0; i < arraysz(_glfw.wl.dataOffers); i++) {
_GLFWWaylandDataOffer *d = _glfw.wl.dataOffers + i;
if (d->id && d->is_primary && d->offer_type == PRIMARY_SELECTION && d->plain_text_mime) {
if (d->is_self_offer) {
return _glfw.wl.primarySelectionString;
if (d->id && d->is_primary && d->offer_type == PRIMARY_SELECTION) {
if (d->is_self_offer) return _glfw.wl.primarySelectionString;
const char *mime = plain_text_mime_for_offer(d);
if (mime) {
free(_glfw.wl.pasteString);
_glfw.wl.pasteString = read_primary_selection_offer(d->id, mime);
return _glfw.wl.pasteString;
}
free(_glfw.wl.pasteString);
_glfw.wl.pasteString = read_primary_selection_offer(d->id, d->plain_text_mime);
return _glfw.wl.pasteString;
}
}
return NULL;

11
glfw/x11_window.c vendored
View File

@@ -281,7 +281,7 @@ updateNormalHints(_GLFWwindow* window, int width, int height)
XFree(hints);
}
static inline bool
static bool
is_window_fullscreen(_GLFWwindow* window)
{
Atom* states;
@@ -310,7 +310,7 @@ is_window_fullscreen(_GLFWwindow* window)
return ans;
}
static inline void
static void
set_fullscreen(_GLFWwindow *window, bool on) {
if (_glfw.x11.NET_WM_STATE && _glfw.x11.NET_WM_STATE_FULLSCREEN) {
sendEventToWM(window,
@@ -343,6 +343,11 @@ set_fullscreen(_GLFWwindow *window, bool on) {
}
}
bool
_glfwPlatformIsFullscreen(_GLFWwindow *window, unsigned int flags UNUSED) {
return is_window_fullscreen(window);
}
bool
_glfwPlatformToggleFullscreen(_GLFWwindow *window, unsigned int flags UNUSED) {
bool already_fullscreen = is_window_fullscreen(window);
@@ -2646,7 +2651,7 @@ void _glfwPlatformSetWindowOpacity(_GLFWwindow* window, float opacity)
PropModeReplace, (unsigned char*) &value, 1);
}
static inline unsigned
static unsigned
dispatch_x11_queued_events(int num_events) {
unsigned dispatched = num_events > 0 ? num_events : 0;
while (num_events-- > 0) {

179
glfw/xkb_glfw.c vendored
View File

@@ -383,22 +383,162 @@ glfw_xkb_update_masks(_GLFWXKBData *xkb) {
#define xkb_glfw_load_keymap(keymap, map_str) keymap = xkb_keymap_new_from_string(xkb->context, map_str, XKB_KEYMAP_FORMAT_TEXT_V1, 0);
#define xkb_glfw_load_state(keymap, state) state = xkb_state_new(keymap);
typedef struct {
struct xkb_state *state;
int failed;
xkb_mod_mask_t used_mods;
xkb_mod_mask_t shift, control, capsLock, numLock, alt, super, meta, hyper;
/* Combination modifiers to try */
int try_shift;
xkb_keycode_t shift_keycode;
} modifier_mapping_algorithm_t;
/* Algorithm for mapping virtual modifiers to real modifiers:
* 1. create new state
* 2. for each key in keymap
* a. send key down to state
* b. if it affected exactly one bit in modifier map
* i) get keysym
* ii) if keysym matches one of the known modifiers, save it for that modifier
* iii) if modifier is latched, send key up and key down to toggle again
* c. send key up to reset the state
* 3. if shift key found in step 2, run step 2 with all shift+key for each key
* 4. if shift, control, alt and super are not all found, declare failure
* 5. if failure, use static mapping from xkbcommon-names.h
*
* Step 3 is needed because many popular keymaps map meta to alt+shift.
*
* We could do better by constructing a system of linear equations, but it should not be
* needed in any sane system. We could also use this algorithm with X11, but X11
* provides XkbVirtualModsToReal which is guaranteed to be accurate, while this
* algorithm is only a heuristic.
*
* We don't touch level3 or level5 modifiers.
*/
static void modifier_mapping_algorithm( struct xkb_keymap *keymap UNUSED, xkb_keycode_t key, void *data ) {
modifier_mapping_algorithm_t *algorithm = ( modifier_mapping_algorithm_t * )data;
if ( algorithm->failed )
return;
if ( algorithm->try_shift ) {
if ( key == algorithm->shift_keycode ) return;
xkb_state_update_key( algorithm->state, algorithm->shift_keycode, XKB_KEY_DOWN );
}
enum xkb_state_component changed_type = xkb_state_update_key( algorithm->state, key, XKB_KEY_DOWN );
if ( changed_type & ( XKB_STATE_MODS_DEPRESSED | XKB_STATE_MODS_LATCHED | XKB_STATE_MODS_LOCKED ) ) {
xkb_mod_mask_t mods = xkb_state_serialize_mods( algorithm->state,
algorithm->try_shift ? XKB_STATE_MODS_EFFECTIVE : ( XKB_STATE_MODS_DEPRESSED | XKB_STATE_MODS_LATCHED | XKB_STATE_MODS_LOCKED ) );
const xkb_keysym_t *keysyms;
int num_keysyms = xkb_state_key_get_syms( algorithm->state, key, &keysyms );
/* We can handle exactly one keysym with exactly one bit set in the implementation
* below; with a lot more gymnastics, we could set up an 8x8 linear system and solve
* for each modifier in case there are some modifiers that are only present in
* combination with others, but it is not worth the effort. */
if ( num_keysyms == 1 && mods && ( mods & ( mods-1 ) ) == 0 ) {
#define S2( k, a ) \
do { \
if ( keysyms[0] == XKB_KEY_##k##_L || keysyms[0] == XKB_KEY_##k##_R ) { \
if ( !algorithm->a ) \
algorithm->a = mods; \
else if ( algorithm->a != mods ) \
algorithm->failed = 1; \
} \
} while ( 0 )
#define S1( k, a ) if ( ( keysyms[0] == XKB_KEY_##k ) && !algorithm->a ) algorithm->a = mods
S2( Shift, shift );
S2( Control, control );
S1( Caps_Lock, capsLock );
S1( Shift_Lock, numLock );
S2( Alt, alt );
S2( Super, super );
S2( Meta, meta );
S2( Hyper, hyper );
#undef S1
#undef S2
}
if ( !algorithm->shift_keycode && ( keysyms[0] == XKB_KEY_Shift_L || keysyms[0] == XKB_KEY_Shift_R ) )
algorithm->shift_keycode = key;
/* If this is a lock, then up and down to remove lock state*/
if ( changed_type & XKB_STATE_MODS_LOCKED ) { /* What should we do for LATCHED here? */
xkb_state_update_key( algorithm->state, key, XKB_KEY_UP );
xkb_state_update_key( algorithm->state, key, XKB_KEY_DOWN );
}
}
xkb_state_update_key( algorithm->state, key, XKB_KEY_UP );
if ( algorithm->try_shift ) {
xkb_state_update_key( algorithm->state, algorithm->shift_keycode, XKB_KEY_UP );
}
}
static int local_modifier_mapping(_GLFWXKBData *xkb) {
modifier_mapping_algorithm_t algorithm;
algorithm.failed = 0;
algorithm.used_mods = 0;
algorithm.shift = algorithm.control = algorithm.capsLock = algorithm.numLock = algorithm.alt = algorithm.super = algorithm.meta = algorithm.hyper = 0;
algorithm.try_shift = 0;
algorithm.shift_keycode = 0;
algorithm.state = xkb_state_new( xkb->keymap );
if ( algorithm.state != NULL )
{
xkb_keymap_key_for_each( xkb->keymap, &modifier_mapping_algorithm, &algorithm );
if ( !algorithm.shift_keycode )
algorithm.failed = 1;
if ( !( algorithm.shift && algorithm.control && algorithm.alt && algorithm.super && algorithm.meta && algorithm.hyper )
&& !algorithm.failed ) {
algorithm.try_shift = 1;
xkb_keymap_key_for_each( xkb->keymap, &modifier_mapping_algorithm, &algorithm );
}
xkb_state_unref( algorithm.state );
if ( !algorithm.failed && !( algorithm.shift && algorithm.control && algorithm.alt && algorithm.super ) )
algorithm.failed = 1; /* must have found at least those 4 modifiers */
}
if ( !algorithm.failed ) {
#define S( a ) xkb->a##Idx = XKB_MOD_INVALID; xkb->a##Mask = 0
S(control); S(shift); S(capsLock); S(alt); S(super); S(hyper); S(meta); S(numLock);
#undef S
unsigned indx, shifted, used_bits = 0;
for (indx = 0, shifted = 1; indx < 32; ++indx, shifted <<= 1) {
#define S( a ) if ( (xkb->a##Idx == XKB_MOD_INVALID) && !( used_bits & shifted ) && algorithm.a == shifted ) xkb->a##Idx = indx, xkb->a##Mask = shifted, used_bits |= shifted
S(control); S(shift); S(capsLock); S(alt); S(super); S(hyper); S(meta); S(numLock);
#undef S
}
}
if ( algorithm.failed )
debug( "Wayland modifier autodetection algorithm failed; using defaults\n" );
return !algorithm.failed;
}
static void
glfw_xkb_update_masks(_GLFWXKBData *xkb) {
// Should find better solution under Wayland
// See https://github.com/kovidgoyal/kitty/pull/3430 for discussion
// See https://github.com/kovidgoyal/kitty/pull/3943 for discussion
if ( getenv( "KITTY_WAYLAND_DETECT_MODIFIERS" ) == NULL || !local_modifier_mapping( xkb ) ) {
#define S( a ) xkb->a##Idx = XKB_MOD_INVALID; xkb->a##Mask = 0
S(hyper); S(meta);
S(hyper); S(meta);
#undef S
#define S(a, n) xkb->a##Idx = xkb_keymap_mod_get_index(xkb->keymap, n); xkb->a##Mask = 1 << xkb->a##Idx;
S(control, XKB_MOD_NAME_CTRL);
S(shift, XKB_MOD_NAME_SHIFT);
S(capsLock, XKB_MOD_NAME_CAPS);
S(numLock, XKB_MOD_NAME_NUM);
S(alt, XKB_MOD_NAME_ALT);
S(super, XKB_MOD_NAME_LOGO);
S(control, XKB_MOD_NAME_CTRL);
S(shift, XKB_MOD_NAME_SHIFT);
S(capsLock, XKB_MOD_NAME_CAPS);
S(numLock, XKB_MOD_NAME_NUM);
S(alt, XKB_MOD_NAME_ALT);
S(super, XKB_MOD_NAME_LOGO);
#undef S
}
debug("Modifier indices alt: 0x%x super: 0x%x hyper: 0x%x meta: 0x%x numlock: 0x%x shift: 0x%x capslock: 0x%x control: 0x%x\n",
xkb->altIdx, xkb->superIdx, xkb->hyperIdx, xkb->metaIdx, xkb->numLockIdx, xkb->shiftIdx, xkb->capsLockIdx, xkb->controlIdx);
}
#endif
@@ -490,7 +630,7 @@ load_compose_tables(_GLFWXKBData *xkb) {
xkb_compose_table_unref(compose_table);
}
static inline xkb_mod_mask_t
static xkb_mod_mask_t
active_unknown_modifiers(_GLFWXKBData *xkb, struct xkb_state *state) {
size_t i = 0;
xkb_mod_mask_t ans = 0;
@@ -577,7 +717,7 @@ glfw_xkb_should_repeat(_GLFWXKBData *xkb, xkb_keycode_t keycode) {
}
static inline xkb_keysym_t
static xkb_keysym_t
compose_symbol(struct xkb_compose_state *composeState, xkb_keysym_t sym, int *compose_completed, char *key_text, int n) {
*compose_completed = 0;
if (sym == XKB_KEY_NoSymbol || !composeState) return sym;
@@ -610,7 +750,7 @@ glfw_xkb_keysym_from_name(const char *name, bool case_sensitive) {
return (int)xkb_keysym_from_name(name, case_sensitive ? XKB_KEYSYM_NO_FLAGS : XKB_KEYSYM_CASE_INSENSITIVE);
}
static inline const char*
static const char*
format_mods(unsigned int mods) {
static char buf[128];
char *p = buf, *s;
@@ -632,7 +772,7 @@ format_mods(unsigned int mods) {
return buf;
}
static inline const char*
static const char*
format_xkb_mods(_GLFWXKBData *xkb, const char* name, xkb_mod_mask_t mods) {
static char buf[512];
char *p = buf, *s;
@@ -702,6 +842,19 @@ glfw_xkb_key_from_ime(_GLFWIBUSKeyEvent *ev, bool handled_by_ime, bool failed) {
last_handled_press_keycode = ev->glfw_ev.native_key;
}
void
glfw_xkb_forwarded_key_from_ime(xkb_keysym_t keysym, unsigned int glfw_mods) {
_GLFWwindow *w = _glfwFocusedWindow();
if (w && w->callbacks.keyboard) {
GLFWkeyevent fake_ev = {.action = GLFW_PRESS};
fake_ev.native_key = keysym;
fake_ev.key = glfw_key_for_sym(keysym);
fake_ev.mods = glfw_mods;
fake_ev.ime_state = GLFW_IME_NONE;
w->callbacks.keyboard((GLFWwindow*) w, &fake_ev);
}
}
static bool
is_switch_layout_key(xkb_keysym_t xkb_sym) {
return xkb_sym == XKB_KEY_ISO_First_Group || xkb_sym == XKB_KEY_ISO_Last_Group || xkb_sym == XKB_KEY_ISO_Next_Group || xkb_sym == XKB_KEY_ISO_Prev_Group || xkb_sym == XKB_KEY_Mode_switch;
@@ -713,7 +866,7 @@ glfw_xkb_handle_key_event(_GLFWwindow *window, _GLFWXKBData *xkb, xkb_keycode_t
const xkb_keysym_t *syms, *clean_syms, *default_syms;
xkb_keysym_t xkb_sym, shifted_xkb_sym = XKB_KEY_NoSymbol, alternate_xkb_sym = XKB_KEY_NoSymbol;
xkb_keycode_t code_for_sym = xkb_keycode, ibus_keycode = xkb_keycode;
GLFWkeyevent glfw_ev = {.action = GLFW_PRESS};
GLFWkeyevent glfw_ev = {.action = GLFW_PRESS, .native_key_id = xkb_keycode};
#ifdef _GLFW_WAYLAND
code_for_sym += 8;
#else

1
glfw/xkb_glfw.h vendored
View File

@@ -98,3 +98,4 @@ void glfw_xkb_handle_key_event(_GLFWwindow *window, _GLFWXKBData *xkb, xkb_keyco
int glfw_xkb_keysym_from_name(const char *name, bool case_sensitive);
void glfw_xkb_update_ime_state(_GLFWwindow *w, _GLFWXKBData *xkb, const GLFWIMEUpdateEvent *ev);
void glfw_xkb_key_from_ime(_GLFWIBUSKeyEvent *ev, bool handled_by_ime, bool failed);
void glfw_xkb_forwarded_key_from_ime(xkb_keysym_t keysym, unsigned int glfw_mods);

View File

@@ -1,20 +1,21 @@
#!/usr/bin/env python3
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
import os
import sys
from contextlib import suppress
from typing import TYPE_CHECKING, List, Optional, Tuple
from typing import TYPE_CHECKING, Dict, List, NamedTuple, Optional, Tuple
from kitty.cli import parse_args
from kitty.cli_stub import AskCLIOptions
from kitty.constants import cache_dir
from kitty.typing import BossType
from kitty.fast_data_types import wcswidth
from kitty.typing import BossType, TypedDict
from kitty.utils import ScreenSize
from ..tui.handler import result_handler
from ..tui.operations import alternate_screen, styled
from ..tui.utils import get_key_press
from ..tui.handler import Handler, result_handler
from ..tui.loop import Loop, MouseEvent
from ..tui.operations import MouseTracking, alternate_screen, styled
if TYPE_CHECKING:
import readline
@@ -97,45 +98,109 @@ For example: y:Yes and n;red:No
'''
try:
from typing import TypedDict
except ImportError:
TypedDict = dict
class Response(TypedDict):
items: List[str]
response: Optional[str]
def choice(cli_opts: AskCLIOptions, items: List[str]) -> Response:
with alternate_screen():
if cli_opts.message:
print(styled(cli_opts.message, bold=True))
print()
allowed = ''
for choice in cli_opts.choices:
color = 'green'
letter, text = choice.split(':', maxsplit=1)
if ';' in letter:
letter, color = letter.split(';', maxsplit=1)
letter = letter.lower()
idx = text.lower().index(letter)
allowed += letter
print(text[:idx], styled(text[idx], fg=color), text[idx + 1:], sep='', end=' ')
print()
response = get_key_press(allowed, '')
return {'items': items, 'response': response}
class Choice(NamedTuple):
text: str
idx: int
color: str
def yesno(cli_opts: AskCLIOptions, items: List[str]) -> Response:
with alternate_screen():
if cli_opts.message:
print(styled(cli_opts.message, bold=True))
print()
print(' ', styled('Y', fg='green') + 'es', ' ', styled('N', fg='red') + 'o')
response = get_key_press('yn', 'n')
return {'items': items, 'response': response}
class Range(NamedTuple):
start: int
end: int
y: int
def has_point(self, x: int, y: int) -> bool:
return y == self.y and self.start <= x <= self.end
class Choose(Handler):
mouse_tracking = MouseTracking.buttons_only
def __init__(self, cli_opts: AskCLIOptions) -> None:
self.cli_opts = cli_opts
self.response = 'n' if cli_opts.type == 'yesno' else ''
self.allowed = frozenset('yn')
self.choices: Dict[str, Choice] = {}
self.clickable_ranges: Dict[str, Range] = {}
if cli_opts.type != 'yesno':
allowed = []
for choice in cli_opts.choices:
color = 'green'
letter, text = choice.split(':', maxsplit=1)
if ';' in letter:
letter, color = letter.split(';', maxsplit=1)
letter = letter.lower()
idx = text.lower().index(letter)
allowed.append(letter)
self.choices[letter] = Choice(text, idx, color)
self.allowed = frozenset(allowed)
def initialize(self) -> None:
self.cmd.set_cursor_visible(False)
self.draw_screen()
def finalize(self) -> None:
self.cmd.set_cursor_visible(True)
@Handler.atomic_update
def draw_screen(self) -> None:
self.cmd.clear_screen()
y = 1
if self.cli_opts.message:
self.cmd.styled(self.cli_opts.message, bold=True)
y += wcswidth(self.cli_opts.message) // self.screen_size.cols
self.print()
if self.cli_opts.type == 'yesno':
self.draw_yesno(y)
else:
self.draw_choice(y)
def draw_choice(self, y: int) -> None:
x = 0
self.clickable_ranges.clear()
for letter, choice in self.choices.items():
text = choice.text[:choice.idx]
text += styled(choice.text[choice.idx], fg=choice.color)
text += choice.text[choice.idx + 1:]
text += ' '
sz = wcswidth(text)
if sz + x >= self.screen_size.cols:
y += 1
x = 0
self.print()
self.clickable_ranges[letter] = Range(x, x + sz - 1, y)
x += sz
self.print(text, end='')
def draw_yesno(self, y: int) -> None:
self.clickable_ranges = {'y': Range(2, 4, y), 'n': Range(8, 9, y)}
self.print(' ', styled('Y', fg='green') + 'es', ' ', styled('N', fg='red') + 'o')
def on_text(self, text: str, in_bracketed_paste: bool = False) -> None:
text = text.lower()
if text in self.allowed:
self.response = text
self.quit_loop(0)
def on_click(self, ev: MouseEvent) -> None:
for letter, r in self.clickable_ranges.items():
if r.has_point(ev.cell_x, ev.cell_y):
self.response = letter
self.quit_loop(0)
break
def on_resize(self, screen_size: ScreenSize) -> None:
self.screen_size = screen_size
self.draw_screen()
def on_interrupt(self) -> None:
self.quit_loop(1)
on_eot = on_interrupt
def main(args: List[str]) -> Response:
@@ -152,15 +217,16 @@ def main(args: List[str]) -> Response:
input('Press enter to quit...')
raise SystemExit(e.code)
if cli_opts.type == 'yesno':
return yesno(cli_opts, items)
if cli_opts.type == 'choices':
return choice(cli_opts, items)
if cli_opts.type in ('yesno', 'choices'):
loop = Loop()
handler = Choose(cli_opts)
loop.loop(handler)
return {'items': items, 'response': handler.response}
import readline as rl
readline = rl
from kitty.shell import init_readline
init_readline(readline)
init_readline()
response = None
with alternate_screen(), HistoryCompleter(cli_opts.name):

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python
# vim:fileencoding=utf-8
# License: GPLv3 Copyright: 2020, Kovid Goyal <kovid at kovidgoyal.net>
import sys
@@ -12,6 +11,7 @@ from kitty.cli_stub import BroadcastCLIOptions
from kitty.key_encoding import encode_key_event
from kitty.rc.base import MATCH_TAB_OPTION, MATCH_WINDOW_OPTION
from kitty.remote_control import create_basic_command, encode_send
from kitty.short_uuid import uuid4
from kitty.typing import KeyEventType, ScreenSize
from ..tui.handler import Handler
@@ -20,18 +20,27 @@ from ..tui.loop import Loop
from ..tui.operations import RESTORE_CURSOR, SAVE_CURSOR, styled
def session_command(payload: Dict[str, Any], start: bool = True) -> bytes:
payload = payload.copy()
payload['data'] = 'session:' + ('start' if start else 'end')
send = create_basic_command('send-text', payload, no_response=True)
return encode_send(send)
class Broadcast(Handler):
def __init__(self, opts: BroadcastCLIOptions, initial_strings: List[str]) -> None:
self.opts = opts
self.initial_strings = initial_strings
self.payload = {'exclude_active': True, 'data': '', 'match': opts.match_tab, 'match_tab': opts.match_tab}
self.payload = {'exclude_active': True, 'data': '', 'match': opts.match, 'match_tab': opts.match_tab, 'session_id': uuid4()}
self.line_edit = LineEdit()
self.session_started = False
if not opts.match and not opts.match_tab:
self.payload['all'] = True
def initialize(self) -> None:
self.print('Type the text to broadcast below, press', styled('Ctrl+c', fg='yellow'), 'to quit:')
self.write_broadcast_session()
self.print('Type the text to broadcast below, press', styled('Ctrl+Esc', fg='yellow'), 'to quit:')
for x in self.initial_strings:
self.write_broadcast_text(x)
self.write(SAVE_CURSOR)
@@ -51,7 +60,9 @@ class Broadcast(Handler):
self.commit_line()
def on_interrupt(self) -> None:
self.quit_loop(0)
self.write_broadcast_text('\x03')
self.line_edit.clear()
self.commit_line()
def on_eot(self) -> None:
self.write_broadcast_text('\x04')
@@ -65,6 +76,9 @@ class Broadcast(Handler):
self.line_edit.clear()
self.write(SAVE_CURSOR)
return
if key_event.matches('ctrl+esc'):
self.quit_loop(0)
return
ek = encode_key_event(key_event)
ek = standard_b64encode(ek.encode('utf-8')).decode('ascii')
@@ -79,6 +93,10 @@ class Broadcast(Handler):
send = create_basic_command('send-text', payload, no_response=True)
self.write(encode_send(send))
def write_broadcast_session(self, start: bool = True) -> None:
self.session_started = start
self.write(session_command(self.payload, start))
OPTIONS = (MATCH_WINDOW_OPTION + '\n\n' + MATCH_TAB_OPTION.replace('--match -m', '--match-tab -t')).format
help_text = 'Broadcast typed text to all kitty windows. By default text is sent to all windows, unless one of the matching options is specified'
@@ -98,11 +116,16 @@ def main(args: List[str]) -> Optional[Dict[str, Any]]:
input(_('Press Enter to quit'))
return None
print('Type text to be broadcast below, Ctrl-C to quit:', end='\r\n')
sys.stdout.flush()
loop = Loop()
handler = Broadcast(opts, items)
loop.loop(handler)
try:
loop.loop(handler)
finally:
if handler.session_started:
sys.stdout.buffer.write(session_command(handler.payload, False))
sys.stdout.buffer.flush()
return None
if __name__ == '__main__':

View File

@@ -55,7 +55,7 @@ create_job(size_t i, size_t blocksz, GlobalData *global) {
if (ans->start >= global->haystack_count) ans->count = 0;
else ans->count = global->haystack_count - ans->start;
ans->max_haystack_len = 0;
for (size_t i = ans->start; i < ans->start + ans->count; i++) ans->max_haystack_len = MAX(ans->max_haystack_len, global->haystack[i].haystack_len);
for (size_t j = ans->start; j < ans->start + ans->count; j++) ans->max_haystack_len = MAX(ans->max_haystack_len, global->haystack[j].haystack_len);
if (ans->count > 0) {
ans->workspace = alloc_workspace(ans->max_haystack_len, global);
if (!ans->workspace) { free(ans); return NULL; }

View File

@@ -1,49 +1,15 @@
#!/usr/bin/env python3
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
import sys
from typing import Iterable, List, Union
from typing import List
from kitty.key_encoding import KeyEvent
from . import subseq_matcher
from ..tui.handler import Handler
from ..tui.loop import Loop
def match(
input_data: Union[str, bytes, Iterable[Union[str, bytes]]],
query: str,
threads: int = 0,
positions: bool = False,
level1: str = '/',
level2: str = '-_0123456789',
level3: str = '.',
limit: int = 0,
mark_before: str = '',
mark_after: str = '',
delimiter: str = '\n'
) -> List[str]:
if isinstance(input_data, str):
idata = [x.encode('utf-8') for x in input_data.split(delimiter)]
elif isinstance(input_data, bytes):
idata = input_data.split(delimiter.encode('utf-8'))
else:
idata = [x.encode('utf-8') if isinstance(x, str) else x for x in input_data]
query = query.lower()
level1 = level1.lower()
level2 = level2.lower()
level3 = level3.lower()
data = subseq_matcher.match(
idata, (level1, level2, level3), query,
positions, limit, threads,
mark_before, mark_after, delimiter)
if data is None:
return []
return list(filter(None, data.split(delimiter or '\n')))
class ChooseHandler(Handler):
def initialize(self) -> None:

38
kittens/choose/match.py Normal file
View File

@@ -0,0 +1,38 @@
#!/usr/bin/env python
# License: GPLv3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
from typing import Iterable, List, Union
from . import subseq_matcher
def match(
input_data: Union[str, bytes, Iterable[Union[str, bytes]]],
query: str,
threads: int = 0,
positions: bool = False,
level1: str = '/',
level2: str = '-_0123456789',
level3: str = '.',
limit: int = 0,
mark_before: str = '',
mark_after: str = '',
delimiter: str = '\n'
) -> List[str]:
if isinstance(input_data, str):
idata = [x.encode('utf-8') for x in input_data.split(delimiter)]
elif isinstance(input_data, bytes):
idata = input_data.split(delimiter.encode('utf-8'))
else:
idata = [x.encode('utf-8') if isinstance(x, str) else x for x in input_data]
query = query.lower()
level1 = level1.lower()
level2 = level2.lower()
level3 = level3.lower()
data = subseq_matcher.match(
idata, (level1, level2, level3), query,
positions, limit, threads,
mark_before, mark_after, delimiter)
if data is None:
return []
return list(filter(None, data.split(delimiter or '\n')))

View File

@@ -14,7 +14,7 @@
#ifdef ISWINDOWS
#include <io.h>
#define STDOUT_FILENO 1
static inline ssize_t ms_write(int fd, const void* buf, size_t count) { return _write(fd, buf, (unsigned int)count); }
static ssize_t ms_write(int fd, const void* buf, size_t count) { return _write(fd, buf, (unsigned int)count); }
#define write ms_write
#else
#include <unistd.h>
@@ -24,7 +24,7 @@ static inline ssize_t ms_write(int fd, const void* buf, size_t count) { return _
#define FIELD(x, which) (((Candidate*)(x))->which)
static inline bool
static bool
ensure_space(GlobalData *global, size_t sz) {
if (global->output_sz < sz + global->output_pos || !global->output) {
size_t before = global->output_sz;
@@ -38,7 +38,7 @@ ensure_space(GlobalData *global, size_t sz) {
return true;
}
static inline void
static void
output_text(GlobalData *global, const text_t *data, size_t sz) {
if (ensure_space(global, sz)) {
memcpy(global->output + global->output_pos, data, sizeof(text_t) * sz);
@@ -66,10 +66,10 @@ static void
output_positions(GlobalData *global, len_t *positions, len_t num) {
wchar_t buf[128];
for (len_t i = 0; i < num; i++) {
int num = swprintf(buf, sizeof(buf)/sizeof(buf[0]), L"%u", positions[i]);
if (num > 0 && ensure_space(global, num + 1)) {
for (int i = 0; i < num; i++) global->output[global->output_pos++] = buf[i];
global->output[global->output_pos++] = (i == num - 1) ? ',' : ':';
int pnum = swprintf(buf, arraysz(buf), L"%u", positions[i]);
if (pnum > 0 && ensure_space(global, pnum + 1)) {
for (int k = 0; k < pnum; k++) global->output[global->output_pos++] = buf[k];
global->output[global->output_pos++] = (i == num - 1) ? ':' : ',';
}
}
}

View File

@@ -59,7 +59,7 @@ free_workspace(void *v) {
return NULL;
}
static inline bool
static bool
has_char(text_t *text, len_t sz, text_t ch) {
for(len_t i = 0; i < sz; i++) {
if(text[i] == ch) return true;
@@ -67,7 +67,7 @@ has_char(text_t *text, len_t sz, text_t ch) {
return false;
}
static inline uint8_t
static uint8_t
level_factor_for(text_t current, text_t last, WorkSpace *w) {
text_t lch = LOWERCASE(last);
if (has_char(w->level1, w->level1_len, lch)) return 90;
@@ -101,7 +101,7 @@ init_workspace(WorkSpace *w, text_t *haystack, len_t haystack_len) {
}
static inline bool
static bool
has_atleast_one_match(WorkSpace *w) {
int p = -1;
bool found;
@@ -118,7 +118,7 @@ has_atleast_one_match(WorkSpace *w) {
#define POSITION(x) w->positions[x][w->address[x]]
static inline bool
static bool
increment_address(WorkSpace *w) {
len_t pos = w->needle_len - 1;
while(true) {
@@ -130,7 +130,7 @@ increment_address(WorkSpace *w) {
return false;
}
static inline bool
static bool
address_is_monotonic(WorkSpace *w) {
// Check if the character positions pointed to by the current address are monotonic
for (len_t i = 1; i < w->needle_len; i++) {
@@ -139,7 +139,7 @@ address_is_monotonic(WorkSpace *w) {
return true;
}
static inline double
static double
calc_score(WorkSpace *w) {
double ans = 0;
len_t distance, pos;

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
import os
@@ -57,9 +56,9 @@ OPTIONS = r'''
--get-clipboard
default=False
type=bool-set
Output the current contents of the clipboard to stdout. Note that this
will not work if you have not enabled the option to allow reading the clipboard
in kitty.conf
Output the current contents of the clipboard to STDOUT. Note that by default
kitty will prompt you asking to allow access to the clipboard. Can be controlled
by :opt:`clipboard_control`.
--use-primary
@@ -78,10 +77,10 @@ the kitten in a dedicated, ephemeral window.
help_text = '''\
Read or write to the system clipboard.
To set the clipboard text, pipe in the new text on stdin. Use the
To set the clipboard text, pipe in the new text on STDIN. Use the
:option:`--get-clipboard` option to output the current clipboard contents to
:file:`stdout`. Note that you must enable reading of clipboard in
:file:`kitty.conf` first.
:file:`stdout`. Note that reading the clipboard will cause a permission
popup, see :opt:`clipboard_control` for details.
'''
usage = ''
@@ -94,7 +93,7 @@ def main(args: List[str]) -> NoReturn:
data: Optional[bytes] = None
if not sys.stdin.isatty():
data = sys.stdin.buffer.read()
sys.stdin = open(os.ctermid(), 'r')
sys.stdin = open(os.ctermid())
loop = Loop()
handler = Clipboard(data, cli_opts)
loop.loop(handler)

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
import os

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
import os

View File

@@ -4,9 +4,9 @@ from .collect import Segment
def split_with_highlights(
line: str, truncate_points: List[int], fg_highlights: List,
line: str, truncate_points: List[int], fg_highlights: List[Segment],
bg_highlight: Optional[Segment]
) -> List:
) -> List[str]:
pass

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
import concurrent
@@ -22,7 +21,7 @@ class StyleNotFound(Exception):
pass
class DiffFormatter(Formatter):
class DiffFormatter(Formatter): # type: ignore
def __init__(self, style: str = 'default') -> None:
try:
@@ -31,7 +30,7 @@ class DiffFormatter(Formatter):
except ClassNotFound:
initialized = False
if not initialized:
raise StyleNotFound('pygments style "{}" not found'.format(style))
raise StyleNotFound(f'pygments style "{style}" not found')
self.styles: Dict[str, Tuple[str, str]] = {}
for token, token_style in self.style:
@@ -153,7 +152,7 @@ def highlight_collection(collection: Collection, aliases: Optional[Dict[str, str
try:
highlights = future.result()
except Exception as e:
return 'Running syntax highlighting for {} generated an exception: {}'.format(path, e)
return f'Running syntax highlighting for {path} generated an exception: {e}'
ans[path] = highlights
return ans
@@ -166,5 +165,5 @@ def main() -> None:
with open(sys.argv[-1]) as f:
highlighted = highlight_data(f.read(), f.name, defaults.syntax_aliases)
if highlighted is None:
raise SystemExit('Unknown filetype: {}'.format(sys.argv[-1]))
raise SystemExit(f'Unknown filetype: {sys.argv[-1]}')
print(highlighted)

View File

@@ -1,5 +1,4 @@
#!/usr/bin/env python3
# vim:fileencoding=utf-8
# License: GPL v3 Copyright: 2018, Kovid Goyal <kovid at kovidgoyal.net>
import atexit
@@ -428,7 +427,7 @@ class DiffHandler(Handler):
elif self.state is MESSAGE:
self.cmd.styled(self.message, reverse=True)
else:
sp = '{:.0%}'.format(self.scroll_pos/self.max_scroll_pos) if self.scroll_pos and self.max_scroll_pos else '0%'
sp = f'{self.scroll_pos/self.max_scroll_pos:.0%}' if self.scroll_pos and self.max_scroll_pos else '0%'
scroll_frac = styled(sp, fg=self.opts.margin_fg)
if self.current_search is None:
counts = '{}{}{}'.format(
@@ -437,7 +436,7 @@ class DiffHandler(Handler):
styled(str(self.removed_count), fg=self.opts.highlight_removed_bg)
)
else:
counts = styled('{} matches'.format(len(self.current_search)), fg=self.opts.margin_fg)
counts = styled(f'{len(self.current_search)} matches', fg=self.opts.margin_fg)
suffix = counts + ' ' + scroll_frac
prefix = styled(':', fg=self.opts.margin_fg)
filler = self.screen_size.cols - wcswidth(prefix) - wcswidth(suffix)
@@ -632,7 +631,7 @@ def main(args: List[str]) -> None:
raise SystemExit('The items to be diffed should both be either directories or files. Comparing a directory to a file is not valid.')
for f in left, right:
if not os.path.exists(f):
raise SystemExit('{} does not exist'.format(f))
raise SystemExit(f'{f} does not exist')
loop = Loop()
handler = DiffHandler(cli_opts, opts, left, right)

View File

@@ -54,7 +54,7 @@ agr('colors', 'Colors')
opt('pygments_style', 'default',
long_text='''
The pygments color scheme to use for syntax highlighting. See :link:`pygments
colors schemes <https://help.farbox.com/pygments.html>` for a list of schemes.
builtin styles <https://pygments.org/styles/>` for a list of schemes.
'''
)

Some files were not shown because too many files have changed in this diff Show More