Compare commits

...

3222 Commits

Author SHA1 Message Date
129186761c Update patches from https://github.com/KittyPatch/kitty to work on current kitty 2023-05-12 21:06:00 -07:00
Kovid Goyal
491297ea1d When asking for permission to exec a shebang script also add options to view or edit the script 2023-05-12 16:02:47 +05:30
Kovid Goyal
c101a6acb0 Implement a dedicated function for word matching rather than relying on a regex and being at the mercy of the vagaries of regex implementations 2023-05-12 15:43:56 +05:30
Kovid Goyal
65f8bb7397 hints kitten: Switch to using a regex engine that supports lookaround
Note that we loose unicode char matching for --type=word because of
https://github.com/dlclark/regexp2/issues/65 and of course user regexps
cant use \p{N} escapes any more. Hopefully regexp2 will add support for
these soon-ish. IMO lookaround is more important than \p.

Fixes #6265
2023-05-12 12:24:59 +05:30
Kovid Goyal
5b8b91b6a3 Add support for OSC 1337 SetUserVar
See https://github.com/kovidgoyal/kitty/discussions/6229
2023-05-11 17:57:45 +05:30
Kovid Goyal
6a2edfa847 Merge branch 'pr-fix-shade' of https://github.com/MithicSpirit/kitty 2023-05-10 09:56:59 +05:30
MithicSpirit
28b84a2d5b Add support for 0x1fb90
Allocation in box_glyph_id is larger than necessary to account for the
addition of 0x1fb8c ... 0x1fb94 eventually, which are quite similar but
will require more work to add. Note that 0x1fb93 is not present in the
standard yet, but it is easy to guess what it will likely be from
context, so it should be kept in the allocation imo.
2023-05-09 22:19:03 -04:00
MithicSpirit
c247fe2336 Revert "Improve shade character appearance"
This reverts commit c883a024ba.

To maximize compatibility with the appearance in the standard.
2023-05-09 22:06:05 -04:00
MithicSpirit
c883a024ba Improve shade character appearance
I was really unhappy with the previous checkerboard appearance, so I
changed it to supersampled diagonal lines. The fill ratios are still the
same, so it should still be compliant with the standard if I understood
it correctly.

Feel free to revert (or tell me to revert) this commit if you want the
previous look.
2023-05-09 16:08:02 -04:00
Kovid Goyal
0cc38e1086 ... 2023-05-09 09:50:11 +05:30
Kovid Goyal
1777b87c45 Improve docs for reset the terminal 2023-05-09 09:44:05 +05:30
Kovid Goyal
e72975cc98 A new escape code that moves the current contents of the screen into the scrollback before clearing it 2023-05-09 09:32:39 +05:30
Kovid Goyal
8f15654985 Ensure kitty is rebuilt after publishing the nightly 2023-05-09 08:54:29 +05:30
Kovid Goyal
2408ccb635 ... 2023-05-09 08:48:37 +05:30
Kovid Goyal
a0cf4214df ... 2023-05-09 08:44:51 +05:30
Kovid Goyal
07203c67ca Add a note about why kitty terminfo does not have E3
See #6255
2023-05-09 08:28:54 +05:30
MithicSpirit
a36fe45181 Fix shade characters to follow unicode standard
- Light shade: 25% fill
- Medium shade: 50% fill
- Dark shade: 75% fill (implemented as inverse of light shade)
2023-05-08 18:46:24 -04:00
Kovid Goyal
061c444f20 ... 2023-05-08 16:36:47 +05:30
Kovid Goyal
a1d791083b ssh_kitten: Proper exit code for termination by SIGINT 2023-05-08 16:27:07 +05:30
Kovid Goyal
454acd4f5c ssh kitten: Fix a regression in 0.28.0 that caused interrupt during setup to not be handled gracefully
Fixes #6254
2023-05-08 16:18:05 +05:30
Kovid Goyal
71189aee9f Correct the type signature for callback 2023-05-08 16:03:27 +05:30
Kovid Goyal
23d7494e3a Fix #6251 2023-05-08 08:04:20 +05:30
Kovid Goyal
404f83a277 Add a link to awrit in the integrations page 2023-05-07 10:06:37 +05:30
Kovid Goyal
474244268c edit-in-kitty: Fix running edit-in-kitty with elevated privileges to edit a restricted file not working 2023-05-07 09:36:16 +05:30
Kovid Goyal
79cd6f38fe ... 2023-05-07 09:24:30 +05:30
Kovid Goyal
b7c3946f8f ... 2023-05-07 08:13:57 +05:30
Kovid Goyal
537cabca71 kitty +open: Ask for permission before executing script files that are not marked as executable
This prevents accidental execution of script files via MIME type
association from programs that unconditionally "open"
attachments/downloaded files via MIME type associations.
2023-05-07 08:11:39 +05:30
Kovid Goyal
79c19562b5 When publishing stash untracked files as well 2023-05-07 07:42:25 +05:30
Kovid Goyal
52afc79476 Fix re-using an image id for an animated image for a still image causing a crash
Fixes #6244
2023-05-06 09:37:55 +05:30
Kovid Goyal
877d8d7008 ... 2023-05-04 10:36:02 +05:30
Kovid Goyal
ce70320a62 ... 2023-05-04 10:26:18 +05:30
Kovid Goyal
3eb18a416a Entry point for parsing theme metadata 2023-05-04 10:14:58 +05:30
Kovid Goyal
8ba7258db9 Merge branch 'fix-bash-intergration-var-leak' of https://github.com/syyyr/kitty 2023-05-04 08:05:33 +05:30
Václav Kubernát
a502e94950 bash_integration: Do not leak variable i
With shell-integration, the user would see the last value of this
variable (as set by the shell-integration script.

Fix this by making it local.
2023-05-03 18:35:30 +02:00
Kovid Goyal
ea5634b3fd When parsing theme metadata ignore the name if it is the placeholder value from the template 2023-05-03 21:55:33 +05:30
Kovid Goyal
87943079fb Fix #6238 2023-05-03 21:40:42 +05:30
Kovid Goyal
a77b2b20c2 Fix #6230 2023-05-03 18:25:07 +05:30
Kovid Goyal
8f96395f74 diff kitten: Fix a regression in 0.28.0 that broke using relative paths as arguments to the kitten
Fixes #6235
2023-05-03 08:34:46 +05:30
Kovid Goyal
1fc4e53bea hints kitten: Fix a regression in 0.28.0 that broke using sub-groups in regexp captures
Fixes #6228
2023-04-30 21:16:24 +05:30
Kovid Goyal
f6ccd2ad2c Dont apply linear2srgb in borders with bg image as the cell shader doesnt apply it then either 2023-04-30 10:19:35 +05:30
Kovid Goyal
bc2af4acf9 Update changelog 2023-04-30 09:09:09 +05:30
Kovid Goyal
07dbfaa297 Fix #6224 2023-04-30 08:28:02 +05:30
Kovid Goyal
8020d5823b Fix #6225 2023-04-30 07:15:56 +05:30
Kovid Goyal
73f10aaf43 clipboard kitten: Fix a bug causing the last MIME type available on the clipboard not being recognized when pasting with arbitrary MIME types 2023-04-30 06:48:09 +05:30
Kovid Goyal
59c4d4a4bd DRYer 2023-04-28 20:30:15 +05:30
Kovid Goyal
ef999c9024 Also show stderr from tmux on failure 2023-04-28 20:16:37 +05:30
Kovid Goyal
514888a274 Use FindExe to find the tmux executable and return a nicer error message when running tmux fails 2023-04-28 20:11:15 +05:30
Kovid Goyal
09ebdcd809 Allow using set_tab_title without a pre-filled title. Fixes #6217 2023-04-28 10:14:25 +05:30
Kovid Goyal
8ebe4084cc Merge branch 'fix/6209-background_opacity_fringing' of https://github.com/m4rw3r/kitty 2023-04-28 09:28:09 +05:30
Martin Wernstål
9f41183628 fix: account for incorrect gamma-blending performed by compositor on transparent windows
Fixes #6209
2023-04-27 18:35:06 +02:00
Martin Wernstål
289957ef1c style: use ifdef to be consistent with the other cases 2023-04-27 18:34:00 +02:00
Martin Wernstål
920b350ac9 feat: more exact sRGB approximation 2023-04-27 18:27:46 +02:00
Kovid Goyal
d14655f644 Merge pull request #6216 from jaseg/master
docs/basic.rst: Add resize window shortcut
2023-04-27 16:25:03 +05:30
jaseg
29583411e6 docs/basic.rst: Add resize window shortcut 2023-04-27 12:48:05 +02:00
Kovid Goyal
019359b219 show_key kitten: In kitty mode show the actual bytes sent by the terminal rather than a re-encoding of the parsed key event
Also port the kitten to Go
2023-04-26 21:48:53 +05:30
Kovid Goyal
7b6d11fd1e Fix rendering of :doc: links with explicit titles in help text in the terminal 2023-04-26 16:46:20 +05:30
Kovid Goyal
bb33c66570 Fix #6213 2023-04-26 16:38:25 +05:30
Kovid Goyal
c2fc4eadc8 unicode_input: Only serialize favorites if no user config exists 2023-04-26 16:02:18 +05:30
Kovid Goyal
a7b4d07601 unicode_input kitten: Fix a regression in 0.28.0 that caused the order of recent and favorites entries to not be respected
Fixes #6214
2023-04-26 15:55:56 +05:30
Kovid Goyal
6a07435bb0 hints kitten: Fix regression causing editing of favorites to sometimes hang 2023-04-26 15:23:38 +05:30
Kovid Goyal
93a5107e79 Fix #6202 2023-04-21 21:35:59 +05:30
Kovid Goyal
6cc8e67580 Add example code to get screen size in Bash 2023-04-21 15:18:30 +05:30
Kovid Goyal
ccdb951716 Website: Fix optimization of social preview images 2023-04-21 14:19:36 +05:30
Kovid Goyal
07bcc5ba61 version 0.28.1 2023-04-21 13:10:01 +05:30
Kovid Goyal
6e90bc1996 ... 2023-04-20 21:48:07 +05:30
Kovid Goyal
6269f78ed2 Make it clearer that exclude operates only on directories 2023-04-18 09:22:34 +05:30
Kovid Goyal
dd0e1cce9e Bump versions of various go deps 2023-04-18 09:13:08 +05:30
Kovid Goyal
92e68a6e0c Fix #6193 2023-04-18 09:05:28 +05:30
Kovid Goyal
e4baca6d97 Emphasize that names of custom theme conf files must actual builtin theme names to override them 2023-04-17 08:47:26 +05:30
Kovid Goyal
a09464dee9 Fix a regression in the previous release that broke usage of custom themes
Fixes #6191
2023-04-17 08:45:46 +05:30
Kovid Goyal
b966013a2b Make Samefile interface a bit nicer for working with paths 2023-04-17 08:35:50 +05:30
Kovid Goyal
046fbb860b themes kitten: ignore custom theme files if they are stdout 2023-04-17 08:02:41 +05:30
Kovid Goyal
91700b3e42 Fix a bug in the Go code of the CSI key event parser
Fixes #6189
2023-04-16 15:31:56 +05:30
Kovid Goyal
b314303787 pep8 2023-04-16 15:31:03 +05:30
Kovid Goyal
176cfe771c Merge branch 'void_functions' of https://github.com/derekschrock/kitty 2023-04-16 11:06:35 +05:30
Derek Schrock
3b57acf03c More cases of #5477 functions with empty argument lists
Building on macOS 13.3.1 (22E261) clang 14.0.3 (clang-1403.0.22.14.1)
running to errors like #5477 where functions without argument lists at
least need void.

Looking for possible suspect functions via:

  git grep -E "^([A-Za-z_]+ )?[A-Za-z_]+\()" \*.c \*.m
2023-04-16 01:09:36 -04:00
Kovid Goyal
77e2572c5a Optimize social preview images before publishing website 2023-04-15 21:49:32 +05:30
Kovid Goyal
39eff0fe8c Fix a regression in the previous release that broke the remote file kitten
Fixes #6186
2023-04-15 21:04:30 +05:30
Kovid Goyal
12efff6d08 Fix #6185 2023-04-15 20:43:58 +05:30
Kovid Goyal
b81f457e9b version 0.28.0 2023-04-15 11:17:36 +05:30
Kovid Goyal
35ebd32f4c Merge branch 'fix-iplot-heredoc' of https://github.com/zaidhaan/kitty 2023-04-15 08:26:06 +05:30
Zaidhaan Hussain
63fff29621 Docs: fix heredoc issue in iplot snippet 2023-04-15 06:44:11 +08:00
Kovid Goyal
2f63f24e7d log system color scheme changes 2023-04-13 13:29:03 +05:30
Kovid Goyal
66801b6b28 GLFW API to track system color scheme dark/light
Implemented only on macOS and Wayland.
2023-04-13 13:16:33 +05:30
Kovid Goyal
1392d8cdb7 Merge branch 'master' of https://github.com/Nogesma/kitty 2023-04-11 19:36:15 +05:30
Mano Ségransan
0d2a27968b Add twitch-tui to the list of program that use the kitty graphics protocol 2023-04-11 15:25:32 +02:00
Kovid Goyal
912dcc0a6e Nicer error message when the version of go on the system is too old 2023-04-10 11:31:53 +05:30
Kovid Goyal
d4c5b8c899 Keyboard input: Fix text not being reported as unicode codepoints for multi-byte characters in the kitty keyboard protocol
Fixes #6167
2023-04-09 22:57:40 +05:30
Kovid Goyal
6aa2a7f99d ... 2023-04-09 09:08:34 +05:30
Kovid Goyal
f250a93715 Fix #6165 2023-04-09 08:48:56 +05:30
Kovid Goyal
373c05943f Allow specifying full layout specifications with options for goto_layout
Fixes #6163
2023-04-08 13:35:38 +05:30
Kovid Goyal
d9d2e31318 Another place where [:max_length] is used without checking 2023-04-07 18:08:38 +05:30
Kovid Goyal
3f943998c6 Note that the kitty keyboard protocol can be used in emacs 2023-04-07 08:22:33 +05:30
Kovid Goyal
1dd3490611 Fix #6160 2023-04-06 15:14:21 +05:30
Kovid Goyal
7803b07e7f Ignore leading and trailing space around values when parsing config lines 2023-04-06 10:45:34 +05:30
Kovid Goyal
feb5da70a8 Clean up changelog a bit 2023-04-05 21:12:06 +05:30
Kovid Goyal
c3246051d4 ... 2023-04-05 18:08:58 +05:30
Kovid Goyal
912aa17594 ... 2023-04-05 08:08:54 +05:30
Kovid Goyal
708267d229 Fix parsing of actions in map directives in Go 2023-04-05 07:55:18 +05:30
Kovid Goyal
3ee77a3a57 Fix #6154 2023-04-04 21:18:27 +05:30
Kovid Goyal
6dcc7ad0c7 Add a HOWTO for adjusting text_composition_strategy 2023-04-03 17:40:15 +05:30
Kovid Goyal
e07f2df8d0 Fix rendering of file added/removed lines 2023-04-03 11:07:51 +05:30
Kovid Goyal
bca67cde6f Fix default for syntax_aliases not being respected 2023-04-02 15:07:41 +05:30
Kovid Goyal
dfa41f01fd Fix panic caused by incorrectly constructed empty line
Also be more defensive in draw_screen() about rendering lines.
2023-04-02 10:18:23 +05:30
Kovid Goyal
dae49d788e ... 2023-04-01 10:51:32 +05:30
Kovid Goyal
1b67fd2ec0 Merge branch 'patch-1' of https://github.com/carlmjohnson/kitty 2023-04-01 07:29:48 +05:30
Carl Johnson
0afcf5a26b keyboard-protocol.rst: Add Helix 2023-03-31 14:07:09 -04:00
Kovid Goyal
e0cdc26e68 Fix placement of images in diff broken by new render layout 2023-03-30 11:21:28 +05:30
Kovid Goyal
e73282ceb0 Only send graphics protocol commands if there are actual images to diff 2023-03-30 11:06:44 +05:30
Kovid Goyal
9919767aef Remove unused code 2023-03-30 10:26:39 +05:30
Kovid Goyal
57ef0e29c0 Wait for keypress on panic in alternate screen kittens 2023-03-30 08:26:45 +05:30
Kovid Goyal
c767f7b57f ... 2023-03-30 07:58:00 +05:30
Kovid Goyal
fa094b2697 Update changelog 2023-03-30 07:24:12 +05:30
Kovid Goyal
3da2a3f60f Fix table alignment in docs 2023-03-29 21:36:31 +05:30
Kovid Goyal
266746c96e Implement the trim_whitespace option
Needed for help text formatting
2023-03-29 21:28:47 +05:30
Kovid Goyal
34526517de Allow passing multiple options to control how wrapping is done 2023-03-29 20:56:24 +05:30
Kovid Goyal
cb99fbd83c Dont remove leading and trailing spaces when wrapping
Without this we lose some spaces and also there was a case where the
line could end up longer than the specified width.
2023-03-29 20:47:31 +05:30
Kovid Goyal
7169a89591 Add shortcuts for copying to clipboard 2023-03-29 19:56:08 +05:30
Kovid Goyal
37edc728a9 Implement drag scrolling for the diff kitten 2023-03-29 17:14:13 +05:30
Kovid Goyal
05e10d8066 Also parse negative numbers in CSI 2023-03-29 15:12:22 +05:30
Kovid Goyal
aebfdaa69a Refactor diff mouse selection to use new render layout 2023-03-29 14:32:36 +05:30
Kovid Goyal
468168b9de Refactor diff search to use new render layout 2023-03-29 13:22:34 +05:30
Kovid Goyal
3dbb830a0e Refactor diff rendering
Dont store full rendered lines, instead fill them up at actual draw
time. Makes implementing mouse selection and searching more robust.
2023-03-29 11:55:03 +05:30
Kovid Goyal
e095a2ab43 Fix #6142 2023-03-28 21:06:39 +05:30
Kovid Goyal
7ed7e82637 Use a filler char other than space 2023-03-28 18:01:04 +05:30
Kovid Goyal
67a9def013 Get copy to primary selection working 2023-03-28 17:15:28 +05:30
Kovid Goyal
676f576ace Adjust the bounds of the mouse selection taking starting half cell into account 2023-03-28 15:12:41 +05:30
Kovid Goyal
8867818dfe DRYer 2023-03-28 11:55:08 +05:30
Kovid Goyal
00d4841304 Make the mouse selection code re-useable 2023-03-28 11:48:22 +05:30
Kovid Goyal
277dea647e More work on mouse selection 2023-03-28 10:29:45 +05:30
Kovid Goyal
45c1e36de9 More work on mouse selection 2023-03-28 08:10:29 +05:30
Kovid Goyal
40ca46d8d8 Fix default generation for nullable colors 2023-03-28 08:09:37 +05:30
Kovid Goyal
0f59a2d543 Fix DECCARA in non-rectangular mode for a single line 2023-03-28 08:02:44 +05:30
Kovid Goyal
d19f28f2b4 More work on mouse selection in the diff kitten 2023-03-27 21:23:31 +05:30
Kovid Goyal
94db6053d5 Turn off atomic update during direct transmission 2023-03-27 20:54:03 +05:30
Kovid Goyal
80204c6056 Use join_half_lines in a few more places 2023-03-27 18:01:53 +05:30
Kovid Goyal
d33b83e6ea More work on mouse selections 2023-03-27 17:56:00 +05:30
Kovid Goyal
a22933afbc DRYer 2023-03-27 17:19:13 +05:30
Kovid Goyal
840caf5fd5 Start work on mouse handling in diff kitten 2023-03-27 17:06:56 +05:30
Kovid Goyal
6dfe823dfb ... 2023-03-27 17:05:57 +05:30
Kovid Goyal
71580a2a93 Fix wheel event detection 2023-03-27 16:35:29 +05:30
Kovid Goyal
e85473cee6 Linux Wayland: Fix animated images not being animated continuously
Fixes #6126
2023-03-27 13:43:37 +05:30
Kovid Goyal
6504dd15c1 Update folder README 2023-03-27 13:20:10 +05:30
Kovid Goyal
ff55121094 Move the kittens Go code into the kittens folder 2023-03-27 13:06:02 +05:30
Kovid Goyal
3f9579d61d Port the removed walk test to Go 2023-03-27 12:34:31 +05:30
Kovid Goyal
a2aadd4756 Remove python diff tests as no longer needed 2023-03-27 11:54:34 +05:30
Kovid Goyal
70fd89caac ... 2023-03-27 11:49:11 +05:30
Kovid Goyal
d30091034a Remove the python diff kitten 2023-03-27 11:46:22 +05:30
Kovid Goyal
fb9d95038d Free images in kitty when quitting diff kitten 2023-03-27 11:13:04 +05:30
Kovid Goyal
a3f1d3e132 Get image display working 2023-03-27 11:00:21 +05:30
Kovid Goyal
9cc54978e6 Fix margin formatting for binary lines 2023-03-27 08:23:10 +05:30
Kovid Goyal
d66da811db More work on getting images to display in diff 2023-03-27 07:53:57 +05:30
Kovid Goyal
cece795b16 More work on image support for diff 2023-03-27 07:53:57 +05:30
Kovid Goyal
9eedcc1d2a Better struct name 2023-03-27 07:53:57 +05:30
Kovid Goyal
508a61bd1c More work on diffing images 2023-03-27 07:53:57 +05:30
Kovid Goyal
c745961f47 Nicer error messages for failure to load with Magick 2023-03-27 07:53:57 +05:30
Kovid Goyal
be886f9bf9 Make code for loading images with ImageMagick re-useable 2023-03-27 07:53:57 +05:30
Kovid Goyal
404a775f4b Start work on image support for new diff kitten 2023-03-27 07:53:57 +05:30
Kovid Goyal
18445e20ff ... 2023-03-27 07:53:57 +05:30
Kovid Goyal
7b16132b75 Fix searching in full title lines 2023-03-27 07:53:57 +05:30
Kovid Goyal
0a8fc3f17c ... 2023-03-27 07:53:57 +05:30
Kovid Goyal
d57e47349b Make searches case insensitive 2023-03-27 07:53:57 +05:30
Kovid Goyal
ccf1dfabbc Fix highlighting of center changes 2023-03-27 07:53:56 +05:30
Kovid Goyal
de9edb6ff5 Manually specify the closing SGR for a span 2023-03-27 07:53:56 +05:30
Kovid Goyal
6590be84a2 ... 2023-03-27 07:53:56 +05:30
Kovid Goyal
ccfae228b9 Avoid panics while rendering 2023-03-27 07:53:56 +05:30
Kovid Goyal
3236a42cb7 ... 2023-03-27 07:53:56 +05:30
Kovid Goyal
e774deaef1 Fix tabs and carriage returns being incorrectly sanitized 2023-03-27 07:53:56 +05:30
Kovid Goyal
b5c2d85837 Fix diffing dirs 2023-03-27 07:53:56 +05:30
Kovid Goyal
2d18529d05 Show a message for identical files 2023-03-27 07:53:56 +05:30
Kovid Goyal
2ac170c1b1 Allowing using the anchored diff from the Go stdlib as the diff implementation 2023-03-27 07:53:56 +05:30
Kovid Goyal
9c188096d0 Prevent panics incase highlighting leads to different number of lines 2023-03-27 07:53:56 +05:30
Kovid Goyal
09c6a68804 Fix syntax highlighting of multiline tokens 2023-03-27 07:53:56 +05:30
Kovid Goyal
4c9efb6ff2 Fix bold/dim handling when wrapping 2023-03-27 07:53:56 +05:30
Kovid Goyal
4bc9cf84a3 Micro-optimization 2023-03-27 07:53:56 +05:30
Kovid Goyal
14b58ba015 Fix overrides not being parsed correctly 2023-03-27 07:53:56 +05:30
Kovid Goyal
29a896f9d8 ... 2023-03-27 07:53:56 +05:30
Kovid Goyal
f8c83519fe Reset styles after half lines 2023-03-27 07:53:56 +05:30
Kovid Goyal
91eaa89b3e Fix various off-by-ones in the search code 2023-03-27 07:53:55 +05:30
Kovid Goyal
1926db8ee8 Correct cursor shape when inputting search query 2023-03-27 07:53:55 +05:30
Kovid Goyal
c19c614d9e DRYer 2023-03-27 07:53:55 +05:30
Kovid Goyal
f7f6df675f Implement searching the diff 2023-03-27 07:53:55 +05:30
Kovid Goyal
88bd3ee9ca New SGR codes to turn off bold/dim independently
Allows for robust patching of formatting into already formatted
text. Without this it is not possible to turn off bold without
affecting existing dim and vice versa.
2023-03-27 07:53:55 +05:30
Kovid Goyal
e46a7c39c3 Fix failing test 2023-03-27 07:53:55 +05:30
Kovid Goyal
5086c62a81 Implement changing of context lines 2023-03-27 07:53:55 +05:30
Kovid Goyal
15b0dbb71c Code to insert SGR formatting into already formatted strings 2023-03-27 07:53:55 +05:30
Kovid Goyal
2a185575b2 Implement drawing of status bar 2023-03-27 07:53:55 +05:30
Kovid Goyal
cf5ea96126 Ensure scroll position is correct after resize 2023-03-27 07:53:55 +05:30
Kovid Goyal
e2edacb629 DRYer 2023-03-27 07:53:55 +05:30
Kovid Goyal
c2e549b79c Implement syntax highlighting 2023-03-27 07:53:55 +05:30
Kovid Goyal
4d61ad87b3 Implement jumping to fixed locations 2023-03-27 07:53:55 +05:30
Kovid Goyal
2905744dad Implement scrolling by lines 2023-03-27 07:53:55 +05:30
Kovid Goyal
ebcf85428c More work on porting diff kitten 2023-03-27 07:53:55 +05:30
Kovid Goyal
425ab4f6d8 Start implementing shortcut handling 2023-03-27 07:53:55 +05:30
Kovid Goyal
924cd4cadd Do not add a trailing newline when wrapping 2023-03-27 07:53:55 +05:30
Kovid Goyal
e42b4fd9a6 Decrease allocs when wrapping 2023-03-27 07:53:54 +05:30
Kovid Goyal
18b58c5cf9 Ensure wrapping never results in lines longer than the specified word 2023-03-27 07:53:54 +05:30
Kovid Goyal
6c503985ce Dont run gen-config for diff kitten 2023-03-27 07:53:54 +05:30
Kovid Goyal
648925e83a More work on porting diff kitten 2023-03-27 07:53:54 +05:30
Kovid Goyal
1c7d1094d4 More work on porting diff kitten 2023-03-27 07:53:54 +05:30
Kovid Goyal
4f5fc1000d Allow multiple specifications of kwds,ext,mime in completion specs 2023-03-27 07:53:54 +05:30
Kovid Goyal
41ea5f0c63 Ensure unique image id in single session 2023-03-27 07:53:54 +05:30
Kovid Goyal
ef7f13d893 title lines are now displayed 2023-03-27 07:53:54 +05:30
Kovid Goyal
5d8b5ab720 More work on porting diff kitten 2023-03-27 07:53:54 +05:30
Kovid Goyal
ee82cb5a52 More work on porting diff kitten 2023-03-27 07:53:54 +05:30
Kovid Goyal
e4d936b5ed More work on porting the diff kitten 2023-03-27 07:53:54 +05:30
Kovid Goyal
293c0ab845 More work on porting the diff kitten 2023-03-27 07:53:54 +05:30
Kovid Goyal
bf1f0c00f4 Port full MIME type guessing to Go 2023-03-27 07:53:54 +05:30
Kovid Goyal
3c550bcd28 More work on porting diff kitten 2023-03-27 07:53:54 +05:30
Kovid Goyal
d208670172 Abstract typical config file loading with path and cli overrides 2023-03-27 07:53:54 +05:30
Kovid Goyal
5329546f21 Implement parsing of map 2023-03-27 07:53:54 +05:30
Kovid Goyal
e4fbcb707f Add lua mime type as a known text mime type 2023-03-27 07:53:54 +05:30
Kovid Goyal
44ff6bd1dd Start work on porting diff kitten 2023-03-27 07:53:53 +05:30
Kovid Goyal
cb03168957 Merge branch 'patch-1' of https://github.com/piorrro33/kitty 2023-03-27 07:51:56 +05:30
Pierre GRASSER
ce7741c9a8 bootstrap-utils.sh: make grep silent
Prevents a print of "no-rc".
2023-03-26 20:31:37 +02:00
Kovid Goyal
5ff1dadf0d Allow using --session=none to override startup_session
Fixes #6131
2023-03-25 10:44:34 +05:30
Kovid Goyal
f046884f23 Allow stopping of URL detection at newlines via url_excluded_characters
Fixes #6122
2023-03-21 08:04:42 +05:30
Kovid Goyal
856fddec3c Tall/fat layout: When changing the number of full size windows, reset the main axis biases. Fixes #6123 2023-03-20 22:36:18 +05:30
Kovid Goyal
f61ddd62d1 Allow specifying an optional integer argument for next_layout. Fixes #6121 2023-03-20 19:49:37 +05:30
Kovid Goyal
1bed92bed1 Cleanup previous PR 2023-03-20 07:42:10 +05:30
Kovid Goyal
122ba17df6 Merge branch 'patch/getpwuid' of https://github.com/usertam/kitty 2023-03-20 07:37:27 +05:30
usertam
08fa7f19f7 kitty_tests, shell-integration: rework getpwuid() exceptions suppression 2023-03-20 03:31:23 +08:00
Kovid Goyal
5f9b520ca0 Bash integration: Dont fail if the user enabled failglob in their bashrc
BASH is by *far* the most buggy and least featureful of the three shells.
Fix #6119
2023-03-19 21:05:29 +05:30
Kovid Goyal
47d7e812a3 Cleanup previous PR 2023-03-19 17:20:09 +05:30
Kovid Goyal
9a8e92fade Merge branch 'patch/getpwuid' of https://github.com/usertam/kitty 2023-03-19 17:18:29 +05:30
Samuel Tam
8a7491722f shell-integration/ssh/bootstrap.py: suppress getpwuid() exceptions
Reference: 89e5ae28bb
2023-03-19 19:28:24 +08:00
Samuel Tam
31319f0b65 kitty_tests/ssh.py: skip login shell detection if getpwuid() fails 2023-03-19 18:45:47 +08:00
Kovid Goyal
fda2646dd3 Cleanup previous PR 2023-03-19 10:37:37 +05:30
Kovid Goyal
14dcf38e51 Merge branch 'xdg-sound-theme-option' of https://github.com/serebit/kitty 2023-03-19 10:20:06 +05:30
Kovid Goyal
e633677749 Run make debug before building static binaries
Ensures all deps are built in case make clean was run.
2023-03-19 09:51:57 +05:30
Campbell Jones
55fd885491 Add option to set XDG sound theme on Linux 2023-03-18 16:38:29 -04:00
Kovid Goyal
073b47a236 Revert #6114
Frozen kitty builds dont have python files (they are loaded from a
single mmmaped archive), so the test will prevent any
kittens from being found.

Have make clean remove leftover kittens directories
2023-03-18 15:26:33 +05:30
Kovid Goyal
bf773351ed DRYer 2023-03-17 11:00:00 +05:30
Kovid Goyal
509a45b579 Dont request release events for most kittens
They are not needed and there is always a small risk that a release
event could be delivered after the kitten has stopped reading from the
tty, thereby leaking into the environment.
2023-03-17 10:50:10 +05:30
Kovid Goyal
de74b93b16 Update icon link 2023-03-17 09:19:11 +05:30
Kovid Goyal
e4611d0c81 ... 2023-03-17 09:02:58 +05:30
Kovid Goyal
b0a4b932ad ... 2023-03-17 08:59:45 +05:30
Kovid Goyal
f7b735d5ab ssh kitten: Fix failure when remote system has no base64 but does have openssl 2023-03-17 08:36:52 +05:30
Kovid Goyal
c8fe0712e6 Merge branch 'ccm/fix-uname-arch-freebsd' of https://github.com/chazmcgarvey/kitty 2023-03-16 07:53:40 +05:30
Charles McGarvey
4b818244be Add "amd64" as a potential value for "uname -m"
This accommodates FreeBSD and perhaps others.
2023-03-15 19:05:30 -06:00
Kovid Goyal
99463ef492 Merge branch 'fix-build' of https://github.com/page-down/kitty 2023-03-16 06:12:30 +05:30
pagedown
97ef09b633 Fix empty folders being considered as kitten
When pulling a git commit that contains delete folder actions, the local
folders will not be deleted.
2023-03-16 08:20:05 +08:00
Kovid Goyal
e2fda5d1c4 ... 2023-03-15 15:32:04 +05:30
Kovid Goyal
da38cb3254 Add support for more option types to Go conf file parsing 2023-03-15 15:17:38 +05:30
Kovid Goyal
3803d7e3c2 Use maps package for generic keys/values functions 2023-03-14 22:49:40 +05:30
Kovid Goyal
7ce83e7fd0 Use the generic contains/index from slices instead of our custom one 2023-03-14 22:40:20 +05:30
Kovid Goyal
5520a75bba Dont rely on filesystem mtimes for test as they can be flaky 2023-03-14 21:13:14 +05:30
Kovid Goyal
e539035639 more useful test failure messages 2023-03-14 21:06:57 +05:30
Kovid Goyal
290b868193 forgot to close zip file 2023-03-14 20:42:36 +05:30
Kovid Goyal
c19ac531cf Fix some failing tests 2023-03-14 20:40:12 +05:30
Kovid Goyal
f6d66b2336 ... 2023-03-14 20:35:31 +05:30
Kovid Goyal
9443b0e361 Remove themes python code 2023-03-14 20:28:45 +05:30
Kovid Goyal
0805330b77 Finish port of themes kitten to Go 2023-03-14 20:24:21 +05:30
Kovid Goyal
0c20a4d980 Fix sort with key implementations 2023-03-14 12:54:35 +05:30
Kovid Goyal
21954937fb More work on porting themes 2023-03-14 12:29:44 +05:30
Kovid Goyal
c4731771ac Make style cache thread safe 2023-03-14 12:29:44 +05:30
Kovid Goyal
ffb3b073d7 Convenient loop API to print styled strings 2023-03-14 12:29:44 +05:30
Kovid Goyal
6794ec1de7 Wire up the new subseq match code 2023-03-14 12:29:44 +05:30
Kovid Goyal
29dd2438c9 Port the subseq matcher to Go 2023-03-14 12:29:44 +05:30
Kovid Goyal
b088ab91cf Make code to convert rune offsets to byte offsets re-useable 2023-03-14 12:29:44 +05:30
Kovid Goyal
dd783c842f More work on porting themes UI to Go 2023-03-14 12:29:44 +05:30
Kovid Goyal
f9b0b54ee5 Start work on porting themes kitten to Go 2023-03-14 12:29:44 +05:30
Kovid Goyal
3741d3d1be hints: fix select by word broken while porting to Go 2023-03-14 12:27:33 +05:30
Kovid Goyal
c0c0fd8ac1 Merge branch 'fix-typo' of https://github.com/page-down/kitty 2023-03-14 12:20:35 +05:30
pagedown
2416122647 ... 2023-03-14 14:30:11 +08:00
Kovid Goyal
626637c2ba Merge branch 'icons' of https://github.com/eccentric-j/kitty 2023-03-12 12:09:00 +05:30
Jay
5d90544c9d Updated faq with optimized alt icon preview urls 2023-03-12 01:27:34 -05:00
Kovid Goyal
dad9cfdf38 Merge branch 'icons' of https://github.com/eccentric-j/kitty 2023-03-12 11:03:31 +05:30
Jay
bea6fdc72e Added new icons 2023-03-11 19:06:01 -05:00
Kovid Goyal
74c5692b78 Default permission for atomicupdate should be 0644 2023-03-11 10:04:43 +05:30
Kovid Goyal
83f25cd361 Fix #6105 2023-03-11 07:21:43 +05:30
Kovid Goyal
7acc6bdeb8 Move splitlines_like_git to a more appropriate home 2023-03-10 17:26:06 +05:30
Kovid Goyal
ffa8c1c498 Add debug print for focus change events 2023-03-10 17:09:11 +05:30
Kovid Goyal
34cbf5ceac Get rid of prewarming
Don't need it anymore since all major UI kittens are ported to Go
and so don't have startup latency.
2023-03-10 13:22:10 +05:30
Kovid Goyal
48e7ebb838 make gofmt happy 2023-03-10 13:03:51 +05:30
Kovid Goyal
7f6ed72684 Nicer error message when custom processor produces invalid marks 2023-03-10 12:51:32 +05:30
Kovid Goyal
e78c398243 Fix offsets incorrect for non-ASCII chars when using custom processing
python gives us offsets in unicode characters. Go uses offsets in utf8
bytes. Translate.
2023-03-10 12:41:56 +05:30
Kovid Goyal
b76b0c61ed Port custom processor for hints 2023-03-10 10:45:37 +05:30
Kovid Goyal
69916ca4e8 Remove python implementation of hints 2023-03-10 07:16:25 +05:30
Kovid Goyal
2e1eebd998 More work on porting hints 2023-03-10 06:58:10 +05:30
Kovid Goyal
5b3f5dd02d Port all remaining hints matching tests 2023-03-09 20:53:46 +05:30
Kovid Goyal
0e5ed29d83 Fix generation of url regex for Go 2023-03-09 19:00:56 +05:30
Kovid Goyal
2aa9187428 More work on porting hints 2023-03-09 19:00:56 +05:30
Kovid Goyal
09ceb3c0be Start work on porting hints kitten to Go 2023-03-09 19:00:56 +05:30
Kovid Goyal
bcd3802d3e Merge branch 'refactor' of https://github.com/page-down/kitty 2023-03-09 19:00:29 +05:30
pagedown
6c182a00a8 fish integration: Remove newlines from the data in __ksi_transmit_data
Moving the operation of removing whitespace characters to the function
that transmits the data. This matches the implementation in zsh and bash
integration scripts.
2023-03-09 21:10:08 +08:00
Kovid Goyal
88443ef8a5 icat: allow specifying image ids 2023-03-09 10:17:53 +05:30
Kovid Goyal
a56f111f98 Add a comment explaining why we rescan even when the line is not dirty 2023-03-09 10:09:08 +05:30
Kovid Goyal
5058960a0e Merge branch 'pr-redraw-on-upload' of https://github.com/sergei-grechanik/kitty 2023-03-09 10:08:16 +05:30
Sergei Grechanik
87ef5e4084 Always rerender unicode placeholders in the scrollback 2023-03-08 19:23:54 -08:00
Kovid Goyal
31d8a98a45 Fix kitty icat broken during the port to Go 2023-03-08 20:47:17 +05:30
Kovid Goyal
f42090766a Use the new string scanner everywhere 2023-03-08 13:31:27 +05:30
Kovid Goyal
b8ce441453 A new string scanner thats faster than bufio.Scanner and has zero-allocation 2023-03-08 13:24:20 +05:30
Kovid Goyal
ebc1a0f0aa Don't need to save/restore private mode values in icat when output unicode paceholder
Was originally there in case we turned off line wrapping. But didnt end
up doing that.
2023-03-08 10:33:43 +05:30
Sergei Grechanik
0be83c1bb6 Redraw old unicode placeholders when a virtual placement is added 2023-03-07 20:11:56 -08:00
Kovid Goyal
d6a073945d Count LoC in tests and docs as well 2023-03-07 18:00:46 +05:30
Kovid Goyal
cd332eb2d5 DRYer 2023-03-07 17:15:21 +05:30
Kovid Goyal
f157882856 Finish porting of ask kitten to Go 2023-03-07 17:06:00 +05:30
Kovid Goyal
018bf46ddb kitty @ shell: Integrate completions from history 2023-03-07 17:01:21 +05:30
Kovid Goyal
ef6693a239 Dont insert empty spaces when no completions are found 2023-03-07 17:00:40 +05:30
Kovid Goyal
d7b0aa48c9 Dont display empty match groups 2023-03-07 16:53:52 +05:30
Kovid Goyal
ea1842407d Auto accept completion when only a single candidate is present 2023-03-07 16:48:53 +05:30
Kovid Goyal
0e73c01093 readline: Automatically do word completion based on history 2023-03-07 16:44:02 +05:30
Kovid Goyal
4cef83ffd0 show message even for password asks 2023-03-07 14:03:39 +05:30
Kovid Goyal
f4b0fbc61e Fix invocation of wrapped UI kittens 2023-03-07 13:55:45 +05:30
Kovid Goyal
0da998ac53 Implement reading of password 2023-03-07 13:55:45 +05:30
Kovid Goyal
bb22990af9 ... 2023-03-07 13:55:45 +05:30
Kovid Goyal
7ad5dc6a6f Fix mouse CSI parsing 2023-03-07 13:55:44 +05:30
Kovid Goyal
0aa55fb755 Start work on porting the ask kitten 2023-03-07 13:55:44 +05:30
Kovid Goyal
672ecde68b X11: Fix a crash if the X server requests clipboard data after we have relinquished the clipboard
Fixes #5650
2023-03-07 13:53:07 +05:30
Kovid Goyal
ecfebcd6af ... 2023-03-07 12:42:25 +05:30
Kovid Goyal
cd4b19918c make the latest mypy happy 2023-03-07 12:02:08 +05:30
Kovid Goyal
2bbf9a4e9b Wayland KDE: Fix selecting in un-focused OS window not working correctly
Every day, in every way, I fall deeper and deeper in love with Yayland!

Fixes #6095
2023-03-07 11:29:57 +05:30
Kovid Goyal
e043fef257 Synthesize click events in the loop 2023-03-07 07:57:14 +05:30
Kovid Goyal
5c87d7f84f Cleanup ring buffer implementation 2023-03-07 07:43:53 +05:30
Kovid Goyal
37cebbc817 Implement decoding of mouse events in Go 2023-03-07 07:20:46 +05:30
Kovid Goyal
16c7681c7c diff kitten: Speedup patch parsing by working with bytes rather than unicode
Also change the line split algorithm to only split on \n, \r and \r\n.
This is hopefully closer to what git/diff generate in their patch files.
I cant find any documentation specifying this however.

Fixes #6052
Fixes #6092
2023-03-06 09:55:55 +05:30
Kovid Goyal
99b23c5c66 ... 2023-03-05 14:25:19 +05:30
Kovid Goyal
db972f3442 Cleanup parsing of single char options 2023-03-05 14:22:53 +05:30
Kovid Goyal
23d2293296 More tests for rg arg parsing 2023-03-05 14:09:04 +05:30
Kovid Goyal
716a048e6c ... 2023-03-05 14:02:19 +05:30
Kovid Goyal
a252ff1c7b Merge branch 'hold-kp-enter' of https://github.com/page-down/kitty 2023-03-05 14:00:39 +05:30
pagedown
2ee30302fe hold: Allow pressing the numeric keypad enter key to exit 2023-03-05 16:18:29 +08:00
Kovid Goyal
6660071d3a Port the hyperlinked_grep kitten to Go 2023-03-05 13:41:57 +05:30
Kovid Goyal
a0d30f4dd8 DRYer 2023-03-05 13:41:36 +05:30
Kovid Goyal
c88a171b28 Map should use same order of arguments as pythons map 2023-03-05 12:19:03 +05:30
Kovid Goyal
e6d53a1921 Merge branch 'nerd-fonts' of https://github.com/page-down/kitty 2023-03-05 08:42:26 +05:30
Kovid Goyal
0e4b374b7b Merge branch 'fix-which' of https://github.com/page-down/kitty 2023-03-05 08:41:04 +05:30
pagedown
0147ef467b Import the missing which 2023-03-05 08:51:29 +08:00
pagedown
e9f5806dcd Update to Nerd Fonts 2.3.3 2023-03-04 23:23:52 +08:00
Kovid Goyal
3cfb5441fc Merge branch 'ime' of https://github.com/page-down/kitty 2023-03-04 13:48:32 +05:30
pagedown
823db08712 IME: Right align overlay when typing at the edge of the screen
When the cursor is at the right edge of the screen, push the overlay to
the left to display the pre-edit text just entered.
2023-03-04 16:11:29 +08:00
Kovid Goyal
a2887bb9e0 get rid of utils.Cut since we can now rely on strings.Cut instead 2023-03-04 13:37:55 +05:30
Kovid Goyal
defac0c061 Implement automatic tmux passthrough for icat 2023-03-04 13:01:23 +05:30
Kovid Goyal
8bd814444c Fix active TMUX session detection 2023-03-04 12:50:07 +05:30
Kovid Goyal
1218a152bf Implement unicode placeholders in icat 2023-03-04 11:54:22 +05:30
Kovid Goyal
ed8a88e009 Add new unicode placeholder and tmux passthrough options to icat 2023-03-03 22:06:35 +05:30
Kovid Goyal
5b160ea599 Use Once for CachedHostname 2023-03-03 15:20:35 +05:30
Kovid Goyal
e6662e11c3 Dont change the tmux allow-passthrough mode if it is already set 2023-03-03 15:06:49 +05:30
Kovid Goyal
1bf911a81b Generate the rowcol diacrticis for Go as well 2023-03-03 14:39:38 +05:30
Kovid Goyal
a7ed47575e Improve documentation for Unicode placeholders 2023-03-03 12:45:52 +05:30
Kovid Goyal
8add28de96 Merge branch 'pr-unicode-placeholders' of https://github.com/sergei-grechanik/kitty 2023-03-03 10:55:02 +05:30
Kovid Goyal
900111572e Linux binary installer: Proceed via a staged tmpdir
Now installation on Linux and macOS is similar. installer is first
downloaded, then extracted, then copied to installation location.
2023-03-02 14:13:34 +05:30
Kovid Goyal
3f293db632 ... 2023-03-02 13:34:42 +05:30
Kovid Goyal
eab3b2a689 Reduce the number of spurious focus events
1) When performing operations known to cause lots of focus changes such
   as creating new sessions/windows or moving windows, forcibly ignore focus events

2) Track window focus state and dont report focus events when the state
   is unchanged by a focus_changed() call

This allows focus specific code to be restricted to just 2-3 places
instead of having to track every possible function that could change
focus.

Fixes #6083
2023-03-02 13:30:26 +05:30
Kovid Goyal
719fe9ea04 Fix deletion of assets from nightly release on GitHub
The derived asset URL was wrong. Instead use the URL supplied in the
JSON asset description.
2023-03-02 11:28:05 +05:30
Kovid Goyal
294d36f2d3 Merge branch 'hints-kitten' of https://github.com/page-down/kitty 2023-03-02 08:04:06 +05:30
pagedown
4c9d90efbb hints kitten: Perform copy action with --program when matching linenum 2023-03-02 10:30:17 +08:00
Kovid Goyal
fccd776732 Fix overlay windows not inheriting the per-window padding and margin settings of their parents
Fixes #6063
2023-03-01 21:45:17 +05:30
Kovid Goyal
66804dafe8 Fix a regression that broke drawing of images below non-default cell backgrounds
Fixes #6061
2023-03-01 21:13:48 +05:30
Kovid Goyal
6d73306198 Fix for GitHub releases API not returning all assets when querying the assets URL due to pagination
Use the assets list from the release result when available as it is
not paginated. Otherwise request 64 items per page which is more than
enough for our 30 odd assets
2023-03-01 21:02:25 +05:30
Kovid Goyal
eb6d777790 ... 2023-03-01 20:34:09 +05:30
Kovid Goyal
81f8ed6b45 Use @ rather than # for named buffers prefix char
Matches existing use of @ for clipboard. Also @ doesnt need to be quoted
in most shells.
2023-03-01 19:54:03 +05:30
Kovid Goyal
8ad39332c9 Merge branch 'hints-kitten-copy-to-buffer' of https://github.com/page-down/kitty 2023-03-01 19:49:52 +05:30
Kovid Goyal
c94401729a Add protocol docs for async and streaming requests 2023-03-01 19:46:29 +05:30
pagedown
854529c443 hints kitten: Allow copying matches to named buffers 2023-03-01 22:10:24 +08:00
Kovid Goyal
bd32019b91 Fix error display when remote control mapping fails 2023-03-01 17:45:57 +05:30
Kovid Goyal
004aaf3291 Fix setting background image and logo via remote control key mapping not working 2023-03-01 17:42:55 +05:30
Kovid Goyal
22f6728fed Do not buffer PNG data to disk when setting window background or logo images 2023-03-01 17:34:38 +05:30
Kovid Goyal
f0aacbd437 Remove unused code 2023-03-01 16:54:06 +05:30
Kovid Goyal
1bf180f354 Allow loading window background images from memory 2023-03-01 16:11:38 +05:30
Kovid Goyal
bf79940a13 When reloading config also reload all GPU data
Fixes some config options such as text_composition_strategy not being
reloaded.
2023-03-01 11:14:03 +05:30
Kovid Goyal
0616f9e077 Fix background image not changing when reloading config 2023-03-01 10:50:33 +05:30
Kovid Goyal
cbf3b5860b Merge branch 'png' of https://github.com/page-down/kitty 2023-03-01 10:21:52 +05:30
pagedown
3d50c1ea5a Fix cursor misalignment after displaying detailed traceback 2023-03-01 12:04:04 +08:00
pagedown
08c0321fc4 Don't use the deprecated imghdr module 2023-03-01 12:03:56 +08:00
Kovid Goyal
cd8bb462c3 Add KITTY_VCS_REV for release builds as well 2023-02-28 19:41:28 +05:30
Kovid Goyal
5b46d990a2 Add Read/Write to the MMap interface 2023-02-28 19:01:15 +05:30
Kovid Goyal
944e036611 DRYer 2023-02-28 15:48:04 +05:30
Kovid Goyal
1b2fe90ed1 Fix askpass.go on shm_syscall based systems 2023-02-28 14:11:27 +05:30
Kovid Goyal
ba1ce996bb Fix WriteWithSize() on shm_syscall 2023-02-28 13:50:06 +05:30
Kovid Goyal
327cefbfda Make test more robust 2023-02-28 13:44:29 +05:30
Kovid Goyal
ce12fd3515 Fix ReadWithSizeAndUnlink on systems that have syscall based mmap 2023-02-28 13:44:09 +05:30
Kovid Goyal
4d3ce47813 ... 2023-02-28 13:19:51 +05:30
Kovid Goyal
8729717229 Dont create SHM files in the bootstrap limit and related tests 2023-02-28 13:16:00 +05:30
Kovid Goyal
935a36f5a8 Allow specifying VCS revision on the build command line 2023-02-28 13:05:43 +05:30
Kovid Goyal
1ddb1dc5e1 ... 2023-02-28 13:00:19 +05:30
Kovid Goyal
9135ba138e Merge branch 'ssh' 2023-02-28 12:45:51 +05:30
Kovid Goyal
00b3437a05 Remove python implementation of SSH kitten 2023-02-28 12:42:30 +05:30
Kovid Goyal
3558d1c274 Finish porting support for color schemes to SSH kitten 2023-02-28 12:08:55 +05:30
Kovid Goyal
8302e5d74b Merge branch 'james/typo' of https://github.com/jamesbvaughan/kitty 2023-02-28 08:13:23 +05:30
James Vaughan
a5a0d5acb9 Fix typo in overview doc 2023-02-27 16:53:44 -08:00
Kovid Goyal
c877b2a5cb Code to dump basic colors from a theme as escape codes 2023-02-27 08:02:22 +05:30
Kovid Goyal
c1791c8d2b Function to load theme code 2023-02-26 22:09:07 +05:30
Kovid Goyal
22150e13fd Add tests for cache file downloading 2023-02-26 21:56:03 +05:30
Kovid Goyal
7ce64fcde0 Support include when loading themes from dirs 2023-02-26 21:16:29 +05:30
Kovid Goyal
0b09d18b36 Port theme loading code to Go 2023-02-26 20:40:59 +05:30
Kovid Goyal
4eea2fd4fc Port code to download themeball to Go 2023-02-26 15:21:49 +05:30
Kovid Goyal
c113ad6f56 Code to parse ISO8601 timestamps at least semi-robustly 2023-02-26 13:32:35 +05:30
Kovid Goyal
64cb9c9542 More work on porting ssh kitten 2023-02-26 11:26:28 +05:30
Kovid Goyal
4a5c6ad47f Functions to punch DCS escapes through tmux 2023-02-26 11:11:42 +05:30
Kovid Goyal
6de77ce987 Clean up exclude pattern handling 2023-02-26 09:12:12 +05:30
Kovid Goyal
5cc3d3cbfe Fix remaining failing tests 2023-02-26 08:01:04 +05:30
Kovid Goyal
dc938cf3dd More test fixes 2023-02-26 08:01:04 +05:30
Kovid Goyal
22ea33182a Fix various test failures 2023-02-26 08:01:04 +05:30
Kovid Goyal
3f417b26b2 Wire up the new ssh kitten into the python ssh kitten tests 2023-02-26 08:01:04 +05:30
Kovid Goyal
e4002b5691 Switch to a more capable glob implementation that supports ** 2023-02-26 08:01:04 +05:30
Kovid Goyal
77c04107f3 Add test for tarfile exclusion 2023-02-26 08:01:03 +05:30
Kovid Goyal
a5cf66b334 Stable constants generation 2023-02-26 08:01:03 +05:30
Kovid Goyal
525caff938 Move get_connection_data to utils module as it is not needed for the actual kitten 2023-02-26 08:01:03 +05:30
Kovid Goyal
e02ba7f389 Port bootstrap script length limit 2023-02-26 08:01:03 +05:30
Kovid Goyal
9870c94007 More work on porting the SSH kitten 2023-02-26 08:01:03 +05:30
Kovid Goyal
6b71b58997 Add write API to shm objects 2023-02-26 08:01:03 +05:30
Kovid Goyal
43bcb41a2a Nicer Set constructor 2023-02-26 08:01:03 +05:30
Kovid Goyal
1df3ef648c Clean up getting runtime dir on darwin 2023-02-26 08:01:03 +05:30
Kovid Goyal
4d8ccd8e94 ... 2023-02-26 08:01:03 +05:30
Kovid Goyal
f40380b05a More useful Set methods 2023-02-26 08:01:03 +05:30
Kovid Goyal
3703b4dbef API to conveniently generate secure tokens 2023-02-26 08:01:03 +05:30
Kovid Goyal
907a51c99c Code to read needed options from kitty.conf in a kitten 2023-02-26 08:01:03 +05:30
Kovid Goyal
0614c63966 Handle XDG_CONFIG_DIRS in Go as well 2023-02-26 08:01:03 +05:30
Kovid Goyal
a84b688038 Embed the data files needed for the ssh kitten into the Go binary 2023-02-26 08:01:03 +05:30
Kovid Goyal
b4b8943e64 Replace some more uses of sync.Once 2023-02-26 08:01:03 +05:30
Kovid Goyal
587d06b295 Replace use of sync.Once 2023-02-26 08:01:03 +05:30
Kovid Goyal
fa0773d9d2 Use a struct to store connection related data 2023-02-26 08:01:03 +05:30
Kovid Goyal
d656017f27 Move SSH askpass implementation into kitten 2023-02-26 08:01:02 +05:30
Kovid Goyal
6f4d89045a A nicer implementation of sync.Once
Doesnt require storing the result of the function in a dedicated global
variable with a dedicated getter function
2023-02-26 08:01:02 +05:30
Kovid Goyal
fbaaca1be9 Function to create symlinks atomically 2023-02-26 08:01:02 +05:30
Kovid Goyal
fa45324d39 Port code to read cloned env 2023-02-26 08:01:02 +05:30
Kovid Goyal
88077fdbcd Allow Stat() for MMap objects 2023-02-26 08:01:02 +05:30
Kovid Goyal
5a8d903a4d Go SHM API to read simple data with size from SHM name 2023-02-26 08:01:02 +05:30
Kovid Goyal
3f829ccdde Handle invalid args and passthrough 2023-02-26 08:01:02 +05:30
Kovid Goyal
06bfa671d9 Allow specifying the paths to search in Which() 2023-02-26 08:01:02 +05:30
Kovid Goyal
97b9572bec Port parsing of ssh args 2023-02-26 08:01:02 +05:30
Kovid Goyal
12c8af60dc String repr for Set 2023-02-26 08:01:02 +05:30
Kovid Goyal
57839b4e03 Port function to get ssh cli options by running ssh binary 2023-02-26 08:01:02 +05:30
Kovid Goyal
407555c6c8 Get completion working for kitten ssh 2023-02-26 08:01:02 +05:30
Kovid Goyal
590c1bd7ad dont parse args for the ssh kitten as it will do so itself 2023-02-26 08:01:02 +05:30
Kovid Goyal
46367bceed ... 2023-02-26 08:01:02 +05:30
Kovid Goyal
041c646d46 Fix parsing of copy args 2023-02-26 08:01:02 +05:30
Kovid Goyal
d98504e1a6 Finish porting SSH config file parsing 2023-02-26 08:01:02 +05:30
Kovid Goyal
07f4adbab5 Also add tests for bad lines 2023-02-26 08:01:02 +05:30
Kovid Goyal
7b4738125b Move config code into its own package 2023-02-26 08:01:02 +05:30
Kovid Goyal
2b7d6d45df Finish up config parser port 2023-02-26 08:01:01 +05:30
Kovid Goyal
747411be00 Finish implementation of config file parsing
Still needs tests
2023-02-26 08:01:01 +05:30
Kovid Goyal
70086451e7 Port parsing of env instructions 2023-02-26 08:01:01 +05:30
Kovid Goyal
32aa580984 Store parsed multi option values on the config object 2023-02-26 08:01:01 +05:30
Kovid Goyal
1470b11024 Dont parse default values 2023-02-26 08:01:01 +05:30
Kovid Goyal
5822bb23f0 Work on porting config file parsing to Go 2023-02-26 08:01:01 +05:30
Kovid Goyal
6f63d9c5d4 Start work on porting the SSH kitten to Go 2023-02-26 08:01:01 +05:30
Kovid Goyal
3d3bfe6c75 ... 2023-02-26 08:00:50 +05:30
Kovid Goyal
d550aef792 Fix #6056 2023-02-25 08:49:49 +05:30
Kovid Goyal
0d0f74a131 Note that we use tabs for indent in *.go files in editorconfig 2023-02-25 08:33:51 +05:30
Kovid Goyal
ed64899b83 Merge branch 'indent_style_space' of https://github.com/ornicar/kitty 2023-02-25 08:24:40 +05:30
Thibault Duplessis
098530ad38 fix typo in .editorconfig
According to https://editorconfig.org/#file-format-details:

> indent_style: set to tab or space to use hard tabs or soft tabs respectively.

Apologies if this is known and the previous `spaces` syntax is preferred.
In that case of course just close the PR.

Thanks for kitty 🐱
2023-02-24 19:03:47 +01:00
Kovid Goyal
b0f552c332 Fix upload to github not aborting for uploads that fail with protocol errors rather than failure responses 2023-02-24 20:34:46 +05:30
Kovid Goyal
f7f4384876 Also log start of upload 2023-02-24 20:29:51 +05:30
Kovid Goyal
7dd20d4c79 Dont output empty brackets for release versions which dont have KITTY_VCS_REV 2023-02-24 20:11:09 +05:30
Kovid Goyal
7ab0c3013e Merge branch 'fix-macos' of https://github.com/page-down/kitty 2023-02-24 17:31:37 +05:30
pagedown
4f44945c07 macOS: Restore pre-edit text after inserting text from the service
Add comments to explain how to get the methods to be called.
2023-02-24 19:57:09 +08:00
pagedown
f8b53df5c2 macOS: Fix resize_in_steps being applied when double-clicking on the
title bar to maximize the window
2023-02-24 19:56:51 +08:00
Kovid Goyal
c5149dec24 ... 2023-02-23 22:19:45 +05:30
Kovid Goyal
e41897f93f Also clean *_generated.bin files 2023-02-23 21:24:59 +05:30
Kovid Goyal
5ce85292b7 Cleanup previous PR
1) Fix a text_len leaking
2) No need to re-decode overlay_text
3) get_ime_cursor_position should not change the current global callback OS window
2023-02-23 21:19:30 +05:30
Kovid Goyal
dba8d278cb Merge branch 'ime' of https://github.com/page-down/kitty 2023-02-23 20:50:25 +05:30
Kovid Goyal
79e99f7e3a Dont pass PWD to go build
Fixes #6051
2023-02-23 14:31:30 +05:30
pagedown
9a598237c6 macOS: Allow IME to actively get the cursor position in real time
IME will automatically get the display position when needed, which keeps
it consistent with the overlay as much as possible.

Fix the issue that when IME is activated after mouse click, it is
displayed at the wrong position.
2023-02-22 22:36:20 +08:00
pagedown
126aaddccb IME: Render overlay at the last visible cursor position with a separate cursor
Fix the problem caused by wrong cursor coordinates. No more messing with
the main cursor, instead the cursor is saved when receiving a pre-edit
text update and used for drawing later.

Update the overlay to the last visible cursor position before rendering
to ensure it always moves with the cursor. Finally, draw the overlay
after line rendering is complete, and restore the line buffer after
updating the rendered data to ensure that the line text being read is
correct at all times.

This also improves performance by only rendering once when changes are
made, eliminating the need to repeatedly disable and draw after various
commands and not even comprehensively.
2023-02-22 22:36:06 +08:00
Kovid Goyal
de188faf55 Fix #6048 2023-02-22 19:51:33 +05:30
Sergei Grechanik
d63eeada73 Image placement using Unicode placeholders
This commit introduces the Unicode placeholder image placement method.
In particular:
- Virtual placements can be created by passing `U=1` in a put command.
- Images with virtual placements can be displayed using the placeholder
  character `U+10EEEE` with diacritics indicating rows and columns.
- The image ID is indicated by the foreground color of the placeholder.
  Additionally, the most significant byte of the ID can be specified via
  the third diacritic.
- Underline color can be optionally used to specify the placement ID.
- A bug was fixed, which caused incomplete image removal when it was
  overwritten by another image with the same ID.
2023-02-21 18:23:16 -08:00
Kovid Goyal
1f84e2d4e5 Merge branch 'pr-fix-screen-switching' of https://github.com/sergei-grechanik/kitty 2023-02-21 10:20:32 +05:30
Sergei Grechanik
6edf145b73 Fix image distortion when switching between screens 2023-02-20 19:46:25 -08:00
Kovid Goyal
fbfb779a19 Clarify what pygments style does 2023-02-20 16:38:22 +05:30
Kovid Goyal
71b07090c2 End APC and PM escape code on BEL as well as ST 2023-02-19 15:24:23 +05:30
Kovid Goyal
6619804df0 ... 2023-02-18 17:23:50 +05:30
Kovid Goyal
24b2802619 Merge branch 'fix-os-window-state' of https://github.com/page-down/kitty 2023-02-18 17:22:43 +05:30
pagedown
b0c28148b1 macOS: Fix window not taking up full height when the title bar is hidden
When the remembered window size is the full screen height, the window
height decreases after hiding the title bar.
2023-02-18 19:35:01 +08:00
pagedown
75a4f45a23 ... 2023-02-18 17:43:45 +08:00
pagedown
ba83ce7b10 macOS: Display the newly created OS window in specified state
Fix the maximized window can't occupy full screen space when window
decoration or title bar is hidden.
Fix resize_in_steps being applied even when window is maximized.
Allows to specify `os_window_state` in startup session file.
2023-02-18 14:02:19 +08:00
Kovid Goyal
1b76cee9b4 Merge branch 'dependabot/go_modules/golang.org/x/image-0.5.0' of https://github.com/kovidgoyal/kitty 2023-02-17 20:18:02 +05:30
dependabot[bot]
aad3704803 Bump golang.org/x/image from 0.3.0 to 0.5.0
Bumps [golang.org/x/image](https://github.com/golang/image) from 0.3.0 to 0.5.0.
- [Release notes](https://github.com/golang/image/releases)
- [Commits](https://github.com/golang/image/compare/v0.3.0...v0.5.0)

---
updated-dependencies:
- dependency-name: golang.org/x/image
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-17 14:44:32 +00:00
Kovid Goyal
00e2c66ea3 Add a link to the pets nvim plugin 2023-02-17 10:41:03 +05:30
Kovid Goyal
72b2ba51df launch: Allow specifying the state (fullscreen/maximized/minimized) for newly created OS Windows
Fixes #6026
2023-02-16 16:24:46 +05:30
Kovid Goyal
c73c165be1 Cleanup change_os_window_state 2023-02-16 16:10:19 +05:30
Kovid Goyal
e6e25c4ece Merge branch 'patch-1' of https://github.com/jle64/kitty 2023-02-15 22:01:17 +05:30
Jonathan Lestrelin
9ce11499de Add x-scheme-handler/ssh to mimetypes
Add x-scheme-handler/ssh to mimetypes so that kitty open can be used to open ssh links by default.
2023-02-15 16:24:47 +00:00
Kovid Goyal
ac5298ce76 Finish porting unicode input 2023-02-15 17:42:31 +05:30
Kovid Goyal
1321a96ae7 More work on porting unicode input 2023-02-15 17:14:09 +05:30
Kovid Goyal
2b87a601a0 More work on porting unicode input 2023-02-15 10:48:54 +05:30
Kovid Goyal
73a3366d53 Fix atomic write not working when file does not exist 2023-02-15 10:46:47 +05:30
Kovid Goyal
7223fdaa38 API to set the text at the prompt 2023-02-15 10:16:25 +05:30
Kovid Goyal
67436a48cd New API to suspend a loop 2023-02-14 22:27:41 +05:30
Kovid Goyal
9aaca33f15 ... 2023-02-14 22:27:10 +05:30
Kovid Goyal
a5eac42d92 More work on unicode input 2023-02-14 21:33:21 +05:30
Kovid Goyal
fb66cbc792 Forgot to exclude some control chars from unicode name based searching 2023-02-14 21:33:21 +05:30
Kovid Goyal
311a0cbfe9 More work on porting unicode input 2023-02-14 21:33:21 +05:30
Kovid Goyal
53e33a80ba Start work on porting unicode input kitten to Go 2023-02-14 21:33:21 +05:30
Kovid Goyal
a2e4efbb14 API to save/restore cursor position 2023-02-14 21:33:21 +05:30
Kovid Goyal
1aa9f1e62d Allow faint as an alias for dim 2023-02-14 21:33:21 +05:30
Kovid Goyal
32e0a56a94 Some more useful generic slice utilities 2023-02-14 21:33:21 +05:30
Kovid Goyal
601a333b0e Atomically update cached values file 2023-02-14 21:33:21 +05:30
Kovid Goyal
cc5107d0db Convenient way to load/save JSON data 2023-02-14 21:33:20 +05:30
Kovid Goyal
bee853cc6a ignore *.bin files in version control 2023-02-14 21:33:09 +05:30
Kovid Goyal
ec375ad3c6 Dont strip title for tabs to allow for leading and trailing whitespace. Fixes #6013 2023-02-14 21:31:23 +05:30
Kovid Goyal
5a7abd6214 CodeQL does not work for Go code 2023-02-14 11:15:44 +05:30
Kovid Goyal
3399f40de5 Merge branch 'go-version' of https://github.com/page-down/kitty 2023-02-14 11:15:02 +05:30
Kovid Goyal
31b804d8fb Merge branch 'add-python-typing-for-send_mouse_event' of https://github.com/trygveaa/kitty 2023-02-14 10:00:16 +05:30
Kovid Goyal
5219044519 Merge branch 'reload-mime-types' of https://github.com/page-down/kitty 2023-02-14 09:55:22 +05:30
Kovid Goyal
d6aecf172d Merge branch 'fix-macos-fullscreen' of https://github.com/page-down/kitty 2023-02-14 09:49:19 +05:30
Trygve Aaberge
8a3376261e Add send_mouse_event to fast_data_types.pyi 2023-02-13 21:52:41 +01:00
pagedown
cc18a4c192 transfer kitten: Use guess_type with custom MIME 2023-02-12 17:34:09 +08:00
pagedown
4141872290 When reloading configuration, also reload mime.types 2023-02-12 17:28:42 +08:00
pagedown
c41b65af97 macOS: Update window button visibility after toggling full screen 2023-02-12 13:45:27 +08:00
pagedown
dcddaf33e0 ... 2023-02-11 20:43:42 +08:00
pagedown
e388326929 ... 2023-02-11 20:36:25 +08:00
pagedown
d1e54a1d3b CI: Bump versions of the deprecated github actions to the latest 2023-02-11 20:33:29 +08:00
pagedown
3c7df680cf Get go version from go.mod
No need to update multiple places when bumping the go version.
2023-02-11 20:33:08 +08:00
Kovid Goyal
64fe9f82ed Add chr and ord to safe_builtins 2023-02-11 05:51:24 +05:30
Kovid Goyal
74a5b26967 ... 2023-02-11 05:48:01 +05:30
Kovid Goyal
2307892b50 Cleanup previous PR getting kitty working on macOS
Do not reduce the required OpenGL version on macOS. There is no point
anyway.

Fixes #2790
2023-02-10 11:03:25 +05:30
Kovid Goyal
a09dda27dc Merge branch 'master' of https://github.com/marcan/kitty 2023-02-10 10:55:41 +05:30
Kovid Goyal
ca1a5dcf5e Update design philosophy to mention Go code 2023-02-10 10:51:16 +05:30
Kovid Goyal
1d21b54d23 Merge branch 'docs' of https://github.com/page-down/kitty 2023-02-10 10:46:46 +05:30
pagedown
0d51adaa2c gitignore: Remove duplicate ignore rules and add ruff cache directory 2023-02-10 12:47:05 +08:00
pagedown
81a221460a Docs: Remind users to remove macos_thicken_font in changelog 2023-02-10 12:46:50 +08:00
pagedown
f8644682f9 ... 2023-02-10 12:46:40 +08:00
pagedown
c172e0158c Docs: Minor configuration docs improvements
Add some text roles.
Revise the cases of some words.
Manually wrap lines to make the generated commented config file and
source code a bit neater.
2023-02-10 12:46:31 +08:00
pagedown
c41a0c0290 Docs: Generate commented default configuration files
Provides the same sample config files as the locally generated ones.
2023-02-10 12:44:10 +08:00
Kovid Goyal
1b580e8323 Update Changelog for last PR 2023-02-10 09:28:33 +05:30
Kovid Goyal
94ab58343a Merge branch 'fix-ime' of https://github.com/page-down/kitty 2023-02-10 09:27:19 +05:30
pagedown
947dc2ff75 IME: Fix IME commit text and update pre-edit at the same time
Correctly update the overlay position when cursor visibility changes.
Restore the overlay line only when the cursor is visible.
Clear the saved overlay when drawing new pre-edit text.
Also update the cursor position when screen size changes.
Use four spaces to indent instead of two.
2023-02-10 10:50:32 +08:00
Kovid Goyal
439a997e5d Add a note to macos_thicken_font pointing to the new text_composition_strategy 2023-02-09 19:59:09 +05:30
Kovid Goyal
befd5a65c3 A generic Set implementation 2023-02-09 18:00:04 +05:30
Kovid Goyal
8d0452d375 Allow specifying initial capacity when splitting lines 2023-02-09 12:59:40 +05:30
Kovid Goyal
44f46afb2a Merge branch 'patch_function_prototype' of https://github.com/hellobbn/kitty 2023-02-09 11:42:22 +05:30
Luofan Chen
130315ce8d Use strict function prototypes
Fixes clang error:
error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
2023-02-09 13:16:00 +08:00
Kovid Goyal
07bab5253e Update Unicode data 2023-02-09 09:45:42 +05:30
Kovid Goyal
3b861d5f79 Better fix for OGP social cards build failure 2023-02-09 09:45:10 +05:30
Kovid Goyal
679862aa94 When changing the cursor text color via escape codes or remote control to a fixed color, do not ignore cursor_text_color
Fixes #5994
2023-02-08 21:01:00 +05:30
Kovid Goyal
1d2a8288ee ... 2023-02-08 20:45:41 +05:30
Kovid Goyal
7c8c7fe3a2 launch: When using --cwd=current for a remote system support running non shell commands as well 2023-02-08 17:52:28 +05:30
Kovid Goyal
244507336b Function to change the remote command in an ssh kitten cmdline 2023-02-08 16:34:33 +05:30
Kovid Goyal
237a5d17c0 Fix a regression in 0.27.0 that broke kitty @ set-font-size 0
Fixes #5992
2023-02-08 14:21:56 +05:30
Kovid Goyal
4dfd4d4972 sRGB glyph composition: Use default values that give "close to native" rendering. Also use only a single option to control it. 2023-02-08 13:49:53 +05:30
Kovid Goyal
8433f1d731 Update changelog for last PR 2023-02-08 13:03:25 +05:30
Kovid Goyal
2849eadd47 Minor cleanups 2023-02-08 12:51:18 +05:30
Kovid Goyal
28af786209 DRYer 2023-02-08 12:09:14 +05:30
Kovid Goyal
d53cb97aa1 Mark SRGB LUT table as generated 2023-02-08 11:29:18 +05:30
Kovid Goyal
e0e7917eaa Use builtin clamp() rather than min() + max() 2023-02-08 11:29:04 +05:30
Kovid Goyal
b5b070aade Merge branch 'linear-gamma-blending' of https://github.com/m4rw3r/kitty 2023-02-08 11:22:35 +05:30
Kovid Goyal
45d8a2a630 ... 2023-02-07 18:27:16 +05:30
Kovid Goyal
dd07a8c4a4 Changes to make updated mypy happy 2023-02-07 18:10:43 +05:30
Kovid Goyal
9e35d26188 Disable OGP social cards as building them breaks 2023-02-07 17:21:07 +05:30
Kovid Goyal
17e4995e93 version 0.27.1 2023-02-07 16:10:29 +05:30
Kovid Goyal
e161b5a4de Merge branch 'completion' of https://github.com/page-down/kitty 2023-02-04 13:35:58 +05:30
pagedown
52b643b6c6 Completion: Handle kitty +complete setup fish2
Provide the currently supported fish completion script when requesting
version 2.
2023-02-04 15:55:22 +08:00
Kovid Goyal
9bdb647454 kitty @ shell: Fix global options being ignored
Also no need to exec a separate process for every command
2023-02-04 12:54:49 +05:30
Kovid Goyal
0cabc3e109 Indicate when caps lock is on while reading password 2023-02-04 11:06:24 +05:30
Kovid Goyal
d06d6d7646 Add the command that can be used to get the default config file 2023-02-03 19:29:45 +05:30
Kovid Goyal
f1dc072045 Clean up previous PR 2023-02-03 16:14:24 +05:30
Kovid Goyal
9adc474e3c Merge branch 'completion' of https://github.com/page-down/kitty 2023-02-03 16:03:03 +05:30
pagedown
370aa3aaa6 Completion: Delegate kitty +complete to kitten
Implement `kitten __complete__ setup` in Go.
Fix zsh completion script to check `kitten`.
2023-02-03 18:16:04 +08:00
Kovid Goyal
bed4f33be8 Remove unused code 2023-02-03 09:51:54 +05:30
Kovid Goyal
8ce80d8962 Switch to using Go stdlib for ECDH crypto 2023-02-03 09:50:42 +05:30
Kovid Goyal
27ae9104ac Bump required Go version to 1.20
This allows us to use the stdlib for ECDH crypto used by remote control.
Fixes #5976
2023-02-03 09:32:56 +05:30
Kovid Goyal
331f1b7f2b Merge branch 'ksi' of https://github.com/page-down/kitty 2023-02-03 09:30:14 +05:30
pagedown
df1a99a974 Shell integration: More builtin commands 2023-02-03 10:56:19 +08:00
Kovid Goyal
7ea4270c88 ... 2023-02-03 08:02:28 +05:30
Kovid Goyal
a8480a4ca6 Update changelog for previous PR 2023-02-02 17:51:25 +05:30
Kovid Goyal
783bfb2823 Merge branch 'master' of https://github.com/shimt/kitty 2023-02-02 17:50:02 +05:30
Shinichi MOTOKI
a88164e3a2 Fix function key definitions in terminfo/termcap 2023-02-02 20:01:56 +09:00
Martin Wernstål
3676e6651d feat: additional contrast on text as a function of luminance difference 2023-02-02 10:18:15 +01:00
Martin Wernstål
e64affe3f7 feat: simulate gamma-incorrect blending 2023-02-02 09:53:39 +01:00
Martin Wernstål
9a1155721c refactor: cell_fragment blending functions 2023-02-02 09:53:39 +01:00
Martin Wernstål
8ece895774 feat: Use sRGB LUT for cells 2023-02-02 09:53:39 +01:00
Martin Wernstål
b10c18b8fe feat: Use sRGB LUT for borders 2023-02-02 09:53:39 +01:00
Martin Wernstål
2bc03852a1 feat: sRGB colors to shaders 2023-02-02 09:53:39 +01:00
Martin Wernstål
be61b4e95e feat: sRGB lookup table 2023-02-02 09:53:39 +01:00
Martin Wernstål
02d1a3c1c3 feat(srgb): swap textures and framebuffers to SRGB 2023-02-02 09:53:39 +01:00
Kovid Goyal
a7cbe3776d Wayland GNOME: Fix for ibus not working when using XWayland
See 8ce25208c3

I dont know what it is with GNOME. Every single release they break
backward compatibility somewhere, somehow. They must have special
talents.

Fixes #5967
2023-02-02 10:25:33 +05:30
Kovid Goyal
78d0cc40a3 Fix readSelectionFromPasteboard not actually inserting the text 2023-02-02 06:14:34 +05:30
Kovid Goyal
01720a8d4f Fix typo seems to have no actual effect, but... 2023-02-02 06:07:30 +05:30
Kovid Goyal
1d45cf4f91 Use crypto/rand rather than math/rand
Who knows how random math/rand actually is
2023-02-02 06:04:17 +05:30
Kovid Goyal
a9da57d9b3 Forgot to use builtin for alias 2023-02-01 19:27:39 +05:30
Kovid Goyal
a280328731 kitty->kitten typo 2023-02-01 19:11:39 +05:30
Kovid Goyal
17d2315d0c Merge branch 'docs' of https://github.com/page-down/kitty 2023-02-01 19:11:13 +05:30
pagedown
e27920527c Docs: Remove the text role target that is no longer needed 2023-02-01 19:26:38 +08:00
Kovid Goyal
960f5ff065 Merge branch 'docs' of https://github.com/page-down/kitty 2023-02-01 15:46:51 +05:30
pagedown
8fe936882d Docs: Improve usage and help documents for kitten 2023-02-01 17:14:54 +08:00
Kovid Goyal
682428fb54 Optimize the services implementation
Dont construct the selection string when we are merely checking if a
selection exists.
2023-02-01 12:46:19 +05:30
Kovid Goyal
1c6bae636b Only accept service requests when we actually have a selection 2023-02-01 12:17:59 +05:30
Kovid Goyal
c201bac900 ... 2023-02-01 12:17:15 +05:30
Kovid Goyal
5eaa935ede icat: Dont try to further compress PNG images when using stream based transmission 2023-02-01 11:45:01 +05:30
Kovid Goyal
a73f09cf89 Clarify that a=f is needed for chunked transmission of animation frame data 2023-02-01 11:43:15 +05:30
Kovid Goyal
092dc3d01f ... 2023-02-01 11:28:52 +05:30
Kovid Goyal
5c0d477a18 icat kitten: Fix transmission of frame data in direct mode
Sometimes frame data is > 2048 but does not compress smaller, which
broke the if statement checking for first loop.

Fixes #5958
2023-02-01 10:51:59 +05:30
Kovid Goyal
414ca86e3f Remaining fixes from #5962
Fixes #5962
2023-02-01 10:26:53 +05:30
Kovid Goyal
fbbfb25702 Better fix for kitten not being in PATH
Add it to PATH just as we add the kitty dir to PATH. Ensures the correct
kitten is in PATH, corresponding to the correct kitty.
2023-02-01 10:16:50 +05:30
Kovid Goyal
6ea812679f Fix modify_font not working for strikethrough position
Fixes #5946
2023-02-01 08:14:54 +05:30
Kovid Goyal
5a997a5f7a grammar 2023-01-31 21:02:58 +05:30
Kovid Goyal
47641456da Ensure edit-in-kitty works even if kitten is not in PATH
Still needs to be implemented for fish shell
2023-01-31 20:41:39 +05:30
Kovid Goyal
077f71cad5 Another place to update that talks about symlinking to PATH 2023-01-31 20:31:33 +05:30
Kovid Goyal
8f71f6112a Update installation instructions to note that kitty and kitten both need to be added to PATH 2023-01-31 20:29:41 +05:30
Kovid Goyal
8bdd4d0596 ssh kitten: Install kitty bootstrap on systems other than linux/darwin as now we have kitten which works on more types of systems 2023-01-31 20:16:20 +05:30
Kovid Goyal
df45a4e759 Add a note that --detach is not available on macOS 2023-01-31 17:52:36 +05:30
Kovid Goyal
70111d130e version 0.27.0 2023-01-31 10:48:56 +05:30
Kovid Goyal
ce6dacd0d4 Also build 32-bit kitten for Linux 2023-01-31 10:48:56 +05:30
Kovid Goyal
f3c434b7c1 Now that we are releasing 0.27.0 dont need to fetch release version to download latest kitten 2023-01-31 10:48:56 +05:30
Kovid Goyal
54b6344985 Add a note that --spacing is ignored for overlay windows 2023-01-30 12:00:41 +05:30
Kovid Goyal
18fc8dad37 Instead of calling insertText duplicate some of its code so we arent limited in the size of text we can insert 2023-01-29 19:56:53 +05:30
Kovid Goyal
9b5034f904 macOS: Integrate with system services 2023-01-29 19:47:50 +05:30
Kovid Goyal
f2c8819d25 Add an example for displaying a PNG with bash 2023-01-29 10:27:03 +05:30
Kovid Goyal
53482f4c84 Show bad length in base64 decode error message 2023-01-29 10:17:00 +05:30
Kovid Goyal
e1c50cf124 Merge branch 'revert' of https://github.com/page-down/kitty 2023-01-27 21:12:53 +05:30
pagedown
aacb4db2dc Remote control: Improve create-marker error messages
No more missing color errors when text/regex are missing.
Use `mark group` in error messages instead of `color`.
2023-01-27 23:31:06 +08:00
pagedown
8638e42135 Revert "Fix #5937"
This reverts commit 4b322560c3.
Only two arguments are required to create a marker.
2023-01-27 23:15:13 +08:00
Kovid Goyal
4b322560c3 Fix #5937 2023-01-27 15:15:47 +05:30
Kovid Goyal
0a4ad1fe12 Merge branch 'indent' of https://github.com/page-down/kitty 2023-01-27 11:19:54 +05:30
pagedown
907f658fcc ... 2023-01-27 13:40:31 +08:00
pagedown
1e7e10f96f Docs: Fix mixed tab and space indentation in the example code 2023-01-27 13:39:27 +08:00
Kovid Goyal
5338fcdc1e Add a note about why we play with file descriptors 2023-01-26 21:50:10 +05:30
Kovid Goyal
f8991ce3c8 ask kitten: Get readline to work even when stdout is redirected 2023-01-26 21:47:43 +05:30
Kovid Goyal
b408abe304 Move compile_commands.json to build directory 2023-01-26 14:25:22 +05:30
Kovid Goyal
084671b26e Also preread STDIN when using /dev/stdin as the source 2023-01-26 12:57:12 +05:30
Kovid Goyal
1cc69b3edd Move pre-read code into a separate function for clarity 2023-01-26 12:49:21 +05:30
Kovid Goyal
d88105319d clipboard kitten: Allow STDIN to be connected to a program that itself uses the tty directly
Read in STDIN first, and only then start terminal IO, hopefully allowing
the other program to finish its terminal IO before we start.

Fixes #5934
2023-01-26 12:40:08 +05:30
Kovid Goyal
eb50fac8de Add a test for creation of anonymous tempfiles 2023-01-26 11:51:02 +05:30
Kovid Goyal
4185e30d73 Code to more securely create anonymous temp files on Linux 2023-01-26 11:41:01 +05:30
Kovid Goyal
3a126ffa9d Restore permissions check on pwfile
just use RW instead of R as the expected mode
2023-01-26 08:48:35 +05:30
Kovid Goyal
4f5e3f6cf1 Fix ruff invocation in ALE 2023-01-26 08:44:16 +05:30
Kovid Goyal
dd6e206f9b Remove unused import 2023-01-26 08:29:37 +05:30
Kovid Goyal
ea920ffdf9 Merge branch 'master' of https://github.com/schlomie/kitty 2023-01-26 08:21:16 +05:30
Loren Schlomer
366d65f592 Fixes the ssh kitten
kovidgoyal@5e645a7 fixes the password file creation, allowing it to be
unlinked, but read_data_from_shared_memory/1 rejects the shared object
if it is not read only, and will break the ssh kitten for all
platforms.

This change removes the read only check, relying only on the file
ownership check.

This fully fixes #5928

Signed-off-by: Loren Schlomer <me@schlomie.com>
2023-01-25 11:14:12 -08:00
Kovid Goyal
5e645a7be7 Fix ssh kitten not working on FreeBSD
Apparently on FreeBSD one cannot unlink shared mem if it is not created
with write permissions.

Adding IWRITE to the permissions when creating the shared memory is
harmless. It means any process running as the user can either write to
the file or delete it. Deleting was already possible except on FreeBSD.
As for writing, it's needed on FreeBSD for shared memory to be useable
at all, and since processes running as the user can already completely
access all their data, kitty config files, tty pipes, etc. allowing them
to write to the SHM used here doesnt grant any significant new
capability, since they could just write to ssh.conf in the kitty config
folder to get the ssh kitten to do whatever they like.

Fixes #5928
2023-01-25 23:34:31 +05:30
Kovid Goyal
e3040a9c91 Make the various path finding functions thread safe and cache their results 2023-01-25 16:24:27 +05:30
Kovid Goyal
a01d68ed85 ... 2023-01-25 16:12:47 +05:30
Kovid Goyal
f070b17fee Also load ~/.config/kitty/mime.types in Go code 2023-01-25 16:08:12 +05:30
Kovid Goyal
22d562ca41 DRYer 2023-01-25 15:38:23 +05:30
Kovid Goyal
102197fabe Merge branch 'mime-types' of https://github.com/page-down/kitty 2023-01-25 15:28:40 +05:30
pagedown
83f505e209 Update known textual mimes to Python
Also add default aliases for JavaScript and XML in Go.
2023-01-25 16:42:15 +08:00
Kovid Goyal
5a86bc2411 Add default aliases for YAML and TOML 2023-01-25 11:54:09 +05:30
Kovid Goyal
b9c324586e Also recognize a few well known MIME types as being textual 2023-01-24 18:30:46 +05:30
Kovid Goyal
41fb3c79c5 DRYer 2023-01-24 18:26:01 +05:30
Kovid Goyal
5066623089 better fix for file completion in Go
When neither extensions for mime are specified assume we want to match
all files.
2023-01-23 18:01:17 +05:30
Kovid Goyal
8e98b4123e Fix completion for --password-file not completing file names 2023-01-23 17:58:31 +05:30
Kovid Goyal
8f88aab9d2 remove unused code 2023-01-23 17:51:10 +05:30
Kovid Goyal
d8bbb16d5e Make the single instance data type checked 2023-01-23 17:45:11 +05:30
Kovid Goyal
60791bb57b Session files: Expand environment variables 2023-01-23 17:34:53 +05:30
Kovid Goyal
11f98592f7 We still need full keyboard protocol for @ send-text 2023-01-23 16:33:08 +05:30
Kovid Goyal
97467acb1f kitten @ cmd: Dont generate key release events
We dont need them and they sometimes can spill over into the prompt if
the command is very fast.
2023-01-23 16:18:46 +05:30
Kovid Goyal
cc1f0bc3fe Function to drain controlling tty 2023-01-23 16:07:00 +05:30
Kovid Goyal
a009d6b258 kitty shell: Add completion for help and exit commands 2023-01-23 15:34:45 +05:30
Kovid Goyal
0903ae7b4d Do not use prewarming for wrapped kittens 2023-01-23 15:21:04 +05:30
Kovid Goyal
35c1ebd3f9 Merge branch 'fix-open-actions-shell' of https://github.com/page-down/kitty 2023-01-23 14:03:54 +05:30
pagedown
352f940010 Fix SHELL env var in open-actions.conf and launch-actions.conf
Only the executable path is used when expanding `$SHELL`.
Also fix the non-working example `{SHELL}` in the documentation.
2023-01-23 14:15:27 +08:00
Kovid Goyal
1f00c27097 Also create an automatic text/plain alias when reading from clipboard 2023-01-22 22:04:53 +05:30
Kovid Goyal
6b2d37366f Add trailing newline when printing available MIME types 2023-01-22 21:57:17 +05:30
Kovid Goyal
a4075ff041 X11: Fix a crash when listing clipboard MIME types and the clipboard is owned by self
Fixes #5920
2023-01-22 21:19:03 +05:30
Kovid Goyal
7a526d9588 clipboard kitten: When copying, automatically add a text/plain alias if there is at least one text/* MIME and no actual text/plain MIME 2023-01-22 20:41:37 +05:30
Kovid Goyal
5b4e4f032d ask kitten: Output JSON when used standalone 2023-01-22 11:48:51 +05:30
Kovid Goyal
0a1b399447 ... 2023-01-22 08:58:14 +05:30
Kovid Goyal
6a64df1afb Abort show_error kitten if stdin is a tty 2023-01-22 08:48:55 +05:30
Kovid Goyal
dc1851acdb Add some messages to kitten help for kittens that are not meant to be run by end users. 2023-01-22 08:46:29 +05:30
Kovid Goyal
096c1e328e Improve progress printout 2023-01-22 08:41:38 +05:30
Kovid Goyal
1a44c2117b GitHub requires a User-Agent 2023-01-22 08:00:29 +05:30
Kovid Goyal
bd13238d9b Should only return ENOTSUPP if SHM_DIR doesnt exist, not the fil we are trying to open 2023-01-21 17:46:37 +05:30
Kovid Goyal
b1c27d4c2f ... 2023-01-21 17:42:50 +05:30
Kovid Goyal
dc0093cb51 SHM FS: Return a not supported error if SHM_DIR does not exist 2023-01-21 17:40:59 +05:30
Kovid Goyal
b1934ce267 kitten: When guessing MIME types use a builtin list as a fallback, generated from the MIME type definitions available on the build system 2023-01-21 17:35:41 +05:30
Kovid Goyal
16f767de7e Remove unneeded code 2023-01-21 13:20:29 +05:30
Kovid Goyal
93e9332474 Use separate connections for every request to github
GitHub has been flaking out a lot of late with SSL errors when re-using
connections. Also allows us to get rid of the dependency on requests.
2023-01-21 12:56:00 +05:30
Kovid Goyal
81cc09aa61 Increase number of retries when uploading to github as it is getting flakier than ever 2023-01-20 07:11:52 +05:30
Kovid Goyal
e5bc7255b2 ... 2023-01-20 07:07:28 +05:30
Kovid Goyal
75048d56bc ... 2023-01-19 07:54:03 +05:30
Kovid Goyal
19f853c29f Add a note about all the things wrong with modifyOtherKeys 2023-01-18 22:57:56 +05:30
Kovid Goyal
26ca3f9bad Simplify code 2023-01-18 16:16:11 +05:30
Kovid Goyal
bf7d27691c Also add the EINTR fix from previous commit to writing to loop 2023-01-18 16:09:19 +05:30
Kovid Goyal
22532b4805 kitten @: Fix occasional hang until key is pressed while waiting for response from terminal
Fixes #5890
2023-01-18 16:07:42 +05:30
Kovid Goyal
68a006444e Ensure that marking a child for removal works even when the child is still in the queue to be added
Fixes #5895
2023-01-18 15:43:41 +05:30
Kovid Goyal
2d846f53a1 ... 2023-01-18 14:44:40 +05:30
Kovid Goyal
63077e5432 Dont do extremely small reads 2023-01-18 10:13:07 +05:30
Kovid Goyal
5edb1e2d6b micro-optimization 2023-01-18 09:58:29 +05:30
Kovid Goyal
0c7b4df6fc Ensure we are not using iterators when closing 2023-01-18 09:40:31 +05:30
Kovid Goyal
03abbb315a Fix using cursor=none not working on text that has reverse video
Fixes #5897
2023-01-18 09:23:49 +05:30
Kovid Goyal
dc03c14af2 Fix #5896 2023-01-18 08:51:17 +05:30
Kovid Goyal
821f52a748 ... 2023-01-17 12:39:41 +05:30
Kovid Goyal
750f2fa4d0 Use go 1.20 facilities for unsafe string <-> bytes 2023-01-17 12:38:54 +05:30
Kovid Goyal
009fd6418c Fix #5894 2023-01-17 12:05:23 +05:30
Kovid Goyal
ce161e610f ... 2023-01-17 11:52:06 +05:30
Kovid Goyal
b1b9c3704b Merge branch 'patch-2' of https://github.com/eltociear/kitty 2023-01-17 08:38:57 +05:30
Ikko Eltociear Ashimine
fd245e894b Fix typo in overview.rst
specifed -> specified
2023-01-17 12:05:46 +09:00
Kovid Goyal
59170a3627 Add a note to CONTRIBUTING.md about bug management 2023-01-16 17:16:58 +05:30
Kovid Goyal
61143557a9 Re-organize the terminfo FAQ entries into a single one 2023-01-16 16:32:35 +05:30
Kovid Goyal
9a77fdcd04 A new option undercurl_style to control the rendering of undercurls
Fixes #5883
2023-01-16 14:23:10 +05:30
Kovid Goyal
0c8ec3c57b Cleanup previous PR 2023-01-15 13:01:43 +05:30
Jake(Jaehak Song)
b799eba81e Save the overlay when DECTCEM is turned off and restore it when turned on. 2023-01-15 13:01:43 +05:30
Jake(Jaehak Song)
9d1de50bf9 shell.nix: add a missing dependency 'UniformTypeIdentifiers' for macOS 2023-01-15 13:01:43 +05:30
Kovid Goyal
d55a9b582b Use ruff for import sorting 2023-01-15 11:07:10 +05:30
Kovid Goyal
865fc24975 When reporting unused activity in a window, ignore activity that occurs soon after a window resize
Fixes #5881
2023-01-15 09:09:07 +05:30
Kovid Goyal
45b0788f28 Dont rely on existence of sh to report exec failure 2023-01-14 16:03:34 +05:30
Kovid Goyal
bc73273cb3 ... 2023-01-14 15:58:26 +05:30
Kovid Goyal
dd5cfe38b7 Update README 2023-01-14 15:56:03 +05:30
Kovid Goyal
6b8e5ea225 Rename kitty-tool to kitten
It's easier to type, and cuter.

Also, most, if not all of the TUI parts of
kitty's kittens will eventually be re-written into kitten.

The only downside I can see is that we cant tab complete kitty
anymore, but hopefully there will be less reason to run kitty
from the shell as command line tools migrate to kitten.

Meowrrrr!!!
2023-01-14 15:44:52 +05:30
Kovid Goyal
60310ced05 Also build 32-bit ARM kitty-tool for Linux 2023-01-14 11:20:31 +05:30
Kovid Goyal
f61b007645 ... 2023-01-11 11:53:43 +05:30
Kovid Goyal
d4e34a4c31 themes kitten: Nicer error message when no internet connection is present
Fixes #5877
2023-01-11 09:00:58 +05:30
Kovid Goyal
15524ee0fb ... 2023-01-10 19:41:46 +05:30
Kovid Goyal
58a4b4218e ... 2023-01-10 17:35:15 +05:30
Kovid Goyal
ac67d9c72d Allow dumping bytes sent to child for debugging 2023-01-10 15:39:56 +05:30
Kovid Goyal
b9692d480a Allow passing memoryview to paste() 2023-01-10 10:56:03 +05:30
Kovid Goyal
3a2da22509 DRYer 2023-01-10 09:35:15 +05:30
Kovid Goyal
bf8d0c9732 Fix a bug when copying large amounts of text with OSC 52 introduced by the new multi-format clipboard support 2023-01-10 09:29:54 +05:30
Kovid Goyal
836b652f4d Enable checks for unused noqa 2023-01-09 17:28:35 +05:30
Kovid Goyal
69255f7525 broadcast kitten: Allow pressing a key to stop echoing of input into the broadcast window itself 2023-01-09 17:19:35 +05:30
Kovid Goyal
6e41409a3f Dont run isort on generated conf files 2023-01-09 16:51:59 +05:30
Kovid Goyal
7fe5d7b58f Replace isort with ruff 2023-01-09 16:47:42 +05:30
Kovid Goyal
f15d27bb62 Use ruff on CI 2023-01-09 15:55:45 +05:30
Kovid Goyal
a068e3e655 Fix issues reported by ruff 2023-01-09 15:54:41 +05:30
Kovid Goyal
d248d5ad75 Move to pyproject.toml and ruff 2023-01-09 15:49:49 +05:30
Kovid Goyal
44866a6e79 Add sample Go code to get screen size 2023-01-07 15:00:51 +05:30
Kovid Goyal
1fe84f6057 Update icat kitten docs 2023-01-07 14:37:32 +05:30
Kovid Goyal
41207aa830 kitty @ get-colors: Report the current tab bar colors for the active OS window rather than configured values. Fixes #5865 2023-01-07 13:56:36 +05:30
Kovid Goyal
66a2e6f80d ... 2023-01-06 22:06:58 +05:30
Kovid Goyal
397ac36011 Also mention terminal multiplxers can cause graphics to fail 2023-01-06 16:36:39 +05:30
Kovid Goyal
02063a5a6a Make some variables local no need for them to be global 2023-01-06 16:35:17 +05:30
Kovid Goyal
b3926ae9e7 Remove unused code 2023-01-06 16:32:04 +05:30
Kovid Goyal
3743ae50e7 Simplify icat code and write to STDOUT rather than the terminal device
The terminal device is now used only for detection.
2023-01-06 16:16:15 +05:30
Kovid Goyal
2205bf4426 add a comment 2023-01-06 14:42:14 +05:30
Kovid Goyal
def35078d1 ... 2023-01-06 14:26:15 +05:30
Kovid Goyal
1b5fac3189 Cleanup previous PR 2023-01-06 14:25:21 +05:30
Kovid Goyal
dab7f71d2f Merge branch 'master' of https://github.com/TrellixVulnTeam/kitty_864P 2023-01-06 14:17:38 +05:30
TrellixVulnTeam
1223130ef7 Adding tarfile member sanitization to extractall() 2023-01-06 08:07:51 +00:00
Kovid Goyal
4e90ae68a4 ... 2023-01-06 11:33:47 +05:30
Kovid Goyal
e16e3c1582 Clarify the common use case for --config-file-name 2023-01-06 10:42:46 +05:30
Kovid Goyal
ddf36383b4 Dont need to fetch the current version since GitHub provides a redirecting constant download URL 2023-01-05 20:09:32 +05:30
Kovid Goyal
77a3916f6f We need go >= 1.19 2023-01-05 19:41:42 +05:30
Kovid Goyal
5d42d1f955 Remove the old python icat implementation
Keep the python backend code as it is used by the diff kitten to display
image diffs.
2023-01-05 19:34:12 +05:30
Kovid Goyal
a2c68a927e icat: When using --place ensure screen doesnt scroll by leaving cursor at top-left corner of image. 2023-01-05 19:15:13 +05:30
Kovid Goyal
cab7856495 Finish resize handling for the magick engine 2023-01-05 19:15:13 +05:30
Kovid Goyal
c317c934f3 More work on ImageMagick 2023-01-05 19:15:13 +05:30
Kovid Goyal
4d21be9eb5 Port python's shutil.which() 2023-01-05 19:15:13 +05:30
Kovid Goyal
fd71d2035d Start work on rendering with ImageMagick 2023-01-05 19:15:13 +05:30
Kovid Goyal
7ebb281855 Allow controlling num of CPUs for images operations 2023-01-05 19:15:13 +05:30
Kovid Goyal
2d3da1db6d Dont scan all pixels of JPEG images when EXIF rotated to check for opacity 2023-01-05 19:15:13 +05:30
Kovid Goyal
458adf967a Dont use extra memory for mirror operations 2023-01-05 19:15:13 +05:30
Kovid Goyal
eec4c6b802 Dont transmit animation control commands for non-animated images 2023-01-05 19:15:13 +05:30
Kovid Goyal
0b9b207513 Implement scaling for GIF as well 2023-01-05 19:15:13 +05:30
Kovid Goyal
7e8017604e Copy comment explaining min gap and set it to the correct value 2023-01-05 19:15:13 +05:30
Kovid Goyal
520b935cd3 ... 2023-01-05 19:15:12 +05:30
Kovid Goyal
9cb83a6ec2 ... 2023-01-05 19:15:12 +05:30
Kovid Goyal
7c2317d301 Fix divide by zero 2023-01-05 19:15:12 +05:30
Kovid Goyal
7237e5cf9c Get GIF basically working 2023-01-05 19:15:12 +05:30
Kovid Goyal
cd5dab581b DRYer 2023-01-05 19:15:12 +05:30
Kovid Goyal
481cebbd29 Transmission format should be per frame 2023-01-05 19:15:12 +05:30
Kovid Goyal
4623f580b9 Get 24 bit RGB transmission working 2023-01-05 19:15:12 +05:30
Kovid Goyal
6291d0d400 Code to check if an image is Opaque 2023-01-05 19:15:12 +05:30
Kovid Goyal
36d82267bb ... 2023-01-05 19:15:12 +05:30
Kovid Goyal
f9feb4954a Wire up pasting to RGB 2023-01-05 19:15:12 +05:30
Kovid Goyal
d192dcb0d7 Code to convert images to NRGB 2023-01-05 19:15:12 +05:30
Kovid Goyal
143fd6e4dd Start work on transmitting RGB images 2023-01-05 19:15:12 +05:30
Kovid Goyal
df06578c2d Implement --scale-up and --place 2023-01-05 19:15:12 +05:30
Kovid Goyal
73a055fe12 Fix failing test 2023-01-05 19:15:12 +05:30
Kovid Goyal
1fa1a478d9 Get --background working 2023-01-05 19:15:12 +05:30
Kovid Goyal
5a3a547c65 Work on adding support for rendering transforms 2023-01-05 19:15:12 +05:30
Kovid Goyal
373ab95f14 Basic go based rendering 2023-01-05 19:15:11 +05:30
Kovid Goyal
7f866b2b1f Start work on rendering images with Go 2023-01-05 19:15:11 +05:30
Kovid Goyal
24db38ba7e Set data size for SHM transmission as on some platforms the actual SHM size is not equal to the requested size 2023-01-05 19:15:11 +05:30
Kovid Goyal
efdfaaec30 ... 2023-01-05 19:15:11 +05:30
Kovid Goyal
d694f48c91 Get the other two transmission modes working as well 2023-01-05 19:15:11 +05:30
Kovid Goyal
5562a4d52f Get file mode transmission working for unmodified PNG 2023-01-05 19:15:11 +05:30
Kovid Goyal
ce4c71c465 Start work on the transmit backend 2023-01-05 19:15:11 +05:30
Kovid Goyal
31df90a64e Dont allow abort while waiting for query response 2023-01-05 19:15:11 +05:30
Kovid Goyal
22d69d24d0 Fix panic when no timers are left after dispatch 2023-01-05 19:15:11 +05:30
Kovid Goyal
d76e0850ae More work on porting icat 2023-01-05 19:15:11 +05:30
Kovid Goyal
b520882b62 ... 2023-01-05 19:15:11 +05:30
Kovid Goyal
79acab1547 More work on porting icat 2023-01-05 19:15:11 +05:30
Kovid Goyal
4690f3c7c0 ... 2023-01-05 19:15:11 +05:30
Kovid Goyal
cf1d9eb303 Parse more icat cli flags 2023-01-05 19:15:11 +05:30
Kovid Goyal
ba2a3f228d Implement --detect-timeout 2023-01-05 19:15:11 +05:30
Kovid Goyal
a757587ea2 Fix SHM on OpenBSD 2023-01-05 19:15:10 +05:30
Kovid Goyal
ea756db544 Get transmission medium detection working 2023-01-05 19:15:10 +05:30
Kovid Goyal
2d1a2c30bf MMap.Name() should return the SHM name not the full filesystem path 2023-01-05 19:15:10 +05:30
Kovid Goyal
6ace082bc2 Add openbsd and dragonfly support to shm 2023-01-05 19:15:10 +05:30
Kovid Goyal
7e161ea94b Get syscall based SHM working 2023-01-05 19:15:10 +05:30
Kovid Goyal
d01d5297b8 Start work on a SHM implementation in Go 2023-01-05 19:15:10 +05:30
Kovid Goyal
7a1140cd03 Start work on porting icat to Go 2023-01-05 19:15:10 +05:30
Kovid Goyal
aab81c2d32 Turn off hyperlink target display by default
I find it too intrusive for limited benefit. Most the hyperlinks I
click come from trusted programs anyway.
2023-01-05 15:30:43 +05:30
Kovid Goyal
49418c2f53 Show the hyperlink target bar on the top more often than the bottom. This is because the text cursor is usually closer to the bottom. 2023-01-05 15:28:02 +05:30
Kovid Goyal
a548e3eb4d Fix some animations pausing before starting 2023-01-04 11:18:17 +05:30
Kovid Goyal
779a7b7deb ... 2023-01-04 11:15:47 +05:30
Kovid Goyal
c83a8b0773 zsh completion; Fix leading ~ in filenames being quoted on insertion into commandline 2023-01-04 11:07:56 +05:30
Kovid Goyal
035c3de4bb Add completion for file args to clipboard kitten 2023-01-04 10:39:24 +05:30
Kovid Goyal
e2543e8968 Fix #5852 2023-01-04 08:20:04 +05:30
Kovid Goyal
bc2492c212 dont show URL targetbar when mouse is hidden 2023-01-01 12:11:19 +05:30
Kovid Goyal
c03310b5e5 Cleanup previous PR 2022-12-31 14:03:16 +05:30
Kovid Goyal
bd33cef092 Merge branch 'sequence' of https://github.com/ppwwyyxx/kitty 2022-12-31 13:38:37 +05:30
Yuxin Wu
832506d785 move is_modifier_key to glfw.c and expose in Python 2022-12-30 23:32:46 -08:00
Yuxin Wu
13b09346b9 reset current window after processing sequence 2022-12-30 23:07:50 -08:00
Yuxin Wu
1c10c5fcc4 replay modifier key as well 2022-12-30 23:07:50 -08:00
Yuxin Wu
510c5bd73b handle release 2022-12-30 23:07:49 -08:00
Yuxin Wu
774fdd7e94 Send sequence events to child if they don't match kitty. 2022-12-30 23:07:36 -08:00
Kovid Goyal
58497161c0 X11: When pasting text/plain try UTF8_STRING first then text/plain/charset=utf-8
Fixes #5842
Also fixes pasting from GTK+2 applications like leafpad.
2022-12-30 22:20:43 +05:30
Kovid Goyal
f831c34813 Update the FAQ on vim with a comprehensive set of settings needed to get it to work with modern terminals 2022-12-30 13:52:08 +05:30
Kovid Goyal
456af90ad2 Remote control: Allow matching for self window even over sockets when run inside a kitty window
Have kitty-tool send the value of KITTY_WINDOW_ID if present.
2022-12-30 12:17:31 +05:30
Kovid Goyal
c18bff7821 Remote control: Allow matching the parent of an overlay window 2022-12-30 11:29:05 +05:30
Kovid Goyal
080d1bf935 Fox object lifetime management 2022-12-30 10:08:49 +05:30
Kovid Goyal
4f9ed6546a Pass key events mapped to scroll actions to the program running in the terminal when the terminal is in alternate screen mode
Fixes #5839
2022-12-30 08:54:31 +05:30
Kovid Goyal
c76bbeabd6 ... 2022-12-30 08:34:58 +05:30
Kovid Goyal
0f24ce60f8 Fix @ send-text --stdin always assuming STDIN is a tty 2022-12-30 08:29:30 +05:30
Kovid Goyal
6a06769931 ... 2022-12-29 17:27:57 +05:30
Kovid Goyal
468b6fab02 Also use sanitized URL for allow_hyperlinks=ask 2022-12-29 17:05:18 +05:30
Kovid Goyal
306f9e5735 Prettify URLs before displaying them to the user 2022-12-29 17:04:02 +05:30
Kovid Goyal
f4ac03b791 Show the target of terminal hyperlinks when hovering over them with the mouse
Fixes #5830
2022-12-29 16:43:45 +05:30
Kovid Goyal
b8abdd2b50 Retry failed deletes from github 2022-12-29 12:50:16 +05:30
Kovid Goyal
e673747ef4 readline: add alt+arrow to move by word default binding. Common on macOS 2022-12-27 10:59:13 +05:30
Kovid Goyal
6e4376e44e A few more wrapping serialization tests 2022-12-27 09:11:15 +05:30
Kovid Goyal
f6801d48d1 Add a test to ensure \n does not change wrapping status 2022-12-27 08:48:26 +05:30
Kovid Goyal
ca57198927 Merge branch 'patch-1' of https://github.com/eltociear/kitty 2022-12-26 21:00:33 +05:30
Ikko Ashimine
e78000c879 Fix typo in iqsort.h
comparision -> comparison
2022-12-27 00:27:16 +09:00
Kovid Goyal
68cf9f7514 Switch to tracking linewrap on the last cell in a line
This allows us to have newline not affect the wrap status of a line.

Now a lines wrapping status is changed only when the last cell
in the line is changed. This actually matches the behavior of many other
terminal emulators so is probably a good thing from a ecosystem
compatibility perspective.

The fish shell expects this weird behavior of newline not changing
wrapping status, for unknown reasons, which is the actual motivation for
doing all this work.

Fixes #5766
2022-12-26 20:26:21 +05:30
Kovid Goyal
4556f5b8f1 Merge branch 'pr-fix-image-scrolling' of https://github.com/sergei-grechanik/kitty 2022-12-26 09:51:22 +05:30
Sergei Grechanik
32d8aac808 Fix scrolling images within margins
This commit fixes an off-by-one error in image scrolling that caused
images to not be scrolled or to be cropped at the wrong line.
2022-12-25 15:34:54 -08:00
Kovid Goyal
2e81d00c92 make go fmt happy 2022-12-24 10:53:17 +05:30
Kovid Goyal
cd92d50a0d Keyboard protocol: Remove CSI R from the allowed encodings of the F3 key as it conflicts with the *Cursor Position Report* escape code 2022-12-24 10:32:28 +05:30
Kovid Goyal
155dd426c5 Merge branch 'ssh-kitten' of https://github.com/page-down/kitty 2022-12-24 10:04:58 +05:30
pagedown
a8f2816ac2 ssh kitten: Compile terminfo with tic coming from pkgsrc under NetBSD 2022-12-24 11:53:52 +08:00
pagedown
0ddc5d030c ssh kitten: Fall back to using openssl when base64 does not exist 2022-12-24 11:53:45 +08:00
Kovid Goyal
a2c2d81373 Cleanup readline prompt rendering 2022-12-23 15:23:42 +05:30
Kovid Goyal
307ce1cf87 Remove not needed wrapper function since now we use a struct to set attrs 2022-12-23 13:50:55 +05:30
Kovid Goyal
61ceb12e07 Merge branch 'singlekey-endian' of https://github.com/jamessan/kitty
Fixes #5802
2022-12-23 08:12:23 +05:30
James McCoy
b45dc20693 Define SingleKey bitfields according to endianness
Closes #5802
2022-12-22 15:07:54 -05:00
Kovid Goyal
bcedbe5ec1 Revert "Change the terminfo entry for cud1 to not alter text to comply with the terminfo man page"
This reverts commit d8284befd3.
See https://github.com/kovidgoyal/kitty/issues/5766#issuecomment-1363025173
2022-12-22 21:49:32 +05:30
Kovid Goyal
038639e2d3 Bump bundled zlib 2022-12-22 19:26:34 +05:30
Kovid Goyal
c857492f37 Merge pull request #5803 from jamessan/runtime-dir
tests: Use tempdir for XDG_RUNTIME_DIR
2022-12-22 11:07:44 +05:30
Kovid Goyal
42923ab673 ... 2022-12-22 10:19:34 +05:30
James McCoy
9afd0309fc tests: Use tempdir for XDG_RUNTIME_DIR 2022-12-21 22:21:48 -05:00
Kovid Goyal
b9d098de2d Update mpv support link to point to the actual merged commit 2022-12-22 07:16:53 +05:30
Kovid Goyal
09e6f740de Merge branch 'macos-shortcuts' of https://github.com/page-down/kitty 2022-12-21 16:41:43 +05:30
pagedown
1023084eb9 macOS: Allow to customize Hide, Minimize, and Quit global menu shortcuts
All previously hard-coded shortcuts under macOS can be configured now.
2022-12-20 21:08:26 +08:00
Kovid Goyal
aa9679e56b Fix typo in key definition 2022-12-20 15:01:40 +05:30
Hector Martin
84aebae6a8 Downgrade OpenGL version requirement to 3.1
There are only a few features required from newer versions, and they
can be achieved via extensions. This significantly improves compatibility.
2022-12-20 16:22:05 +09:00
Kovid Goyal
d8284befd3 Change the terminfo entry for cud1 to not alter text to comply with the terminfo man page
Fixes #5766
2022-12-20 09:16:05 +05:30
Kovid Goyal
e4ee2cf995 Move the alt+left/right binding into zsh integration
It works OOTB in bash and fish already.
2022-12-19 11:25:12 +05:30
Kovid Goyal
e3f6f47f10 ... 2022-12-19 05:35:18 +05:30
Kovid Goyal
e5941b1b44 Add a link for the vim t_ut issue 2022-12-18 22:32:20 +05:30
Kovid Goyal
65c64d8745 macOS: Bind :kbd:option+left and :kbd:option+right to :kbd:alt+b and :kbd:alt+f. This mimics the default bindings in Terminal.app
Fixes #5793
2022-12-18 20:34:42 +05:30
Kovid Goyal
40093a4702 Add tests for GraphicsCommand serialization 2022-12-18 11:56:30 +05:30
Kovid Goyal
3815cba8f3 Add stringer interface to GraphicsCommand 2022-12-17 15:34:43 +05:30
Kovid Goyal
7410cd62f9 remove unused code 2022-12-17 09:00:44 +05:30
Kovid Goyal
ae0a8e73d2 ... 2022-12-17 08:59:56 +05:30
Kovid Goyal
8f3a8c828f Add an APC to GraphicsCommand parser 2022-12-16 21:05:17 +05:30
Kovid Goyal
6efb5dc2c2 Auto-create an OS Window if none exists on new_tab 2022-12-16 19:34:37 +05:30
Kovid Goyal
bb33f6c0ac Start work on graphics support in kitty-tool 2022-12-16 18:06:52 +05:30
Kovid Goyal
d34284ee1c Merge branch 'docs' of https://github.com/page-down/kitty 2022-12-16 13:06:20 +05:30
pagedown
74cae7b787 ... 2022-12-16 14:27:02 +08:00
Kovid Goyal
c6360537e5 Try to fix tests failing on Python 3.11 2022-12-16 10:05:05 +05:30
Kovid Goyal
7d28d7413f Merge branch 'patch-1' of https://github.com/lodisy/kitty 2022-12-16 09:41:10 +05:30
Michael
d3f3e9ec38 docs: fix overview.rst
add missing `be`, L88
2022-12-16 12:06:25 +08:00
Kovid Goyal
928becece4 Fix #5773 2022-12-14 15:45:43 +05:30
Kovid Goyal
80db167abb Add mpv to the list of things that speak the graphics protocol 2022-12-14 10:31:56 +05:30
Kovid Goyal
a5a6880a19 Respect enable_audio_bell when a layout action fails 2022-12-14 06:53:14 +05:30
Kovid Goyal
da13d03b98 Merge branch 'rc-launch' of https://github.com/page-down/kitty 2022-12-13 20:32:20 +05:30
pagedown
0a5c409a12 Remote control: Add the missing option value overlay-main 2022-12-13 22:48:46 +08:00
Kovid Goyal
eeb772ad07 @launch: When an overlay window is specified in a particular tab via --match use the active window of that tab as the base, not the current tab. Fixes #5768 2022-12-13 20:15:21 +05:30
Kovid Goyal
2b66775f45 explicitly ignore a few errors 2022-12-13 16:19:46 +05:30
Kovid Goyal
3f65ce0e71 Make sizes explicit in a few reallocs 2022-12-13 12:11:37 +05:30
Kovid Goyal
d235b673d1 also test \ is escaped 2022-12-13 10:21:19 +05:30
Kovid Goyal
0ab618c2dc Fix #5767 2022-12-13 10:20:02 +05:30
Kovid Goyal
fefafda9a0 Fix #5764 2022-12-12 21:26:54 +05:30
Kovid Goyal
902373ed20 Also make lists and dicts of strings escape code safe 2022-12-12 19:24:44 +05:30
Kovid Goyal
aac57550c9 rc protocol: Encode strings values in an escape code safe way
Go emits UTF-8 encoded JSON not ascii encoded JSON. Still need to fix
lists and dicts of strings
2022-12-12 18:48:54 +05:30
Kovid Goyal
95e05ce9ec Fix #5761 2022-12-12 16:49:18 +05:30
Kovid Goyal
b6c6316b7b Merge branch 'rc-ls' of https://github.com/page-down/kitty 2022-12-12 10:32:51 +05:30
pagedown
91576cc42f Remote control: Keep the same naming style for ls command output 2022-12-12 12:53:58 +08:00
Kovid Goyal
032e01ebf7 ... 2022-12-11 20:55:06 +05:30
Kovid Goyal
bd70100e09 Fix typo in FAQ 2022-12-10 13:00:09 +05:30
Kovid Goyal
ff6d2e3c10 Merge branch 'kitten-hyperlink-grep' of https://github.com/page-down/kitty 2022-12-10 12:58:57 +05:30
pagedown
2f292bb5d2 DRYer 2022-12-10 15:13:19 +08:00
pagedown
52cf443daf Docs: rg --no-heading has been handled 2022-12-10 15:12:32 +08:00
Kovid Goyal
f03a665e09 Remote control: When matching windows allow using negative id numbers to match recently created windows
Fixes #5753
2022-12-10 11:17:55 +05:30
Kovid Goyal
66e7919171 Add a FAQ entry about not being able to use a keybinding in a terminal program
I am tired of people asking this same question endlessly. At least now I
can just point them to this link.
2022-12-08 14:16:01 +05:30
Kovid Goyal
1289dd2ff0 Cleanup previous PR 2022-12-08 13:30:54 +05:30
Kovid Goyal
fa50e0d6cc Merge branch 'kitten-hyperlinked-grep' of https://github.com/page-down/kitty 2022-12-08 13:26:28 +05:30
pagedown
8c7a5288ae hyperlinked_grep kitten: Handle more rg command line options
Skip for unsupported options.
2022-12-08 14:51:13 +08:00
Kovid Goyal
7fe5c79d53 Also mask signals when SIGNALFD is not available
This makes behavior across platforms consistent.
Fixes #4636
2022-12-07 12:25:14 +05:30
Kovid Goyal
ea5ffa4304 ... 2022-12-07 10:18:15 +05:30
Kovid Goyal
89b32e4545 Update changelog with clipboard kitten new features 2022-12-07 10:04:02 +05:30
Kovid Goyal
879b27a045 ... 2022-12-07 06:48:19 +05:30
Kovid Goyal
9cb0e4d09d Block handled signals early in startup before glfw is initialized to ensure that if the graphics libraries start a thread behind our backs, that threads defaults to haveing the signals blocked unless the library explicitly unblocks them. See #4636 2022-12-07 06:35:18 +05:30
Kovid Goyal
94410f2866 Handle EBUSY as well 2022-12-06 12:20:20 +05:30
Kovid Goyal
a3ba8647ba Document the new OSC 5522 protocol 2022-12-06 12:18:55 +05:30
Kovid Goyal
f35ee1bb40 Fix using primary selection with the extended protocol 2022-12-06 11:15:52 +05:30
Kovid Goyal
23b3b171fa Merge branch 'conf' of https://github.com/page-down/kitty 2022-12-05 17:54:10 +05:30
pagedown
30b25709d2 Fix the base path for envinclude 2022-12-05 14:53:26 +08:00
pagedown
9c488bb877 Docs: Remove extra backslashes from commented config
Update docs to use \e in the example.
2022-12-05 14:27:40 +08:00
Kovid Goyal
14a33dbd94 Put the non-boilerplate functions in their proper place 2022-12-05 08:07:50 +05:30
Kovid Goyal
e37ee422b6 ... 2022-12-05 07:53:30 +05:30
Kovid Goyal
d7d96c2e7b When using the include directive in kitty.conf make the environment variable KITTY_OS available for OS specific config 2022-12-04 21:03:24 +05:30
Kovid Goyal
fda4aa21a1 When drawing the tab bar have the default left and right margins drawn in a color matching the neighboring tab
Fixes #5719
2022-12-04 20:51:41 +05:30
Kovid Goyal
3cbca4955e ... 2022-12-04 20:48:15 +05:30
Kovid Goyal
8e0e70e2d6 Simplify passing colors to the borders shader 2022-12-04 16:08:32 +05:30
Kovid Goyal
7a348d6ef1 Store updated tab bar edge colors on every tab bar redraw 2022-12-04 14:38:56 +05:30
Kovid Goyal
cf8f904720 Function to guess the effective color at the edge of the current screen line 2022-12-04 14:23:21 +05:30
Kovid Goyal
fe53555dba Document the additions to the clipboard kitten 2022-12-04 11:37:02 +05:30
Kovid Goyal
b644a42a48 Allow using wildcard mime types when copying from clipboard 2022-12-03 14:06:16 +05:30
Kovid Goyal
5c9c9a67bc Fix make asan
Suppress leak detection when running gen-go-code.py otherwise it fails
since python always leaks
2022-12-03 12:34:32 +05:30
Kovid Goyal
76f6288e69 ... 2022-12-03 12:25:23 +05:30
Kovid Goyal
6422b323c6 Implement MIME aliases for clipboard 2022-12-03 12:20:03 +05:30
Kovid Goyal
a622a149f6 Allow arbitrary bytes in the mime metadata key 2022-12-03 09:21:36 +05:30
Kovid Goyal
fa6527cdf3 add note about how MIME types are detected 2022-12-03 08:35:58 +05:30
Kovid Goyal
0b293428c4 X11: Fix reading list of available mime types 2022-12-03 08:16:59 +05:30
Kovid Goyal
26e8a5186a Avoid extra roundtrip when only reading clipboard mime types 2022-12-03 08:06:48 +05:30
Kovid Goyal
bde737fa38 Finish implementation of clipboard writing 2022-12-03 08:02:27 +05:30
Kovid Goyal
71e09ba1fb Fix show_key kitten showing incorrect CSI encoding for F3 2022-12-01 23:33:08 +05:30
Kovid Goyal
3e69cf81af DRYer 2022-12-01 22:40:47 +05:30
Kovid Goyal
f5d2c35755 Move implementation of +hold to Go
No need to pay python interpreter startup cost for --hold
2022-12-01 22:34:56 +05:30
Kovid Goyal
38a7fa73e3 Simplify filter mode operation
Dont need channels and goroutines as writing in the loop is already
asnychronous
2022-12-01 19:54:57 +05:30
Kovid Goyal
fdd42d5f19 Implement kitty side write OSC 5522 2022-12-01 18:18:06 +05:30
Kovid Goyal
fe75493c37 Better error messages 2022-12-01 18:17:53 +05:30
Kovid Goyal
e187265d04 Dont truncate the output file just to get tis permission bits 2022-12-01 14:13:28 +05:30
Kovid Goyal
0a985134e2 Ensure permissions are correct when using atomic writes 2022-12-01 14:04:52 +05:30
Kovid Goyal
e555d963b1 DRYer 2022-12-01 13:58:06 +05:30
Kovid Goyal
3601488b26 Add a generic Values() 2022-12-01 13:47:06 +05:30
Kovid Goyal
f29ce19097 Reading arbitrary MIME from clipboard now works 2022-12-01 13:35:44 +05:30
Kovid Goyal
f6ab641b00 Clarify the action of CSI < u in Quickstart 2022-11-30 16:28:34 +05:30
Kovid Goyal
722a1020fa Cleaner implementation of max_tab_title_length
Ensures that tab decorations are not affected
2022-11-29 23:20:39 +05:30
Kovid Goyal
fbd19f3bde Merge branch 'docs' of https://github.com/page-down/kitty 2022-11-29 22:10:57 +05:30
Kovid Goyal
3cf874f6e9 Work on implementing read support in the clipboard kitten 2022-11-29 22:07:51 +05:30
pagedown
02b206eeb8 Docs: Slightly adjust the description of tab_title_max_length
Note the associated GitHub PR ID in the changelog.
2022-11-30 00:20:32 +08:00
Kovid Goyal
5c50e3869c Change the new option to limit tab title lengths to apply to the length of the title, as documented, nit the full tab 2022-11-29 17:41:27 +05:30
Kovid Goyal
6f66bbd424 ... 2022-11-29 15:15:01 +05:30
Kovid Goyal
2697ddaec3 Dont ask for permission when reading only the mime types available in the clipboard 2022-11-29 15:09:01 +05:30
Kovid Goyal
d6dcdf0751 Merge branch 'tab_max_length' of https://github.com/fratajczak/kitty 2022-11-29 14:59:18 +05:30
Kovid Goyal
11724c8a5f Terminal end of OSC 5522 read requests 2022-11-29 14:55:40 +05:30
Ferdinand Ratajczak
b6792a6d71 Add option to limit length of tab titles 2022-11-29 09:50:32 +01:00
Kovid Goyal
f0d61c2de9 Add debug output for key encoding state modifications 2022-11-29 11:20:19 +05:30
Kovid Goyal
35ae689818 Improve debug encoded key output 2022-11-29 08:06:07 +05:30
Kovid Goyal
1305199bdf Output the bytes sent to the child in --debug-input 2022-11-29 07:56:06 +05:30
Kovid Goyal
c62c31f776 More mypy bugs
It cant handle putting a ClipboardTyple fielf on ReadRequest. SO just
use a bool as we really only have two types anyway.
2022-11-28 22:03:04 +05:30
Kovid Goyal
defef3f88c Make mypy happy 2022-11-28 21:05:10 +05:30
Kovid Goyal
3ee9f723f2 The legacy osc 52 protocol now works with the new clipboard requests manager class 2022-11-28 20:53:56 +05:30
Kovid Goyal
a8725d6307 Start work on a new clipboard protocol to allow terminal programs to access more than just text/plain content from the clipboard 2022-11-28 14:23:03 +05:30
Kovid Goyal
4c72f92939 Wayland GNOME: Workaround for latest mutter release breaking full screen for semi-transparent kitty windows
Destroy the CSD surfaces when window goes full screen.
Fixes #5677
2022-11-28 14:19:13 +05:30
Kovid Goyal
2150f261ee Merge branch 'ksi-fish-cwd' of https://github.com/page-down/kitty 2022-11-27 11:46:42 +05:30
pagedown
f720bc9fab Shell integration: Report cwd on the fish prompt event 2022-11-27 14:07:19 +08:00
Kovid Goyal
d92f89e47f ZSH integration: Report cwd on every new prompt draw
Handles the case of a command reporting a different cwd to the terminal.
2022-11-27 10:09:25 +05:30
Kovid Goyal
c54a4021ef Update docs to use \e instead of \x1b for esc since we now support it 2022-11-27 10:06:04 +05:30
Kovid Goyal
375fa73826 Delegate kitty +kitten clipboard to kitty-tool 2022-11-26 20:09:43 +05:30
Kovid Goyal
5eb2142d70 Use a define rather than a generated file for wrapped kittens 2022-11-26 16:16:45 +05:30
Kovid Goyal
00223c5bba Merge branch 'hostname' of https://github.com/page-down/kitty 2022-11-26 15:43:46 +05:30
Kovid Goyal
aa9080d375 Add a note about using single quotes when passing arguments with backslash escapes to send-text
One could of course also use double quotes and escape the backslash or
just escape the backslash but I dont think we need to explain shell
quoting fully here.
2022-11-26 15:38:22 +05:30
Kovid Goyal
8d45f5011b Add support for the 🔗 role to prettify 2022-11-26 15:34:20 +05:30
Kovid Goyal
b3f096b03b kitty shell: Fix pressing enter while cursor is not at end of line causes line to be truncated visually 2022-11-26 15:30:49 +05:30
Kovid Goyal
a721ffeb7d Finish porting clipboard kitten to Go 2022-11-26 15:15:30 +05:30
pagedown
6a1b456bac DRYer: Get hostname 2022-11-26 16:08:40 +08:00
Kovid Goyal
63a08dc6cc kitty-tool @: Fix extra newline being printed when a command returns no response 2022-11-26 05:02:32 +05:30
Kovid Goyal
4969611bdb Handle backslash escapes in :code: blocks 2022-11-25 22:03:13 +05:30
Kovid Goyal
5d3a9f2628 Use base64 for args in old rc code as well 2022-11-25 21:12:59 +05:30
Kovid Goyal
15a7aeff4d Fix kitty-tool @ send-text not processing ANSI escapes 2022-11-25 21:09:51 +05:30
Kovid Goyal
f9a22d0bc7 Port ANSI escape code parser to Go 2022-11-25 21:03:09 +05:30
Kovid Goyal
402c8b6803 Use ANSI C escapes rather than python string literals 2022-11-25 19:10:15 +05:30
Kovid Goyal
ac60715ee2 Merge branch 'docs' of https://github.com/page-down/kitty 2022-11-25 17:34:46 +05:30
Kovid Goyal
cfc6bd4da5 Native code implementation for expanding ANSI escape codes 2022-11-25 17:33:41 +05:30
Kovid Goyal
4d3f3b5e91 Start moving clipboard kitten to kitty-tool 2022-11-25 12:58:10 +05:30
pagedown
55b5a45e27 Docs: Fix missing backslashes 2022-11-25 12:03:34 +08:00
Kovid Goyal
fbce5e7524 Merge branch 'patch-1' of https://github.com/zeertzjq/kitty 2022-11-24 10:16:56 +05:30
zeertzjq
daeb1b6c50 Add note about Vim's support for kitty keyboard protocol 2022-11-24 11:30:40 +08:00
Kovid Goyal
8fb2c209a9 Query for existing assets and then delete 2022-11-23 07:53:14 +05:30
Kovid Goyal
2b676b63b1 sleep defaults to one second 2022-11-22 21:56:10 +05:30
Kovid Goyal
c0d06adcb5 New sleep action
useful in combine based mappings to make kitty sleep before executing the next action
2022-11-22 21:45:19 +05:30
Kovid Goyal
51bba9110e Bash integration: Fix clone-in-kitty not working on bash >= 5.2 if environment variable values contain newlines or other special characters
Bash >= 5.2 changed the export command to output values using $' escaping when they contain special characters.
Fixes #5629
2022-11-22 16:38:24 +05:30
Kovid Goyal
4fc91dcc03 There should be no trailing space when completing directories for a file match based on patterns 2022-11-21 11:05:36 +05:30
Kovid Goyal
3c0667afd6 add some motivation for background_tint_gaps 2022-11-21 10:19:25 +05:30
Kovid Goyal
03dc24f913 Merge branch 'background-tint-gaps' of https://github.com/page-down/kitty 2022-11-21 10:17:36 +05:30
pagedown
73b5857916 Keep two blank lines between each version in the changelog 2022-11-21 12:21:13 +08:00
pagedown
08d74a6c56 Add an option to control background image tinting for window gaps 2022-11-21 12:21:06 +08:00
Kovid Goyal
4290a8f9ba Change the Accept header to current github api recommedation 2022-11-20 07:22:00 +05:30
Kovid Goyal
c6dd6ccc68 Apparently github's deletion api is flakey, retry 2022-11-20 07:18:38 +05:30
Kovid Goyal
fd7cc66689 Increase wait timeout before retry 2022-11-20 07:15:31 +05:30
Kovid Goyal
1c19fc77f1 ... 2022-11-20 06:55:22 +05:30
Kovid Goyal
4080a09748 More upload code cleanup 2022-11-19 11:31:43 +05:30
Kovid Goyal
b91eaa3b2a Cleanup the asset upload code 2022-11-19 11:23:31 +05:30
Kovid Goyal
bdb25831a7 Merge branch 'refactor-cursor-shape' of https://github.com/page-down/kitty 2022-11-19 11:08:17 +05:30
pagedown
a131f9a82e Refactor: Use a consistent name for beam cursor shape 2022-11-19 10:34:50 +08:00
Kovid Goyal
ffefd0f581 Cleanup previous PR 2022-11-18 10:42:06 +05:30
Kovid Goyal
43c0e0f586 Merge branch 'unicode' of https://github.com/page-down/kitty 2022-11-18 10:40:50 +05:30
pagedown
76669ad14d Note the Unicode version in the generated files
Files generated from the same Unicode version will be consistent
regardless of the date they were built.
2022-11-18 13:01:32 +08:00
Kovid Goyal
a9bb341e43 Add an option to control max file size for edit-in-kitty 2022-11-18 10:24:38 +05:30
Kovid Goyal
0757fcc451 Dont fail on github responses without JSON payloads 2022-11-18 10:16:29 +05:30
Kovid Goyal
dd4051bfd5 Allow getting the exe name of the active foreground process in the tab title template 2022-11-17 22:06:06 +05:30
Kovid Goyal
a6dcbe9c1d ... 2022-11-17 20:51:01 +05:30
Kovid Goyal
efaf9faa38 Implement edit-in-kitty using kitty-tool
Fixes #5546
Fixes #5630
2022-11-17 20:48:20 +05:30
Kovid Goyal
36631ddc49 ... 2022-11-17 20:25:35 +05:30
Kovid Goyal
e5e8cc72c6 Make the Unicode database version used available 2022-11-17 20:11:50 +05:30
Kovid Goyal
38547c9e7a Documentation: distinguish between examples and default values for multi-valued options 2022-11-17 17:20:40 +05:30
Kovid Goyal
e00a5ce911 Merge branch 'master' of https://github.com/ppwwyyxx/kitty 2022-11-17 17:06:56 +05:30
Kovid Goyal
0af48a4d05 Start work on implementing edit-in-kitty in kitty-tool 2022-11-17 17:05:25 +05:30
Yuxin Wu
c0d80f9a47 [docs]: don't show config codeblocks that only has a name 2022-11-17 00:05:50 -08:00
Kovid Goyal
d2dabc7d57 ... 2022-11-17 11:10:17 +05:30
Kovid Goyal
81db5eb82f Use nightly to get kitty-tool until 0.27 is released 2022-11-17 11:05:46 +05:30
Kovid Goyal
1addfea261 Avoid an extra HTTP request to set the uploaded file description
Also delete partial asset when receiving 502 errors
2022-11-17 10:44:52 +05:30
Kovid Goyal
e5be31ee14 build in non-interactive mode while publishing 2022-11-17 10:27:53 +05:30
Kovid Goyal
9cef714078 Merge branch 'pr-end-iter' of https://github.com/sergei-grechanik/kitty 2022-11-17 10:03:01 +05:30
Kovid Goyal
a5a4a1bf8f Increase timeout in test 2022-11-17 10:02:44 +05:30
Kovid Goyal
281ad13f6b Retry uploading file to Github 2022-11-17 08:45:26 +05:30
Kovid Goyal
5ad2ac259b When truncating descriptions for completion truncate at word boundaries 2022-11-17 08:29:01 +05:30
Kovid Goyal
a2f022d166 Add support for the repeat escape code to TruncatetoVisualLength() 2022-11-17 08:17:11 +05:30
Sergei Grechanik
4df6c172a3 Define END_ITER to prevent brace imbalance
Otherwise some editors/plugins get confused
2022-11-16 09:54:49 -08:00
Kovid Goyal
9db1d581f7 DRYer 2022-11-16 22:37:27 +05:30
Kovid Goyal
b3bc5a5565 ... 2022-11-16 22:35:59 +05:30
Kovid Goyal
fc20e8d04b Fix spurious EOF error when select for reading from the tty fails with a temporary error 2022-11-16 22:32:35 +05:30
Kovid Goyal
86af1d5c16 Wrap EOF errors when doing terminal I/O 2022-11-16 22:23:00 +05:30
Kovid Goyal
d8574f8f85 Fix another bug in readline cursor position tracking 2022-11-16 21:28:36 +05:30
Kovid Goyal
bdd04f37d6 Better error message for kitty shell when running unknown command 2022-11-16 20:53:08 +05:30
Kovid Goyal
a4e43b3925 Use a pager for the help interactive command as well 2022-11-16 20:44:13 +05:30
Kovid Goyal
5e880b92f5 Ensure active hyperlink is cleared when truncating output for completion descriptions 2022-11-16 20:32:42 +05:30
Kovid Goyal
d4c103e53e zsh breaks when there are escape codes in completion descriptions 2022-11-16 19:32:16 +05:30
Kovid Goyal
3e4df7d812 ... 2022-11-16 19:06:22 +05:30
Kovid Goyal
3b18f90319 Merge branch 'completion' of https://github.com/page-down/kitty 2022-11-16 19:05:58 +05:30
Kovid Goyal
e31587ec1e Ensure auto-generated entries such as --help are present for completion by calling Validate() 2022-11-16 18:05:27 +05:30
pagedown
5dc97af4d5 Add completion for kitty +list-fonts 2022-11-16 20:23:58 +08:00
Kovid Goyal
81916d0f02 Finish implementation of update-self 2022-11-16 17:44:21 +05:30
Kovid Goyal
ae93d95bbe Get progress bar rendering working 2022-11-16 16:35:15 +05:30
Kovid Goyal
dd1fcf6855 Support the repeat prev char escape code when calculating the width of a string 2022-11-16 16:25:16 +05:30
Kovid Goyal
4b05822474 Merge branch 'ksi-completion-fish' of https://github.com/page-down/kitty 2022-11-16 14:00:28 +05:30
Kovid Goyal
337f1fad3f fix double signatures 2022-11-16 13:45:27 +05:30
Kovid Goyal
463c9debe7 More work on update-self 2022-11-16 13:41:58 +05:30
pagedown
9225919112 Fix completion for fish 2022-11-16 16:03:07 +08:00
Kovid Goyal
e70c021371 Some basic TUI widgets ported to Go 2022-11-16 12:48:47 +05:30
Kovid Goyal
f3b3d6c0ef Workaround for mypy bug 2022-11-15 22:47:53 +05:30
Kovid Goyal
0c0b9e6b9c Fix deadlock in update-self 2022-11-15 22:33:23 +05:30
Kovid Goyal
d9215feda5 Allow using the cwd of the original process for launch --cwd
Fixes #5672
2022-11-15 22:18:19 +05:30
Kovid Goyal
d54fe3c16a Start work on a command to self update kitty-tool 2022-11-15 21:29:11 +05:30
Kovid Goyal
36dd5b2d00 More minor loop API additions 2022-11-15 21:00:19 +05:30
Kovid Goyal
87108a18ef Add a callback for wakeups 2022-11-15 18:01:21 +05:30
Kovid Goyal
234274c1df ... 2022-11-15 16:54:14 +05:30
Kovid Goyal
b42677b343 Utility function to download a URL to a file path with progress reporting 2022-11-15 16:53:43 +05:30
Kovid Goyal
c03af4d294 Build static binaries on CI 2022-11-15 15:07:33 +05:30
Kovid Goyal
8d12e60f62 Set a flag available at runtime when cross compiling kitty-tool 2022-11-15 15:04:28 +05:30
Kovid Goyal
5a71b8c209 Merge branch 'macos-custom-icon' of https://github.com/page-down/kitty 2022-11-15 13:28:03 +05:30
Kovid Goyal
16775c5539 ssh kitten: Add a kitty-tool wrapper script to auto-download and use kitty-tool
Needs testing.
2022-11-15 13:26:48 +05:30
pagedown
8b8263d0ff macOS: Failure to set custom app icon should not prevent launch
When running `kitty/launcher/kitty` and no bundle path is provided,
the icon of `kitty/launcher/kitty.app` should be changed instead of
the `launcher` folder.
2022-11-15 15:21:40 +08:00
Kovid Goyal
9ddd7d070e Add a note to changelog about kitty @ speed improvements 2022-11-15 12:05:59 +05:30
Kovid Goyal
780d5400cb Use full kitty-tool exe name in github description 2022-11-15 12:01:55 +05:30
Kovid Goyal
63d7b2a80b Shutdown macOS build VM after building 2022-11-15 11:32:34 +05:30
Kovid Goyal
1958d67847 Sign kitty-tool on macOS 2022-11-15 11:32:12 +05:30
Kovid Goyal
737919505d Update docs to mention kitty-tool 2022-11-14 20:58:24 +05:30
Kovid Goyal
d60ecfa8a6 Install go 1.18 for codeql build 2022-11-14 20:35:41 +05:30
Kovid Goyal
e3b22a87e4 Upload static kitty-tool builds when publishing 2022-11-14 17:07:32 +05:30
Kovid Goyal
c7d47a59f1 When running kitty-tool without arguments show usage 2022-11-14 16:36:05 +05:30
Kovid Goyal
7eae176b88 Code to build static versions of kitty-tool 2022-11-14 16:27:19 +05:30
Kovid Goyal
9361c62a1c Linux: Use a separate thread to play the beep sound
This is because on misconfigured systems canberra hangs while queueing a
sound to play. And these misconfigured systems are quite common in
Linux-land. See for example #5646

Sigh. Even playing a simple sound is failure prone on Linux.
2022-11-14 15:42:09 +05:30
Kovid Goyal
018811c96c Remove unused code
Completion and remote control have moved into kitty-tool
2022-11-14 15:42:09 +05:30
Kovid Goyal
129646c199 Use kitty-tool for all kitty @ incovations 2022-11-14 15:42:09 +05:30
Kovid Goyal
1881f4582e ... 2022-11-14 15:42:09 +05:30
Kovid Goyal
a5d05a2954 ... 2022-11-14 15:42:09 +05:30
Kovid Goyal
59b43ee844 prettify :option:--xyz> better 2022-11-14 15:42:09 +05:30
Kovid Goyal
29bde6c72c Improve formatting of completion entries with descriptions 2022-11-14 15:42:09 +05:30
Kovid Goyal
a7ce642a00 Fix rendering in cells 2022-11-14 15:42:08 +05:30
Kovid Goyal
723a9c91b5 Get completion basically working 2022-11-14 15:42:08 +05:30
Kovid Goyal
9e2c96653f More work on readline completion 2022-11-14 15:42:08 +05:30
Kovid Goyal
4974219e0f Add function to shlex for completion
Also remove the google header since we have diverged from
the original a fair bit. Add a link to the original for credit.
2022-11-14 15:42:08 +05:30
Kovid Goyal
a4de4b7c6f Report stream start position for tokens 2022-11-14 15:42:08 +05:30
Kovid Goyal
eae4899df4 Use a string builder instead of appending to a slice 2022-11-14 15:42:08 +05:30
Kovid Goyal
87b4800fdf Get rid of comment parsing from shlex
POSIX does not define comments
2022-11-14 15:42:08 +05:30
Kovid Goyal
64156fd6e6 Have the shlex tokenizer return space tokens as well 2022-11-14 15:42:08 +05:30
Kovid Goyal
1485981b11 Have the shlex tokenizer track position in stream and return defined error types 2022-11-14 15:42:08 +05:30
Kovid Goyal
8d76cf8d32 Import the google shlex package as we need more sophisticated parsing 2022-11-14 15:42:08 +05:30
Kovid Goyal
7c23536bfe Start work on readline completions 2022-11-14 15:42:08 +05:30
Kovid Goyal
f919efcd42 Move basic multi key shortcut handling into its own package 2022-11-14 15:42:08 +05:30
Kovid Goyal
388e47a2df DRYer 2022-11-14 15:42:08 +05:30
Kovid Goyal
dc787a6529 Allow pretty printing members of the Action enum 2022-11-14 15:42:08 +05:30
Kovid Goyal
cfb6d93dc0 Move cursor to end of input when traversing history list 2022-11-14 15:42:08 +05:30
Kovid Goyal
1523fef000 tests for history searching 2022-11-14 15:42:08 +05:30
Kovid Goyal
31dcb13836 cursor_y should be zero when resetting 2022-11-14 15:42:07 +05:30
Kovid Goyal
0c82832356 more work on history search 2022-11-14 15:42:07 +05:30
Kovid Goyal
ffea66357a Start work on incremental history search 2022-11-14 15:42:07 +05:30
Kovid Goyal
6b48624b81 Reset keyboard state when resetting text 2022-11-14 15:42:07 +05:30
Kovid Goyal
5a425ccaad Implement number args for repeats 2022-11-14 15:42:07 +05:30
Kovid Goyal
2f2dbfb45f Cleanup prompt handling 2022-11-14 15:42:07 +05:30
Kovid Goyal
13a266aa42 Map ctrl+c to abort the current line 2022-11-14 15:42:07 +05:30
Kovid Goyal
67b12159f4 make clean should also clean go caches 2022-11-14 15:42:07 +05:30
Kovid Goyal
8ad55f7562 Add some tests for history 2022-11-14 15:42:07 +05:30
Kovid Goyal
e1ab2383b3 Add basic history operations 2022-11-14 15:42:07 +05:30
Kovid Goyal
f77d07259a Fix mutable default value in dataclass 2022-11-14 15:42:07 +05:30
Kovid Goyal
2e07f90baf ... 2022-11-14 15:42:07 +05:30
Kovid Goyal
8574e136cd Store cwd in history 2022-11-14 15:42:07 +05:30
Kovid Goyal
c8e8cb5ad5 Add some tests for yanking 2022-11-14 15:42:07 +05:30
Kovid Goyal
f127523ae9 Get rid of the unneccessary swap on first configure
Instead use the new flag to indicate the surface should not be committed
till the next swap.
2022-11-14 15:42:07 +05:30
Kovid Goyal
22f7145e34 Add yank actions 2022-11-14 15:42:07 +05:30
Kovid Goyal
1f115870bb Need to install x11-xcb-dev explicitly in jammy 2022-11-14 15:42:06 +05:30
Kovid Goyal
3237db00fc Implement word killing actions 2022-11-14 15:42:06 +05:30
Kovid Goyal
ea583f60b3 Start work on kill ring 2022-11-14 15:42:06 +05:30
Kovid Goyal
b7816d26be Implement clear screen c-l binding 2022-11-14 15:42:06 +05:30
Kovid Goyal
19bf07abd9 Use the more efficient cell iterator api for single char horizontal cursor movement as well 2022-11-14 15:42:06 +05:30
Kovid Goyal
a008c627e3 Implement bindings for moving by simple word 2022-11-14 15:42:06 +05:30
Kovid Goyal
0068ae8f66 An easy to use iterator to iterate over the cells in a string 2022-11-14 15:42:06 +05:30
Kovid Goyal
5436408463 Fix the escape code parser not preserving complete utf-8 state between calls to ParseBytes()
Also allow it to be driven byte-by-byte
2022-11-14 15:42:06 +05:30
Kovid Goyal
d260d2f480 Add some test for vertical movement 2022-11-14 15:42:06 +05:30
Kovid Goyal
00ef9c1955 Implement vertical cursor movement 2022-11-14 15:42:06 +05:30
Kovid Goyal
5509673ff3 More tests 2022-11-14 15:42:06 +05:30
Kovid Goyal
3c4a411cad Rewrite the readline redraw code to make the screen lines explicit 2022-11-14 15:42:06 +05:30
Kovid Goyal
f945ef8ee8 handle ctrl-c better when interrupting go test 2022-11-14 15:42:06 +05:30
Kovid Goyal
260249491d Avoid Querying screen size on every resize 2022-11-14 15:42:05 +05:30
Kovid Goyal
595a78c956 DRYer 2022-11-14 15:42:05 +05:30
Kovid Goyal
cbbf8a2d34 Port output of active window and tab ids at shell startup 2022-11-14 15:42:05 +05:30
Kovid Goyal
88567f69b2 Start work on history support for readline 2022-11-14 15:42:05 +05:30
Kovid Goyal
fe91af5e09 Go stdlib doesnt even have a way to lock files 2022-11-14 15:42:05 +05:30
Kovid Goyal
5e2255591c Dont send invalid kitty-cmd escape code over tty 2022-11-14 15:42:05 +05:30
Kovid Goyal
01969cae1a More useful PARSE ERROR msg for unknown @ commands 2022-11-14 15:42:05 +05:30
Kovid Goyal
b89dfc6d1d Actually run the remote control commands from the shell 2022-11-14 15:42:05 +05:30
Kovid Goyal
59edf1d349 Code to show help 2022-11-14 15:42:05 +05:30
Kovid Goyal
9419fbc77c Fix rendering when line wraps 2022-11-14 15:42:05 +05:30
Kovid Goyal
d27cf045e5 ... 2022-11-14 15:42:05 +05:30
Kovid Goyal
f7d44330a2 remove unused code 2022-11-14 15:42:05 +05:30
Kovid Goyal
834385baff Improve performance when pasting large amounts of text into readline by not redrawing on every char 2022-11-14 15:42:05 +05:30
Kovid Goyal
c0f17c279e Add a generic ring buffer
Go's stdlib is very anemic
2022-11-14 15:42:05 +05:30
Kovid Goyal
7264bea8c9 Fix selector incorrectly marking fd as ready on EINTR 2022-11-14 15:42:04 +05:30
Kovid Goyal
1058c999c8 ... 2022-11-14 15:42:04 +05:30
Kovid Goyal
bf7dd1c369 Fix multiline prompts 2022-11-14 15:42:04 +05:30
Kovid Goyal
936a7a5f97 Dont write escape code for zero movement 2022-11-14 15:42:04 +05:30
Kovid Goyal
350060e0f6 ... 2022-11-14 15:42:04 +05:30
Kovid Goyal
430bd23870 Fix decoding of letter trailer CSI key event 2022-11-14 15:42:04 +05:30
Kovid Goyal
9f2b2eac85 More work on shell 2022-11-14 15:42:04 +05:30
Kovid Goyal
fd36435262 Add some default readline bindings 2022-11-14 15:42:04 +05:30
Kovid Goyal
27418eed88 Beep when action could not be performed 2022-11-14 15:42:04 +05:30
Kovid Goyal
48f1690913 Wire up key event handling 2022-11-14 15:42:04 +05:30
Kovid Goyal
eff239a195 Code to erase character ranges 2022-11-14 15:42:04 +05:30
Kovid Goyal
5e5cae8391 Code to move cursor right 2022-11-14 15:42:04 +05:30
Kovid Goyal
57310a772a Code to move cursor left 2022-11-14 15:42:04 +05:30
Kovid Goyal
066465bce7 Some tests for add_text 2022-11-14 15:42:04 +05:30
Kovid Goyal
1792c2268a Start writing tests for readline internal functions 2022-11-14 15:42:04 +05:30
Kovid Goyal
32059dba7e More work on readline 2022-11-14 15:42:03 +05:30
Kovid Goyal
c8296a44eb More work on readline 2022-11-14 15:42:03 +05:30
Kovid Goyal
565526624f Start work on porting kitty shell to Go 2022-11-14 15:42:03 +05:30
Kovid Goyal
f57832f501 Fix spurious rebuilds of generated go code 2022-11-14 15:42:03 +05:30
Kovid Goyal
e536ef7844 Suggestions for sub command names as well 2022-11-14 15:42:03 +05:30
Kovid Goyal
0dab006733 Allow un-ambiguous prefixes for command names 2022-11-14 15:42:03 +05:30
Kovid Goyal
75ead358a2 Show suggestions for options based on levenshtein distance 2022-11-14 15:42:03 +05:30
Kovid Goyal
654bd23109 DRYer 2022-11-14 15:42:03 +05:30
Kovid Goyal
6b04c42730 update wcswidth go version to match unicode 15 update in master 2022-11-14 15:42:03 +05:30
Kovid Goyal
8f5302a650 Hook up kitty-tool completions with shell integration 2022-11-14 15:42:03 +05:30
Kovid Goyal
74b1cac344 Allow using unabiguous long option prefixes 2022-11-14 15:42:03 +05:30
Kovid Goyal
7d5849cc17 ... 2022-11-14 15:42:03 +05:30
Kovid Goyal
d2a2af9672 Add completion for kitty-tool 2022-11-14 15:42:02 +05:30
Kovid Goyal
2633356842 No need to use a map 2022-11-14 15:42:02 +05:30
Kovid Goyal
3bd4fd999a All completion tests pass again 2022-11-14 15:42:02 +05:30
Kovid Goyal
262e2fb7a3 Various fixes from the completion merge 2022-11-14 15:42:02 +05:30
Kovid Goyal
97716fea8b More work on merging completions with parse tree 2022-11-14 15:42:02 +05:30
Kovid Goyal
bf74413c1f Work on merging completion tree with parse tree 2022-11-14 15:42:02 +05:30
Kovid Goyal
79ca0408e7 split up types.go 2022-11-14 15:42:02 +05:30
Kovid Goyal
97acb60981 Move completion package into cli 2022-11-14 15:42:02 +05:30
Kovid Goyal
3662efdf80 Nicer handling of python for typecheck 2022-11-14 15:42:02 +05:30
Kovid Goyal
e608a945de Output version information at bottom of help 2022-11-14 15:42:02 +05:30
Kovid Goyal
5771bd0c01 Make adding subcommands a bit nicer 2022-11-14 15:42:02 +05:30
Kovid Goyal
4396dede85 Get rid of the cobra dependency 2022-11-14 15:42:02 +05:30
Kovid Goyal
cbc569af64 Remove no_response from json specs 2022-11-14 15:42:02 +05:30
Kovid Goyal
90c1745976 Fix parsing of list options 2022-11-14 15:42:02 +05:30
Kovid Goyal
c4ab964d09 Tests for CLI parsing 2022-11-14 15:42:02 +05:30
Kovid Goyal
04022ed363 Various fixes to CLI parsing 2022-11-14 15:42:02 +05:30
Kovid Goyal
79cfc1e70a Move kitty-tool __complete__ to use the new CLI framework 2022-11-14 15:42:01 +05:30
Kovid Goyal
e7c14c78d0 Work on outputting help for commands 2022-11-14 15:42:01 +05:30
Kovid Goyal
cb2389efa5 Use the standard library deque
Drops a dependency
2022-11-14 15:42:01 +05:30
Kovid Goyal
49f5f25fb9 Run tests in the writeable src dir as the generated go files are present there 2022-11-14 15:42:01 +05:30
Kovid Goyal
ff4353b209 ... 2022-11-14 15:42:01 +05:30
Kovid Goyal
c07dc220a8 Fix frozen builds 2022-11-14 15:42:01 +05:30
Kovid Goyal
4316018966 ... 2022-11-14 15:42:01 +05:30
Kovid Goyal
a0bf6177e2 Use a LRUCache rather than an Unbounded one 2022-11-14 15:42:01 +05:30
Kovid Goyal
3078b9074a Also report submatch positions 2022-11-14 15:42:01 +05:30
Kovid Goyal
dffb87ced9 Make the cache re-useable 2022-11-14 15:42:01 +05:30
Kovid Goyal
4adea5b7fe Make ReplaceAll re-useable 2022-11-14 15:42:01 +05:30
Kovid Goyal
317b108497 Allow using :role:'payload' in addition to :role:payload as the former can be used in Go `` string literals 2022-11-14 15:42:01 +05:30
Kovid Goyal
7c41737370 Couple more errors found by linting 2022-11-14 15:42:01 +05:30
Kovid Goyal
4b6bae576d configure staticcheck 2022-11-14 15:42:01 +05:30
Kovid Goyal
8221713995 Allow defining options using a struct 2022-11-14 15:42:01 +05:30
Kovid Goyal
ef49634353 Fix some issues reported by staticcheck 2022-11-14 15:42:01 +05:30
Kovid Goyal
d6f42a11d7 Run go vet on CI 2022-11-14 15:42:00 +05:30
Kovid Goyal
800dbf1f4d extra message when tests have failed 2022-11-14 15:42:00 +05:30
Kovid Goyal
b1e08adbce Utility function to sort with key 2022-11-14 15:42:00 +05:30
Kovid Goyal
e7f38929d9 DRYer 2022-11-14 15:42:00 +05:30
Kovid Goyal
d0e133885c Install Go 1.18 on CI 2022-11-14 15:42:00 +05:30
Kovid Goyal
2cacd7a64a get rid of interface{} since we now require Go 1.18 2022-11-14 15:42:00 +05:30
Kovid Goyal
a44c89504b More convenient interface for sorting 2022-11-14 15:42:00 +05:30
Kovid Goyal
8807f6d539 Code to get exe name for usage message 2022-11-14 15:42:00 +05:30
Kovid Goyal
2f83bbdc85 command validation 2022-11-14 15:42:00 +05:30
Kovid Goyal
41a841c83d Validate string slice fields 2022-11-14 15:42:00 +05:30
Kovid Goyal
0cf8876f8a Validate count struct fields 2022-11-14 15:42:00 +05:30
Kovid Goyal
a3a89b3e21 More efficient multi line scanning 2022-11-14 15:42:00 +05:30
Kovid Goyal
2ddbe2a2bc Automatically camel-case destination 2022-11-14 15:42:00 +05:30
Kovid Goyal
707963b694 Code to conveniently read option values into a struct 2022-11-14 15:42:00 +05:30
Kovid Goyal
1811949706 Implement cloning of commands 2022-11-14 15:42:00 +05:30
Kovid Goyal
bc38bd75fd Start work on getting rid of the cobra dependency
Command line parsing is easy and I can do it better.
2022-11-14 15:42:00 +05:30
Kovid Goyal
54ec486d3a Now completion for hyperlinked_grep is automatic thanks to delegation
Also fix delegation for zsh when the command being completed differs
from the current command.
2022-11-14 15:42:00 +05:30
Kovid Goyal
5666b1b0fd Implement completion for fish 2022-11-14 15:41:59 +05:30
Kovid Goyal
ef9b765f81 Dont count bash's idiotic option equals as arguments 2022-11-14 15:41:59 +05:30
Kovid Goyal
a2bb360eec Dont output escape strings in descriptions 2022-11-14 15:41:59 +05:30
Kovid Goyal
e3b8de1ac0 Update test for new exe search 2022-11-14 15:41:59 +05:30
Kovid Goyal
4cbd2a0ee0 ... 2022-11-14 15:41:59 +05:30
Kovid Goyal
7cf9b21fc0 Show local executables for kityt command completion even without ./ 2022-11-14 15:41:59 +05:30
Kovid Goyal
454c2e32e7 ... 2022-11-14 15:41:59 +05:30
Kovid Goyal
53dc079c10 Use compopt to manage files and spaces 2022-11-14 15:41:59 +05:30
Kovid Goyal
08c697e99a Get delegate based completion working for bash 2022-11-14 15:41:59 +05:30
Kovid Goyal
1dce092ac0 Add trailing spaces for bash completion 2022-11-14 15:41:59 +05:30
Kovid Goyal
24c2d27eea handle bash splitting completion cmdline on equals 2022-11-14 15:41:59 +05:30
Kovid Goyal
b04b483b3f Remove common prefix for bash as well 2022-11-14 15:41:59 +05:30
Kovid Goyal
a7c997c6ef Add a debug function to print to parent kitty stdout 2022-11-14 15:41:59 +05:30
Kovid Goyal
266e51310c Basic BASH completion 2022-11-14 15:41:59 +05:30
Kovid Goyal
928a4db817 Implement delegate based completion fof the ssh and hyperlinked_grep kittens 2022-11-14 15:41:59 +05:30
Kovid Goyal
fd631bf402 Delegate based completion for @launch args 2022-11-14 15:41:59 +05:30
Kovid Goyal
dc403156a9 Delegate based completion for kitty cmd 2022-11-14 15:41:59 +05:30
Kovid Goyal
2cc359ccc8 Get zsh completion working apart from delegation 2022-11-14 15:41:58 +05:30
Kovid Goyal
cbbda23e01 Utility code to find longest common prefix/suffix and to quote strings for various shells 2022-11-14 15:41:58 +05:30
Kovid Goyal
1ff4f2df4f Refactor the CLI markup code to make it re-useable 2022-11-14 15:41:58 +05:30
Kovid Goyal
8796168469 Port code to truncate strings to visual width to Go 2022-11-14 15:41:58 +05:30
Kovid Goyal
d16ad40bbf avoid extra string copy in Stringwidth 2022-11-14 15:41:58 +05:30
Kovid Goyal
5c0858d6b7 Start work on zsh completion serialization 2022-11-14 15:41:58 +05:30
Kovid Goyal
a32a8d096d Allow commands to customize argument parsing 2022-11-14 15:41:58 +05:30
Kovid Goyal
67f556bd7c Add completion for the launch wrappers 2022-11-14 15:41:58 +05:30
Kovid Goyal
7737369fc9 Add completion for the kittens 2022-11-14 15:41:58 +05:30
Kovid Goyal
25a7ec9a07 Extra completion for some kitty options 2022-11-14 15:41:58 +05:30
Kovid Goyal
c2a2b4c087 Add various special purpose entry points 2022-11-14 15:41:58 +05:30
Kovid Goyal
3bf20594b7 Wire up completion for rc command options 2022-11-14 15:41:58 +05:30
Kovid Goyal
3a8bab90dc Get rid of WordPrefix 2022-11-14 15:41:58 +05:30
Kovid Goyal
0ff2446a1a More completion work 2022-11-14 15:41:58 +05:30
Kovid Goyal
946d44c43f Implement completespec in go 2022-11-14 15:41:58 +05:30
Kovid Goyal
26d4f5bcc9 Use the new completionspec for rc cmds 2022-11-14 15:41:58 +05:30
Kovid Goyal
d84efe105c ... 2022-11-14 15:41:58 +05:30
Kovid Goyal
f657e6e916 Allow using a base directory other than the cwd when completing files 2022-11-14 15:41:57 +05:30
Kovid Goyal
c5afceb4cb Basic completion for options 2022-11-14 15:41:57 +05:30
Kovid Goyal
18c3e46ac6 When completing on patterns exclude directories that only contain files that dont match 2022-11-14 15:41:57 +05:30
Kovid Goyal
3c29ce936b Dont recurse for file completion
We could potentially end up recursing over the entire file system. And
for completion we only present the candidates in the immediate directory
anyway.
2022-11-14 15:41:57 +05:30
Kovid Goyal
c9d986f9a8 args completion for rc commands 2022-11-14 15:41:57 +05:30
Kovid Goyal
d4b67f3b6a ... 2022-11-14 15:41:57 +05:30
Kovid Goyal
6faa908733 And more corner cases 2022-11-14 15:41:57 +05:30
Kovid Goyal
ced741b247 More corner cases 2022-11-14 15:41:57 +05:30
Kovid Goyal
c47ccc8a59 ... 2022-11-14 15:41:57 +05:30
Kovid Goyal
3326e9ef49 Move code to walk with symlinks to the utils module 2022-11-14 15:41:57 +05:30
Kovid Goyal
134fce8507 Allow completing paths with ~ prefix 2022-11-14 15:41:57 +05:30
Kovid Goyal
5d89a6c3c4 Work on completion of file args 2022-11-14 15:41:57 +05:30
Kovid Goyal
833e9625f9 Add a generated comment in *_generated.go in the style used by go generate 2022-11-14 15:41:57 +05:30
Kovid Goyal
21b572d69a Allow building kitty-tool as a static binary 2022-11-14 15:41:57 +05:30
Kovid Goyal
12d9787d0e update go deps 2022-11-14 15:41:57 +05:30
Kovid Goyal
8c6b391eda ... 2022-11-14 15:41:57 +05:30
Kovid Goyal
8c2e435793 Code to complete executables in PATH 2022-11-14 15:41:57 +05:30
Kovid Goyal
10cf7f06c6 Code to get file/dir completion candidates for a prefix 2022-11-14 15:41:56 +05:30
Kovid Goyal
4575a14873 work on framework for testing completion 2022-11-14 15:41:56 +05:30
Kovid Goyal
d679ea2cdf Allow generating completions for multiple command lines for more efficient testing 2022-11-14 15:41:56 +05:30
Kovid Goyal
54378de52b More work on command completion 2022-11-14 15:41:56 +05:30
Kovid Goyal
63287e4115 More work on completions 2022-11-14 15:41:56 +05:30
Kovid Goyal
d0efe00449 Use replace_if_needed() for at commands 2022-11-14 15:41:56 +05:30
Kovid Goyal
d703cb51cd ... 2022-11-14 15:41:56 +05:30
Kovid Goyal
005a9c7090 Add an entry point for the completion tool 2022-11-14 15:41:56 +05:30
Kovid Goyal
f4de6d2a10 More work on completions 2022-11-14 15:41:56 +05:30
Kovid Goyal
e60b331152 start work on porting completion to Go 2022-11-14 15:41:56 +05:30
Kovid Goyal
3d79eb5730 more tests for indent and wrap 2022-11-14 15:41:56 +05:30
Kovid Goyal
af7f4e97cf More work on the new formatter 2022-11-14 15:41:56 +05:30
Kovid Goyal
aad8cb3d1e Use the new formatter for CLI help output 2022-11-14 15:41:56 +05:30
Kovid Goyal
40a9ab8929 Allow ignoring lines containing a sentinel 2022-11-14 15:41:56 +05:30
Kovid Goyal
e433b90297 Dont drop trailing escape codes when stripping trailing whitespace 2022-11-14 15:41:56 +05:30
Kovid Goyal
1ac7d9c10d Basic wrap is working 2022-11-14 15:41:56 +05:30
Kovid Goyal
ef5f0025e1 Start work on more sophisticated indent+wrap implementation 2022-11-14 15:41:56 +05:30
Kovid Goyal
32804f01b2 Allow parsing strings with escape code parser 2022-11-14 15:41:55 +05:30
Kovid Goyal
7ecc1b7950 Remove markup from ref_hyperlink text 2022-11-14 15:41:55 +05:30
Kovid Goyal
a7f6105393 Use Unsafe rather than Dangerous to be consistent 2022-11-14 15:41:55 +05:30
Kovid Goyal
081390b5a2 Utility functions to allow using string/[]byte interchangeably without copies 2022-11-14 15:41:55 +05:30
Kovid Goyal
61094c6bfb Add strikethrough formatting 2022-11-14 15:41:55 +05:30
Kovid Goyal
6672904e64 Fix spurious error message when setting image to none 2022-11-14 15:41:55 +05:30
Kovid Goyal
905c4d641c Allow using many image formats in RC commands 2022-11-14 15:41:55 +05:30
Kovid Goyal
fa7a6dfd4a Implement stdin echo loop for socket i/o as well 2022-11-14 15:41:55 +05:30
Kovid Goyal
cb452ba9fc Implement sen text from stdin for the tty backend 2022-11-14 15:41:55 +05:30
Kovid Goyal
85169c989f ... 2022-11-14 15:41:55 +05:30
Kovid Goyal
e8a321d097 Port code to serialize key events as CSI to Go 2022-11-14 15:41:55 +05:30
Kovid Goyal
3a198833da Simplify escape code wrapping 2022-11-14 15:41:55 +05:30
Kovid Goyal
ea8fb10c05 Password input: Handle SIGTSTP 2022-11-14 15:41:55 +05:30
Kovid Goyal
67115530b4 Make the loop API a thin wrapper around internal methods 2022-11-14 15:41:55 +05:30
Kovid Goyal
7325921070 Allow cancel async commands without auth 2022-11-14 15:41:55 +05:30
Kovid Goyal
f86ce03d3b Fix set-colors 2022-11-14 15:41:55 +05:30
Kovid Goyal
5cf10023c9 Nicer API for setting loop options 2022-11-14 15:41:55 +05:30
Kovid Goyal
93d08011f1 ... 2022-11-14 15:41:54 +05:30
Kovid Goyal
7f77f7e408 Only send cancel async if there is an async id 2022-11-14 15:41:54 +05:30
Kovid Goyal
65c3630099 send_text other than from stdin works 2022-11-14 15:41:54 +05:30
Kovid Goyal
457aab7c41 Simplify timer removal 2022-11-14 15:41:54 +05:30
Kovid Goyal
dcec926590 Do not allow adding timers before loop is run 2022-11-14 15:41:54 +05:30
Kovid Goyal
0a2455c8be Get scroll_window working 2022-11-14 15:41:54 +05:30
Kovid Goyal
bacca88213 Get set_font_size working 2022-11-14 15:41:54 +05:30
Kovid Goyal
bd1b3d9f6e Implement streaming mode for socket IO 2022-11-14 15:41:54 +05:30
Kovid Goyal
364533b1ed Work on supporting streaming remote commands with passwords 2022-11-14 15:41:54 +05:30
Kovid Goyal
d7985689c9 Allow debugprintln to controlling tty easily 2022-11-14 15:41:54 +05:30
Kovid Goyal
6d6bba4a4c debugprintln should be in-band for the loop 2022-11-14 15:41:54 +05:30
Kovid Goyal
5cc5759f3e flush_pending_writes must be non-blocking 2022-11-14 15:41:54 +05:30
Kovid Goyal
a388a658ce Fix payload update code in multi send commands 2022-11-14 15:41:54 +05:30
Kovid Goyal
b5e2871aa0 Remove not needed chunking code 2022-11-14 15:41:54 +05:30
Kovid Goyal
192eccc6cc More work on porting rc commands 2022-11-14 15:41:54 +05:30
Kovid Goyal
a4b2e2a196 more work on porting command parsing to Go 2022-11-14 15:41:54 +05:30
Kovid Goyal
6f4968305a more work on porting rc command parsing to Go 2022-11-14 15:41:54 +05:30
Kovid Goyal
79c8862d4c Work on conversion of args parsing to go code 2022-11-14 15:41:53 +05:30
Kovid Goyal
441e4edfb2 Also ensure kitty-tool bootstrap is executable 2022-11-14 15:41:53 +05:30
Kovid Goyal
ef71b071db Automap a bunch of json fields from identically named options 2022-11-14 15:41:53 +05:30
Kovid Goyal
b33a684357 ... 2022-11-14 15:41:53 +05:30
Kovid Goyal
43b35f6f4e Move GoOption migration code to cli.py for re-use 2022-11-14 15:41:53 +05:30
Kovid Goyal
3b2c4561c2 Dont change the env for go tests
This prevents got test caching from working greatly increasing the time
for running a test
2022-11-14 15:41:53 +05:30
Kovid Goyal
e69b02ad46 ... 2022-11-14 15:41:53 +05:30
Kovid Goyal
85b6053380 Run go tests in parallel 2022-11-14 15:41:53 +05:30
Kovid Goyal
249df69ac9 Use the new styling API for CLI infra 2022-11-14 15:41:53 +05:30
Kovid Goyal
4a4500d56b Dont make urls part of styling, instead have a dedicated UrlFunc API
Since urls can potentially change a lot, caching them makes no sense
2022-11-14 15:41:53 +05:30
Kovid Goyal
be22f49012 Fix usage of numbered colors for underlines 2022-11-14 15:41:53 +05:30
Kovid Goyal
f9695a7947 Add url support to styling 2022-11-14 15:41:53 +05:30
Kovid Goyal
29d9b70f0c More ansi styling tests 2022-11-14 15:41:53 +05:30
Kovid Goyal
42a8ca0842 Write some tests for the style wrapper 2022-11-14 15:41:53 +05:30
Kovid Goyal
91c61478dd Start work on easily generating ANSI formatted strings 2022-11-14 15:41:53 +05:30
Kovid Goyal
fb482e28f6 ... 2022-11-14 15:41:53 +05:30
Kovid Goyal
387333492b Generate color names and table for Go
Also exclude generated files from gofmt checking
2022-11-14 15:41:53 +05:30
Kovid Goyal
9c58cb3f41 ... 2022-11-14 15:41:52 +05:30
Kovid Goyal
b2e610f9b1 Implement socket I/O 2022-11-14 15:41:52 +05:30
Kovid Goyal
a960937095 Simplify serialization code and avoid extra copy 2022-11-14 15:41:52 +05:30
Kovid Goyal
0cda5d43a6 Fix final write detection 2022-11-14 15:41:52 +05:30
Kovid Goyal
a75d59643c Use one less channel 2022-11-14 15:41:52 +05:30
Kovid Goyal
bf35817d73 No need to store most channels on self 2022-11-14 15:41:52 +05:30
Kovid Goyal
f103f8d5db Create a in src symlink for kitty-tool as well 2022-11-14 15:41:52 +05:30
Kovid Goyal
b382587776 another attempt 2022-11-14 15:41:52 +05:30
Kovid Goyal
6fe0c8ba2f dump tree 2022-11-14 15:41:52 +05:30
Kovid Goyal
7b2991de02 ... 2022-11-14 15:41:52 +05:30
Kovid Goyal
1b90c03304 Refactor loop code into its own package 2022-11-14 15:41:52 +05:30
Kovid Goyal
0aa05b02e8 Cleanup 2022-11-14 15:41:52 +05:30
Kovid Goyal
5412a0126c we generate more than just rc commands 2022-11-14 15:41:52 +05:30
Kovid Goyal
841b368021 DRYer 2022-11-14 15:41:52 +05:30
Kovid Goyal
b1f9139ca5 Use a fully random async_id rather than a uuid 2022-11-14 15:41:52 +05:30
Kovid Goyal
4a49c3940a Switch to using goroutines rather than a select()
More complex code since now we have to synchronize between threads,
but a good way to teach myself more about goroutines.
2022-11-14 15:41:52 +05:30
Kovid Goyal
ee12349a50 Use Go's os.File this allows us to implement WriteString without using unsafe 2022-11-14 15:41:52 +05:30
Kovid Goyal
69c847a48f Fix failing test 2022-11-14 15:41:51 +05:30
Kovid Goyal
03705cbec0 Fix transmission of async rc commands 2022-11-14 15:41:51 +05:30
Kovid Goyal
ff2ff9c04f Port short uuid code to Go 2022-11-14 15:41:51 +05:30
Kovid Goyal
a22ba9f739 Fix failing test 2022-11-14 15:41:51 +05:30
Kovid Goyal
c86f8a698c @ ls works phew 2022-11-14 15:41:51 +05:30
Kovid Goyal
fa4711bd04 Give the kill signal time to be delivered 2022-11-14 15:41:51 +05:30
Kovid Goyal
a939bbb3ec ... 2022-11-14 15:41:51 +05:30
Kovid Goyal
174bc25afb Make timeout checking more efficient 2022-11-14 15:41:51 +05:30
Kovid Goyal
2ffba1c422 Work on implementing ttyio via TUI 2022-11-14 15:41:51 +05:30
Kovid Goyal
0913b64c6b Dont vendor base85 2022-11-14 15:41:51 +05:30
Kovid Goyal
32e59257d2 Refactor io in preparation for using tui 2022-11-14 15:41:51 +05:30
Kovid Goyal
6f8c884bb5 Also handle SIGPIPE as the Go runtime does funky things with this signal 2022-11-14 15:41:51 +05:30
Kovid Goyal
80c5ac891d Add license info to Go files 2022-11-14 15:41:51 +05:30
Kovid Goyal
ccb60687b6 Prefix names of cmd files 2022-11-14 15:41:51 +05:30
Kovid Goyal
6a2393299b Add a write completed callback 2022-11-14 15:41:51 +05:30
Kovid Goyal
ab66b3f4c0 Add timer infra to the loop 2022-11-14 15:41:51 +05:30
Kovid Goyal
c8292d77f1 Re-use the escape code parser for wcswidth calculation 2022-11-14 15:41:51 +05:30
Kovid Goyal
7280c712d6 Move escape code parser into wcswidth package 2022-11-14 15:41:50 +05:30
Kovid Goyal
9be2247081 Dont use the syscall package 2022-11-14 15:41:50 +05:30
Kovid Goyal
e68b5fa504 Add callback for screen resize handling 2022-11-14 15:41:50 +05:30
Kovid Goyal
c2ef6c986b Password input now works 2022-11-14 15:41:50 +05:30
Kovid Goyal
619fcb0681 Allow debug printing 2022-11-14 15:41:50 +05:30
Kovid Goyal
10a39d3757 Fix reset mode incorrectly setting mode instead 2022-11-14 15:41:50 +05:30
Kovid Goyal
d2a15a2009 Make using alternate screen the default 2022-11-14 15:41:50 +05:30
Kovid Goyal
235eb868b2 More misc fixes for TUI 2022-11-14 15:41:50 +05:30
Kovid Goyal
5703a3370e Move wcswidth into its own package as it is very slow to build 2022-11-14 15:41:50 +05:30
Kovid Goyal
5dca2a1a25 Fix stringifying mods 2022-11-14 15:41:50 +05:30
Kovid Goyal
4b18b575cd Misc fixes for TUI 2022-11-14 15:41:50 +05:30
Kovid Goyal
818f68ec53 Initialize various maps 2022-11-14 15:41:50 +05:30
Kovid Goyal
cd54fefa99 Ignore more types of temporary errors 2022-11-14 15:41:50 +05:30
Kovid Goyal
4ab5456ead Less layering 2022-11-14 15:41:49 +05:30
Kovid Goyal
10d11bc749 Drop another dependency 2022-11-14 15:41:49 +05:30
Kovid Goyal
19ffbc6f3d Implement wcswidth() for Go 2022-11-14 15:41:49 +05:30
Kovid Goyal
79b1af28b4 Fix errors reported by compiler 2022-11-14 15:41:49 +05:30
Kovid Goyal
05d768d8df Generate a wcwidth for Go as well 2022-11-14 15:41:49 +05:30
Kovid Goyal
7bb310d3af Port recent changes from cli.py to Go 2022-11-14 15:41:49 +05:30
Kovid Goyal
9d56f8eed2 Use TUI to build a nice password read control 2022-11-14 15:41:49 +05:30
Kovid Goyal
42a5129553 Wire up key handling 2022-11-14 15:41:49 +05:30
Kovid Goyal
d6ed20323b Implement key event parsing and matching 2022-11-14 15:41:49 +05:30
Kovid Goyal
63fdbd3fa0 Start work on decoding key events in Go 2022-11-14 15:41:49 +05:30
Kovid Goyal
99fde8723a Wire up the signal handlers 2022-11-14 15:41:49 +05:30
Kovid Goyal
526a331f47 Wire up a bunch of callbacks 2022-11-14 15:41:49 +05:30
Kovid Goyal
e18b6638bb Allow propagating errors from the escape code handlers 2022-11-14 15:41:49 +05:30
Kovid Goyal
3c3e7b7f70 Start work on proper TUI support 2022-11-14 15:41:49 +05:30
Kovid Goyal
67f03621ae Handle EINTR in IsTerminal 2022-11-14 15:41:49 +05:30
Kovid Goyal
10cef16210 DRYer 2022-11-14 15:41:49 +05:30
Kovid Goyal
6a79b450f7 Drop another dependency and get a better read password function 2022-11-14 15:41:48 +05:30
Kovid Goyal
eb4ee13f73 Drop another dependency 2022-11-14 15:41:48 +05:30
Kovid Goyal
cf287015de ... 2022-11-14 15:41:48 +05:30
Kovid Goyal
246277e7af Refactor tty code into its own package 2022-11-14 15:41:48 +05:30
Kovid Goyal
13758e9600 Drop one dependency 2022-11-14 15:41:48 +05:30
Kovid Goyal
73e4deb1c2 Show suggestions based on levenshtein distance 2022-11-14 15:41:48 +05:30
Kovid Goyal
68d589826a ... 2022-11-14 15:41:48 +05:30
Kovid Goyal
7457746d65 Fix @command form not supporting global options 2022-11-14 15:41:48 +05:30
Kovid Goyal
eec8f04e93 fix reading from tty 2022-11-14 15:41:48 +05:30
Kovid Goyal
3a7d26a3ef Work on reading command responses 2022-11-14 15:41:48 +05:30
Kovid Goyal
91b15d1a90 Fix incorrect err handling 2022-11-14 15:41:48 +05:30
Kovid Goyal
12b0f632bd Allow OSC to be terminated by BEL
Also prevent changing streaming state unless in reset state
2022-11-14 15:41:48 +05:30
Kovid Goyal
84cb2638d6 Work on an escape code parser 2022-11-14 15:41:48 +05:30
Kovid Goyal
7eb6cb2407 Update script that counts lines of code 2022-11-14 15:41:48 +05:30
Kovid Goyal
ce3062cbde UTF-8 decode/encode for Go
The builtin utf-8 package has semantics not suitable for us
2022-11-14 15:41:48 +05:30
Kovid Goyal
e599a2c87f The stupid term package is not EINTR safe 2022-11-14 15:41:48 +05:30
Kovid Goyal
15e1f376a4 EINTR safe function to get tty size 2022-11-14 15:41:48 +05:30
Kovid Goyal
82d0bd9364 Use the term package to get tty size since it has a function for it 2022-11-14 15:41:47 +05:30
Kovid Goyal
6a9f3feba2 ... 2022-11-14 15:41:47 +05:30
Kovid Goyal
2e31178980 Workaround for go unix package not wrapping pselect() on darwin 2022-11-14 15:41:47 +05:30
Kovid Goyal
141b9c8f08 Adjust select() timeout on EINTR 2022-11-14 15:41:47 +05:30
Kovid Goyal
17629add66 Handle EINTR 2022-11-14 15:41:47 +05:30
Kovid Goyal
352a78f056 Add a debug print method to tty and use pselect rather than select for greater timeout precision 2022-11-14 15:41:47 +05:30
Kovid Goyal
2ef5d0a140 ... 2022-11-14 15:41:47 +05:30
Kovid Goyal
08b4741024 Get rid of a couple of unneeded dependencies 2022-11-14 15:41:47 +05:30
Kovid Goyal
11ffa961bc Use local hyperlinks for :doc: 2022-11-14 15:41:47 +05:30
Kovid Goyal
ad6d928c12 Port various recent changes to CLI help output 2022-11-14 15:41:47 +05:30
Kovid Goyal
74b768bfc2 ... 2022-11-14 15:41:47 +05:30
Kovid Goyal
9b703078dd See if at least the field names are the same 2022-11-14 15:41:47 +05:30
Kovid Goyal
43e93414ea Some work on implementing TTYIO 2022-11-14 15:41:47 +05:30
Kovid Goyal
6c3a439455 Use the io.Reader interface 2022-11-14 15:41:47 +05:30
Kovid Goyal
a7bc2fcba8 Code to parse socket addresses 2022-11-14 15:41:47 +05:30
Kovid Goyal
417c8887b9 Start on testing infra for command to JSON serialization 2022-11-14 15:41:47 +05:30
Kovid Goyal
47feb73cdf Code to generate structs for JSON marshalling 2022-11-14 15:41:47 +05:30
Kovid Goyal
0aa1bacbe7 ... 2022-11-14 15:41:47 +05:30
Kovid Goyal
63512f0512 Implement setting of option values into a struct 2022-11-14 15:41:46 +05:30
Kovid Goyal
a32251cab4 Handle aliased flags 2022-11-14 15:41:46 +05:30
Kovid Goyal
2ca8ae8e5f normalize flag names so that underscores are interchangeable with hyphens 2022-11-14 15:41:46 +05:30
Kovid Goyal
2d466f343d Finish mapping of python cli opt to go cli opt 2022-11-14 15:41:46 +05:30
Kovid Goyal
4596dc39ce Fix formatting of lines with only spaces 2022-11-14 15:41:46 +05:30
Kovid Goyal
605882582e Transfer response_timeout 2022-11-14 15:41:46 +05:30
Kovid Goyal
a5876e5231 Refactor conversion of py opt to go opt 2022-11-14 15:41:46 +05:30
Kovid Goyal
e127579ae6 DRYer 2022-11-14 15:41:46 +05:30
Kovid Goyal
b3be6792fd General cleanup 2022-11-14 15:41:46 +05:30
Kovid Goyal
6c25f0cf4b Use cobra's builtin machinery for creating new types 2022-11-14 15:41:46 +05:30
Kovid Goyal
a0bff4abab Let kitty-tool know if it was built for a frozen kitty 2022-11-14 15:41:46 +05:30
Kovid Goyal
82410c58ed Hide the default completion command 2022-11-14 15:41:46 +05:30
Kovid Goyal
3a87cfce3e Get bool set flags ported 2022-11-14 15:41:46 +05:30
Kovid Goyal
15ffd8e6d8 Support older Go 2022-11-14 15:41:46 +05:30
Kovid Goyal
33e16df586 Add some basic RC serialization tests 2022-11-14 15:41:46 +05:30
Kovid Goyal
4432c1a2ea Move the command types into a separate package 2022-11-14 15:41:46 +05:30
Kovid Goyal
45540561cc More debug info about PATH in CI 2022-11-14 15:41:46 +05:30
Kovid Goyal
f90753c69b Use whatever version of go is available on CI 2022-11-14 15:41:46 +05:30
Kovid Goyal
bab914c497 Create hidden alias commands so kitty-tool @ls also works 2022-11-14 15:41:45 +05:30
Kovid Goyal
d3bb69a0ac strip whitespace from long descriptions just to be safe 2022-11-14 15:41:45 +05:30
Kovid Goyal
e356af2dc4 Build kitty-tool as a universal binary for freeze builds on macOS 2022-11-14 15:41:45 +05:30
Kovid Goyal
e9e7b97c48 And we have frozen builds working with kitty-tool 2022-11-14 15:41:45 +05:30
Kovid Goyal
1c7d6f8bc6 Dont sync kitty-tool to build vms 2022-11-14 15:41:45 +05:30
Kovid Goyal
82a0e56eb2 Fix go tests not being excluded correctly 2022-11-14 15:41:45 +05:30
Kovid Goyal
54fd2c6773 Get linux freeze working 2022-11-14 15:41:45 +05:30
Kovid Goyal
fb4c7db25e Add a test for existence of kitty-tool 2022-11-14 15:41:45 +05:30
Kovid Goyal
c85af36116 Simplify cleanup and ignoring of generated go files 2022-11-14 15:41:45 +05:30
Kovid Goyal
780b5ca8bd misc fixes 2022-11-14 15:41:45 +05:30
Kovid Goyal
20ad7ca437 Output VCSRevision with --version 2022-11-14 15:41:45 +05:30
Kovid Goyal
d39036de2a Add vcs revision to version string 2022-11-14 15:41:45 +05:30
Kovid Goyal
4ac4ee643e Have the rc command wrapper sauto-generated on build 2022-11-14 15:41:45 +05:30
Kovid Goyal
47f35a06e6 Start work on generating rc cmd wrappers 2022-11-14 15:41:45 +05:30
Kovid Goyal
77f7ce82c0 Parse global options 2022-11-14 15:41:45 +05:30
Kovid Goyal
10b74d0703 Update documentation of --to 2022-11-14 15:41:45 +05:30
Kovid Goyal
393820e77a Dont sort flags by default 2022-11-14 15:41:45 +05:30
Kovid Goyal
1b8805bc6f document we need go >= 1.19 2022-11-14 15:41:44 +05:30
Kovid Goyal
07dc83670b Fix go in home dir getting removed from PATH on CI 2022-11-14 15:41:44 +05:30
Kovid Goyal
1429be3a19 Run gofmt via python, easier to debug 2022-11-14 15:41:44 +05:30
Kovid Goyal
4b69a600e5 Nicer error when go is not found during build 2022-11-14 15:41:44 +05:30
Kovid Goyal
ce9a5528bc Pass verbose to go build 2022-11-14 15:41:44 +05:30
Kovid Goyal
2ea3fa36d2 ... 2022-11-14 15:41:44 +05:30
Kovid Goyal
14262b158d Log which go exe is being used to run the tests 2022-11-14 15:41:44 +05:30
Kovid Goyal
2fd013b593 Add source code linting for go to CI 2022-11-14 15:41:44 +05:30
Kovid Goyal
1325844539 Add some go testing infrastructure 2022-11-14 15:41:44 +05:30
Kovid Goyal
3a21605b05 ... 2022-11-14 15:41:44 +05:30
Kovid Goyal
cea9ff30dc Add the go dependency to CI and Brewfile 2022-11-14 15:41:44 +05:30
Kovid Goyal
63da2e1ec6 gofmt 2022-11-14 15:41:44 +05:30
Kovid Goyal
083deec663 Build kitty-tool via the build system 2022-11-14 15:41:44 +05:30
Kovid Goyal
8b91c227f6 ... 2022-11-14 15:41:44 +05:30
Kovid Goyal
06bd1f5d48 DRYer 2022-11-14 15:41:44 +05:30
Kovid Goyal
a7f0a471ed Dont fail to output usage when less is not present 2022-11-14 15:41:44 +05:30
Kovid Goyal
2a7aa46b77 Use pager even for usage + error 2022-11-14 15:41:44 +05:30
Kovid Goyal
c04b002d4e Use a pager for displaying usage, matches kitty behavior
Also dont tell less to squeeze lines
2022-11-14 15:41:44 +05:30
Kovid Goyal
46840df1ad CLI help output make kitty.conf a clickable URL 2022-11-14 15:41:43 +05:30
Kovid Goyal
aaf0dea8dc Use a single wrapper binary for all command line tools
This is because Go has a multi megabyte overhead for its binaries
2022-11-14 15:41:43 +05:30
Kovid Goyal
abaafc2d68 Parse roles in the help strings 2022-11-14 15:41:43 +05:30
Kovid Goyal
c97556de65 Show help when command is specified 2022-11-14 15:41:43 +05:30
Kovid Goyal
bbf7504303 Start work on implementing kitty @ as a static binary using Go 2022-11-14 15:41:43 +05:30
Kovid Goyal
126468a5dd Fix #5668 2022-11-14 15:40:24 +05:30
Kovid Goyal
8280899ce1 IBUS: When creating the connection mark as focused if any top level window has focus. Fixes #5655 2022-11-10 07:21:34 +05:30
Kovid Goyal
b15c9f7419 Function should be static 2022-11-10 07:18:17 +05:30
Kovid Goyal
2e8ef66496 Another mypy update another round of spurious errors 2022-11-08 17:17:40 +05:30
Kovid Goyal
72f92b395f version 0.26.5 2022-11-07 15:36:42 +05:30
Kovid Goyal
c9c8eb6e94 ... 2022-11-05 11:37:07 +05:30
Kovid Goyal
59ded41f7a When no OS Window is focused the active_* should return those belonging to the last focused OS Window 2022-11-05 11:34:10 +05:30
Kovid Goyal
10ad56885e Properly specify semantics of active and focused
active means active in parent. focused means actually has keyboard
focus.
2022-11-04 10:38:18 +05:30
Kovid Goyal
d1eb9340ac Output the actual tab id in its repr 2022-11-04 09:29:33 +05:30
Kovid Goyal
a856c64104 Have the semantics of is_focused match that of state:focused otherwise things are liable to get confusing
The previous value is now available as is_active_window
2022-11-03 22:32:07 +05:30
Kovid Goyal
c0b11c5656 Also change the behavior of state:focused matching for tabs 2022-11-03 21:56:23 +05:30
Kovid Goyal
935c4ded6b Remote control: When matching window by state:focused match the window belonging to the OS window that was last focused
Fixes #5602
2022-11-03 21:52:20 +05:30
Kovid Goyal
f5de08d5fa Splits layout: Add a new mappable action to move the active window to the screen edge
Fixes #5643
2022-11-03 17:40:04 +05:30
Kovid Goyal
9d471782dd Increase some more timeouts 2022-11-03 13:13:14 +05:30
Kovid Goyal
dea3df66f8 system python appears broken on macos-latest image
The pip scripts install directory is not on PATH
2022-11-03 13:05:03 +05:30
Kovid Goyal
ec80a1532c Try to make mypy happy with the contortions needed for importlib.resources 2022-11-03 12:41:13 +05:30
Kovid Goyal
93563f1280 More pointless code churn thanks to importlib.resources
They've deprecated a bunch of API but the suggested replacement is
either not present in versions of python that are not EOLed or doesn't
actually work.
2022-11-03 12:13:47 +05:30
Kovid Goyal
e309e54002 Allow using the re module in tab title templates
Fix #5639
2022-11-01 22:25:58 +05:30
Kovid Goyal
0b3228ab16 ... 2022-11-01 12:51:36 +05:30
Kovid Goyal
3f28cf45d4 Dont use the deprecated importlib.resources API 2022-11-01 12:38:24 +05:30
Kovid Goyal
88b829fc9b cleanup comment 2022-11-01 12:22:05 +05:30
Kovid Goyal
458ac6953f Update changelog for last PR 2022-11-01 12:21:09 +05:30
Kovid Goyal
a6855bde3c Merge branch 'no_cursor_update_if_not_changed' of https://github.com/wengxt/kitty 2022-11-01 12:20:18 +05:30
Kovid Goyal
f6f2f00c53 Add a note about wayland semantics 2022-11-01 12:13:23 +05:30
Kovid Goyal
00324c96fc ... 2022-10-31 22:09:01 +05:30
Kovid Goyal
2435a8ccfd Wayland GNOME: Fix incorrect window size when in some circumstances when switching between windows with window decorations disabled
Only call wl_surface_commit() after a resize when the correct size buffer is
attached to the surface. This is ensured by setting a flag on the window that prevents
all surface commits till it is cleared. The flag is cleared at next
eglSwapBuffers().

I dont actually understand if this guarantees that the
buffer size is always correct. For example, if the back buffer is
latched when wl_egl_resize_window() is called, the backbuffer will be
correct only after two swaps (I think). Or maybe the old back buffer is
discarded, I cant find any documentation about it.

All I can say is that doing it this way seems to fix the issue.

Thanks to @jadahl for his help with tracking down the root cause.

Fixes #4802
2022-10-31 21:59:01 +05:30
Kovid Goyal
de122ed727 Bind eglQuerySurface 2022-10-31 21:03:39 +05:30
Kovid Goyal
c2ead407ae ... 2022-10-31 18:14:38 +05:30
Kovid Goyal
16b322616a Fix cursor position at x=0 changing to x=1 on resize
Fixes #5635
2022-10-31 08:03:42 +05:30
Kovid Goyal
e0b4c7edc5 Increase the timeout for shell integration tests
Needed for ARM running non-natively
2022-10-30 11:09:36 +05:30
Kovid Goyal
a8ab4eaf23 Use a larger timeout when running prewarm test 2022-10-30 10:36:10 +05:30
Kovid Goyal
3847837bd0 Forgot to run gen-config.py 2022-10-19 20:50:53 +05:30
Kovid Goyal
1747bbbbcb ssh kitten: Allow using absolute paths for the location of transferred data
Fixes #5607
2022-10-19 20:43:53 +05:30
Kovid Goyal
90e80477e9 Fix background_tint with background_opacity < 1 causing colors in cell area and padding to not match 2022-10-19 19:24:37 +05:30
Kovid Goyal
4f90110a7c Fix ghosting when using background_tint under GNOME+Wayland
The problem was that on Wayland if the buffer contains pixels with alpha
< 1 they are blended with something, even if the window is opaque. Under
mutter that something was the previous frame, under sway it was the
background/whatever is under the window.

So when blending the tint color, use a blend mode that results in opaque
pixels.

Fixes #5605
2022-10-19 19:02:05 +05:30
Kovid Goyal
28c616d3ff Move blend mode selection into draw_tint 2022-10-19 17:13:46 +05:30
Kovid Goyal
f5126c664c Wayland KDE: Fix abort when pasting into Firefox
Dunno why kwin uses drag and drop callbacks when pasting into Firefox on
Wayland, but then this is Wayland, so every stupid thing imaginable will
be done at least once.

Fixes #5603
2022-10-19 11:28:33 +05:30
Kovid Goyal
0f340086c0 Fix resize_draw_strategy=static
The text is now static again but the background image is still scaled, cant be
bothered about that. Fixes #5601
2022-10-19 08:26:31 +05:30
Kovid Goyal
5c34f16ab4 Fix #5600 2022-10-19 07:45:27 +05:30
Kovid Goyal
03fe928e3f show progress while compressing release tarballs 2022-10-17 09:55:09 +05:30
Kovid Goyal
55b53bcac6 version 0.26.4 2022-10-17 08:18:51 +05:30
Kovid Goyal
57d044861f Merge branch 'patch-1' of https://github.com/ms-test/kitty 2022-10-16 13:28:06 +05:30
ms-test
aab149366d Check correct pair member
I haven't looked deeply, but this looked to be a simple typo unless it's checking one both times because of a type invariant. If that is the case, and the check is correct, then a comment and/or code refactoring to call attention to this would likely be a good idea.
2022-10-16 03:53:16 -04:00
Kovid Goyal
896f93822d kitty shell: Also output active tab id
Fixes #5590
2022-10-16 08:52:35 +05:30
Kovid Goyal
6890e265b6 GNOME Wayland: Fix a memory leak in gnome-shell when using client side decorations
destroy CSD buffers that were never attached explicitly, as mutter does
not send release events for these even when the pool is destroyed.
2022-10-12 17:52:47 +05:30
Kovid Goyal
48a4edc199 Merge branch 'action_cwd_doc' of https://github.com/cbosdo/kitty 2022-10-10 14:04:29 +05:30
Cédric Bosdonnat
d63be90a7f Recommend using --cwd=current in open-actions.conf
Editors like Vim are basing path-related commands on the current working
directory. Launching the action with the current CWD in hyperlink opens
makes life easier and would work with every editor.
2022-10-10 10:12:20 +02:00
Kovid Goyal
6af020e4ef Merge branch 'marksisson/simple-docs-change' of https://github.com/marksisson/kitty 2022-10-09 12:18:25 +05:30
Mark Sisson
ca24e9ca67 change linux_package build instructions to use make target 2022-10-09 00:02:38 -05:00
Kovid Goyal
fbfaefd72a Wayland: Fix an abort when changing background colors with wayland_titlebar_color set to background
Fixes #5562
2022-10-07 14:13:12 +05:30
Kovid Goyal
94b3776066 Merge branch 'master' of https://github.com/Diff-fusion/kitty 2022-10-05 09:09:23 +05:30
Felix
15e4be9051 Fix clipboard target properties and memory leak 2022-10-04 17:22:15 +02:00
Kovid Goyal
ae8f3de070 Allow centering the background image
Fixes #5525
2022-10-04 08:26:28 +05:30
Kovid Goyal
c8d18ffe26 Add a note about yet another gnome bug 2022-10-03 22:06:00 +05:30
Kovid Goyal
4d80427908 Wayland: Fix background image scaling using tiled mode on high DPI screens 2022-10-03 21:49:52 +05:30
Kovid Goyal
0e69324469 Fix resize draw strategy == static causing background image/borders to not be drawn 2022-10-03 21:40:00 +05:30
Kovid Goyal
cf22729dfa Fix background_tint not applying to window margins and padding
Fixes #3933
2022-10-03 21:39:57 +05:30
Kovid Goyal
1402c5bbfa Forgot to change check for space for next tab to use its max tab length rather than the current tabs max tab length, since they can now be different 2022-10-03 16:21:50 +05:30
Kovid Goyal
f0f0c8f4fe max_title_length -> max_tab_length 2022-10-03 16:15:24 +05:30
Kovid Goyal
96faac95db DRYer 2022-10-03 15:32:42 +05:30
Kovid Goyal
08041415d1 Document the purpose of for_layout 2022-10-03 13:26:55 +05:30
Kovid Goyal
647b18d345 Tab bar: Improve empty space management when some tabs have short titles, allocate the saved space to the active tab
Fixes #5548
2022-10-03 13:24:21 +05:30
Kovid Goyal
a116e3cadd Merge branch 'patch-1' of https://github.com/sorrycc/kitty 2022-09-30 07:46:32 +05:30
chencheng (云谦)
52c9b5f5b8 Update custom.css 2022-09-30 08:44:09 +08:00
Kovid Goyal
bbc9f588f1 Merge branch 'unicode-15' of https://github.com/page-down/kitty 2022-09-29 09:17:02 +05:30
pagedown
13a3c6b5b2 Update to Unicode 15.0 2022-09-29 10:13:21 +08:00
pagedown
fc15b20f24 Update to Nerd Fonts 2.2.2 2022-09-29 10:13:10 +08:00
Kovid Goyal
cd8f2e5cc6 another mypy update another round of breakage 2022-09-27 07:19:03 +05:30
Kovid Goyal
267798a277 Update the docs of open_url_with to indicate that open-actions.conf is read by the "default" handler 2022-09-26 20:21:44 +05:30
Kovid Goyal
921ac12e90 Clear both actions caches when config file is reloaded 2022-09-26 20:15:08 +05:30
Kovid Goyal
901e00cab1 Cleanup previous PR
1) Dont use deprecated code
2) Always set the dock icon on startup as the dock icon doesnt change
   till the dock is restarted
3) Update the app icon automatically if the mtime on the custom icon in
   the config dir is newer than the mtime of the sentinel file apple
   puts inside the application bundle to indicate it has a custom icon
2022-09-25 18:11:17 +05:30
Kovid Goyal
d0769f3979 ... 2022-09-25 17:36:32 +05:30
Kovid Goyal
7e4dd8cf1e Merge branch 'macos-set-icon' of https://github.com/page-down/kitty 2022-09-25 14:40:36 +05:30
Kovid Goyal
5ea0519f62 Pass through python used for type check to the test code from before the env is sanitized 2022-09-25 14:36:12 +05:30
pagedown
a1029418f8 macOS: Allow to set custom app icon automatically 2022-09-25 15:25:43 +08:00
Kovid Goyal
98eacb2067 panel kitten: Do not depend on xprop 2022-09-24 15:44:54 +05:30
Kovid Goyal
2cef9abbd3 Get rid of one call to xprop in the panel kitten 2022-09-24 15:17:11 +05:30
Kovid Goyal
0fa158c809 Merge branch 'docs' of https://github.com/page-down/kitty 2022-09-24 14:38:42 +05:30
pagedown
c54a6b398b Add some missing no_response for rc commands 2022-09-24 12:43:13 +08:00
pagedown
27ea367123 Docs: Remove the extra backslashes from the install commands 2022-09-24 12:39:05 +08:00
Kovid Goyal
42178a4570 X11: Fix a regression in the previous release that caused pasting from GTK based applications to have extra newlines
Fixes #5528

And let me just re-iterate, GNOME/GTK is developed by morons.
2022-09-24 08:56:50 +05:30
Kovid Goyal
e98ecc1c4f Another auto-indent fix 2022-09-24 08:34:07 +05:30
Kovid Goyal
0d64246209 fix vim autoindent 2022-09-24 08:31:14 +05:30
Kovid Goyal
a0495219ab ... 2022-09-24 08:30:40 +05:30
Kovid Goyal
9d98aa3159 Merge branch 'patch-2' of https://github.com/sashashura/kitty 2022-09-24 07:29:42 +05:30
Alex
5c82f4beca build: harden ci.yml permissions
Signed-off-by: Alex <aleksandrosansan@gmail.com>
2022-09-23 22:14:57 +02:00
Alex
13539bd8c6 build: harden codeql-analysis.yml permissions
Signed-off-by: Alex <aleksandrosansan@gmail.com>
2022-09-23 22:14:16 +02:00
Kovid Goyal
26b8ab9adf Use a regex for bracketed paste sanitization 2022-09-23 22:18:03 +05:30
Kovid Goyal
dbb97a62bf version 0.26.3 2022-09-22 13:48:20 +05:30
Kovid Goyal
b1fa1c9820 Make test a bit more robust 2022-09-21 23:16:34 +05:30
Kovid Goyal
2dc9488909 switch python autoformatter to isort+black+autoflake 2022-09-21 13:40:37 +05:30
Kovid Goyal
e2a251224d ssh kitten: Better error message when tar is missing 2022-09-21 07:34:15 +05:30
Kovid Goyal
2a2dca8a58 ... 2022-09-18 08:26:40 +05:30
Kovid Goyal
e1f3cb85c0 Window for id should not fail when not called from a callback 2022-09-18 08:24:02 +05:30
Kovid Goyal
13cf38d6c6 Update changelog 2022-09-17 18:21:28 +05:30
Kovid Goyal
5180a41e87 Fix a use-after-free when handling fake mouse clicks and the action causes windows to be removed/re-allocated
Fixes #5506
2022-09-17 18:21:10 +05:30
Kovid Goyal
1c44da2b4a Nicer error message when trying to open the config file and no editor is available 2022-09-13 17:24:11 +05:30
Kovid Goyal
bcd78c3940 Fix a regression that caused kitty not to restore SIGPIPE after python nukes it when launching children. Affects bash which does not sanitize its signal mask.
Fixes #5500
2022-09-13 07:51:32 +05:30
Kovid Goyal
fe2f3d9870 Wayland: Remove the mutter specific ignoring of the first empty surface configure event. It seems to be no longer necessary on current mutter, with the recent Wayland changes 2022-09-11 14:37:50 +05:30
Kovid Goyal
dcf2152a7a Wayland: Generate a XDG_ACTIVATION_TOKEN when opening URLs or running programs in the background via the launch action 2022-09-11 14:25:49 +05:30
Kovid Goyal
58a3baaf0f Wayland: Use XDG_ACTIVATION_TOKEN when present at launch 2022-09-11 13:43:52 +05:30
Kovid Goyal
b247759d30 DRYer 2022-09-11 13:15:42 +05:30
Kovid Goyal
ba8d30896b Try to use the activation protocol to focus windows 2022-09-11 10:39:28 +05:30
Kovid Goyal
4d30ae55f3 Wayland: Mark windows in which a bell as urgent on compositors that support the xdg-activation protocol 2022-09-11 09:33:41 +05:30
Kovid Goyal
983ab3c67d build wayland xdg-activation protocol 2022-09-10 16:08:38 +05:30
Kovid Goyal
0bf228b030 Wayland: Micro-optimization: Assume window will be shown on primary monitor so create it with its scale set to that of the primary monitor 2022-09-10 15:23:56 +05:30
Kovid Goyal
29b3a92ffc Wayland: swap buffers immediately on scale change to ensure attached buffer is a multiple of the new scale
Earlier we were only swapping buffers when ready to draw, but the
Wayland protocol  requires the attached buffer to be a multiple of the
scale. We cannot guarantee an application side swap will be triggered
before the next commit, so instead we blank the new buffer swap it in
the GLFW backend itself.

Fixes #5467
2022-09-10 15:09:46 +05:30
Kovid Goyal
23d73ec933 ... 2022-09-10 12:52:27 +05:30
Kovid Goyal
bc650f6230 Output initial window creation size in debug 2022-09-10 12:28:53 +05:30
Kovid Goyal
5272318d67 Update changelog 2022-09-10 12:10:30 +05:30
Kovid Goyal
5ba887ff68 Wayland: Fix for bug in NVIDIA drivers that prevents transparency working
Fixes #5479
2022-09-10 11:57:18 +05:30
Kovid Goyal
67d70f8b8f Apparently on Wayland we need to set the swap interval on every window not just the first. It's somehow not shared even though the context is shared? Fixes #5495 2022-09-10 10:41:31 +05:30
Kovid Goyal
0fac6e4de9 render frames should be always respected on macOS
Only Wayland suffers from flicker on resize when using render frames.
2022-09-10 10:25:42 +05:30
Kovid Goyal
1e7a11b278 Wayland: When swapping buffers in response to a configure event ensure the window is the current context otherwise the swap fails
The swap failing will mean the buffer is not attached which might cause
issues with some compsitors.
2022-09-10 10:22:09 +05:30
Kovid Goyal
6741ac2087 Sessions: Allow controlling which OS Window is active via the focus_os_window directive 2022-09-10 08:27:36 +05:30
Kovid Goyal
7b2e29a6a8 ... 2022-09-10 07:52:26 +05:30
Kovid Goyal
6f147544d2 Add ! to env var serialization test 2022-09-10 07:21:15 +05:30
Kovid Goyal
89570d3b52 ssh kitten: Fix KITTY_PUBLIC_KEY not being encoded properly when transmitting
Fixes #5496
2022-09-10 07:09:58 +05:30
Kovid Goyal
dd4a65e0c9 ... 2022-09-09 15:41:45 +05:30
Kovid Goyal
79fba9dd9a Use the dynamic property instead of testing identifier serialization 2022-09-09 15:39:00 +05:30
Kovid Goyal
b123c21010 Update changelog
Fixes #5483
2022-09-09 13:13:58 +05:30
Kovid Goyal
9c5d1f9771 Pass null bytes through the clipboard on cocoa 2022-09-09 13:12:12 +05:30
Kovid Goyal
5131224b59 Convenience code for debugging 2022-09-09 12:20:28 +05:30
Kovid Goyal
be89da2271 Handle dyn prefixes 2022-09-09 11:59:49 +05:30
Kovid Goyal
45b408a78b Allow setting arbitrary mime types 2022-09-09 11:14:12 +05:30
Kovid Goyal
0e7da8643e Get cocoa clipboard backend working 2022-09-09 10:59:10 +05:30
Kovid Goyal
410b1816ad More work on cocoa clipboard backend 2022-09-09 07:39:38 +05:30
Kovid Goyal
bcfa2a64e4 Start work on new clipboard api support for macos 2022-09-08 21:45:13 +05:30
Kovid Goyal
91c00fb5ac Implement the new clipboard API for Wayland 2022-09-08 17:29:18 +05:30
Kovid Goyal
c58d217d32 Only warn about cursor size once 2022-09-08 16:28:40 +05:30
Kovid Goyal
a9b6047741 Simplify handling of self offers 2022-09-08 15:34:14 +05:30
Kovid Goyal
6b432bee4f Cleanup sending/receiving mimetype atoms 2022-09-08 12:45:35 +05:30
Kovid Goyal
087f0b449f ... 2022-09-08 12:45:35 +05:30
Kovid Goyal
96160b52b6 Code to get the available mime types in the clipboard 2022-09-08 12:45:34 +05:30
Kovid Goyal
d17a6cd3a3 Get reading from clipboard working 2022-09-08 12:45:34 +05:30
Kovid Goyal
7e1380cc0d Start work on giving GLFW a proper clipboard API 2022-09-08 12:45:34 +05:30
Kovid Goyal
9a99554ed3 Also have confirm() and get_line() return their results on overlay removal 2022-09-08 12:06:25 +05:30
Kovid Goyal
19799bd538 When choosing an option call the callback after the popup window is removed. This ensures the active window is unchanged when the callback is called. Fixes #5488 2022-09-08 12:01:38 +05:30
Kovid Goyal
902e94ceac Fix #5484 2022-09-07 15:09:24 +05:30
Kovid Goyal
5bb2cb06a9 Fix #5477 2022-09-05 21:43:56 +05:30
Kovid Goyal
1559a2e15a Cleanup previous PR 2022-09-05 21:19:58 +05:30
Kovid Goyal
35f94963cd Merge branch 'skip-tests-bash-debug' of https://github.com/jamessan/kitty 2022-09-05 21:18:52 +05:30
James McCoy
f0d497dfe0 Skip bash shell_integration tests if bash is a debug build
Switch to using BASH_VERSINFO rather than BASH_VERSION, since it
provides structured data.

    BASH_VERSINFO
           A readonly array variable whose members hold version information for this instance of bash.  The values assigned to the array members are as follows:
           BASH_VERSINFO[0]        The major version number (the release).
           BASH_VERSINFO[1]        The minor version number (the version).
           BASH_VERSINFO[2]        The patch level.
           BASH_VERSINFO[3]        The build version.
           BASH_VERSINFO[4]        The release status (e.g., beta1).
           BASH_VERSINFO[5]        The value of MACHTYPE.

When release status is not "release", bash builds are in debug mode and
output extra information which disturbs the integration.

Closes #5473
2022-09-05 11:37:37 -04:00
Kovid Goyal
5bdf27fd78 version 0.26.2 2022-09-05 10:49:50 +05:30
Kovid Goyal
f05783e64d Sanitize notifications ids as they are retransmitted over the TTY 2022-09-05 10:41:19 +05:30
Kovid Goyal
c455fea729 Also output screen contents when test fails 2022-09-05 07:52:36 +05:30
Kovid Goyal
5bf5454dbe Nicer fix for #5469 2022-09-04 22:15:17 +05:30
Kovid Goyal
b60d9f73ce Wayland: Fix remembering window size not accurate when client side decorations are present 2022-09-04 14:25:04 +05:30
Kovid Goyal
31fe35cd38 Fix #5469 2022-09-04 13:58:16 +05:30
Kovid Goyal
607bc845fc Allow creating overlay-main windows, which are treated as the active window unlike normal overlays
Fixes #5392
2022-09-03 19:04:31 +05:30
Kovid Goyal
a420d9d19c spacing is a clone safe option 2022-09-02 23:28:58 +05:30
Kovid Goyal
4b81e4936e launch: Allow setting the margin and padding for the newly created window
Fixes #5463
2022-09-02 19:41:05 +05:30
Kovid Goyal
295743a96e Fix ref to launch doc 2022-09-02 16:31:21 +05:30
Kovid Goyal
d3a1848c27 Remove markup from ref_hyperlink text 2022-09-02 16:24:50 +05:30
Kovid Goyal
9cec924f32 hints kitten: Allow using launch as the program to run, to open the result in a new kitty tab/window/etc.
Fixes #5462
2022-09-02 16:23:00 +05:30
Kovid Goyal
67c963ab89 Pass KITTY_LISTEN_ON to programs opened via open_url
Useful if those programs want to talk to kitty via the rc socket
2022-09-02 16:01:30 +05:30
Kovid Goyal
0f7ced25c1 ... 2022-09-01 13:55:48 +05:30
Kovid Goyal
42948ffff0 Merge branch 'docs' of https://github.com/page-down/kitty 2022-09-01 13:55:30 +05:30
pagedown
922ce5bdea Docs: Put example commands in code blocks 2022-09-01 15:35:51 +08:00
pagedown
1b42486026 Docs: Remove the extra empty line in the CLI help
Also keep the example code in a code block, in the HTML documentation.
2022-09-01 15:35:41 +08:00
pagedown
95f1a971b2 Docs: Mention clear_all_shortcuts in the FAQ about show_key kitten 2022-09-01 15:35:17 +08:00
Kovid Goyal
7968c88c67 ... 2022-09-01 07:54:36 +05:30
Kovid Goyal
992e90b0a3 Fix a regression in 0.26.0 that broke mapping of native keys who key codes did not fit in 21 bits
Fixes #5452
2022-08-31 22:19:51 +05:30
Kovid Goyal
afada84f52 Cleanup previous PR
Use wcswidth() for line width calculation. Works with emoji and ignores
escape codes automatically. Add changelog entry.
2022-08-31 08:01:52 +05:30
Kovid Goyal
b978ff8930 Merge branch 'fix/hints-next-line' of https://github.com/trygveaa/kitty 2022-08-31 07:56:38 +05:30
Kovid Goyal
053cede581 Use git rev-parse to get nightly commit hash 2022-08-31 07:22:56 +05:30
Trygve Aaberge
03720402a7 Fix hints sometimes matching next line as part of URL
For URLs where there's fewer characters left to the right edge of the
window than the number of escape characters in the line, the next line
would be included in the URL, as if the URL went all the way to the
right edge.

For example with a 40 chars wide terminal, if you run:

    echo -e '\e[31m1\e[m https://github.com/kovidgoyal/kitty\ntest'

And launch the hints kitten, you'll see that test on the next line will
be included in the URL.

This happened because the calculation for filling the rest of the line
with NUL characters counted the escape characters as well as the visible
characters, so it filled in too few characters.

This is a regression introduced in commit 91966712.
2022-08-30 22:24:58 +02:00
Kovid Goyal
fca0999814 Eureka! Figured out why libedit is breaking in prewarm on macOS via launchd
The prewarm zygote imports the world. shell.py had a top level import
for readline. Which means readline was being imported pre-fork. And of
course as is traditional with Apple libedit is not fork safe. Probably
because it initializes its internal IO routines based on the stdio
handles at time of import which are the handles kitty gets from launchd
2022-08-30 19:35:17 +05:30
Kovid Goyal
78056c659c Another place we cant use readline on macOS 2022-08-30 19:27:55 +05:30
Kovid Goyal
30e1b4680d Only override LANG in default env if it was not set either in the original os env or via the env config directive 2022-08-30 19:17:53 +05:30
Kovid Goyal
89a0c04d19 Fix exec in prewarm forked process sometimes inheriting env vars from grandparent process 2022-08-30 19:03:32 +05:30
Kovid Goyal
1ba027c277 Dont show LC_CTYPE in show_kitty_env_vars when running with system python on macOS 2022-08-30 16:55:17 +05:30
Kovid Goyal
d8e43a3412 macOS: Fix regression in 0.26.0 that caused asking the user for a line of input such as for set_tab_title to not work
Apparently libedit doesn't work in the forked process when the parent
process is run via Launch Services. I cant be bothered to investigate
why, given that libedit is closed source. macOS users will just have to
live without history/completion in the ask kitten until I get around to
writing a replacement for readline/libedit.

And on a personal note, macOS >> Necrotizing fasciitis

Fixes #5447
2022-08-30 16:45:14 +05:30
Kovid Goyal
644e46e91d Reconfigure all stdio streams in the prefork process 2022-08-30 16:22:59 +05:30
Kovid Goyal
e2a1f8dde7 ... 2022-08-30 10:40:59 +05:30
Kovid Goyal
7d09c6b762 Link to start of actual changelog 2022-08-30 10:27:53 +05:30
Kovid Goyal
6604e0d015 Fix regression in 0.26.0 that caused launching kitty without working STDIO handles to result in high CPU usage and prewarming failing
Fixes #5444
2022-08-30 08:15:13 +05:30
Kovid Goyal
bb2ec9cde7 ... 2022-08-30 07:50:36 +05:30
Kovid Goyal
89a2545855 Cleanup previous PR
Allow disabling hyperlinking of rg output. Also parse
--kitten=hyperlink=... form of CLI args.
2022-08-30 07:41:14 +05:30
Kovid Goyal
49f8c0eae6 Merge branch 'hyperlinked-grep-only-matches' of https://github.com/groves/kitty 2022-08-30 06:59:53 +05:30
Kovid Goyal
268d687814 version 0.26.1
Bloody macOS. I have better things to do that play whack-a-mole with all
the bug reports caused macOS not bothering to set LANG.
2022-08-30 01:04:42 +05:30
Charlie Groves
db5b4da388 Add options for linking different parts of ripgrep output 2022-08-29 13:23:42 -04:00
Kovid Goyal
71f8e50460 Update changelog 2022-08-29 21:01:59 +05:30
Kovid Goyal
22fbdbca40 Fix a regression in 0.26.0 that caused kitty to no longer set the LANG environment variable on macOS
Happened because reading the locale uses cocoa APIs and they are not fork
safe, so it was moved to after prewarm forking, but at that point the
default child env had already been set.

Fixes #5439
2022-08-29 20:58:48 +05:30
Kovid Goyal
6253ee2a74 Allow resetting the tab title to default 2022-08-29 20:41:07 +05:30
Kovid Goyal
5b28aed0b1 Allow the set_tab_title action to take an argument 2022-08-29 20:11:18 +05:30
Kovid Goyal
9eabc9ecf1 Merge branch 'bash-inherit_errexit' of https://github.com/grimm26/kovidgoyal-kitty 2022-08-29 19:47:24 +05:30
Mark Keisler
a77852466c bash shell integration: Send STDERR of unsetting inherit_errexit to
/dev/null

Some bash versions may not have that option and rather than checking if
they even have it or if it is set, just quiet the STDERR it may throw.

```
$ kssh myhost
bash: shopt: inherit_errexit: invalid shell option name
myhost:~$ bash --version
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
```
2022-08-29 08:58:54 -05:00
Kovid Goyal
c68b82e4d0 ssh kitten: Fix executable permission missing from kitty bootstrap script
Fixes #5438
2022-08-29 18:20:09 +05:30
Kovid Goyal
16a4845a72 version 0.26.0 2022-08-29 05:05:11 +05:30
Kovid Goyal
16da031f68 Wait till prompt appears before issuing clear 2022-08-28 21:54:55 +05:30
Kovid Goyal
43b2935e52 Make fish shell integration test for XDG_DATA_DIRS work even if the shells rc files add to XDG_DATA_DIRS.
My Linux distro has now started installing system wide rc files that do
this :((
2022-08-28 21:15:26 +05:30
Charlie Groves
8c7968a4d6 Describe --hyperlink-only-matches in the docs 2022-08-28 07:02:39 -04:00
Kovid Goyal
fba759a47c missed some at_ -> at- 2022-08-28 12:04:00 +05:30
Kovid Goyal
3bcb694b1b Switch over to at-cmd form for references.
Sphinx anyway converts at_cmd to at-cmd for anchors in HTML so using at-cmd
consistently.
2022-08-28 11:54:32 +05:30
Kovid Goyal
555020cfd5 Also allow using at-cmd 2022-08-28 10:26:38 +05:30
Kovid Goyal
391e2b8488 Fix resolution of anchor names for kitty @ command docs 2022-08-28 10:25:00 +05:30
Kovid Goyal
c856d5c058 Fix hyperlinks not present when fetching text from the history buffer
Fixes #5427
2022-08-28 08:54:53 +05:30
Charlie Groves
f5a70adf0b Add a --hyperlink-only-matches flag to hyperlinked_grep
If it's active, only matching lines get links, not file headers or context lines.
2022-08-26 17:05:50 -04:00
Kovid Goyal
e330c38d4a ssh kitten: Delegate to ssh when -T is used
Fixes #5411
2022-08-24 15:23:41 +05:30
Kovid Goyal
d595084395 DRYer 2022-08-24 15:02:36 +05:30
Kovid Goyal
b32ee5ee46 Forgot to change code to remove markup for github links 2022-08-24 15:00:39 +05:30
Kovid Goyal
098dd10789 ... 2022-08-24 14:42:40 +05:30
Kovid Goyal
b5fa643c5d Allow ignoring failures when mapping remote control commands 2022-08-24 14:21:54 +05:30
Kovid Goyal
664dd29970 Merge branch 'rc-no-response' of https://github.com/page-down/kitty 2022-08-24 14:15:13 +05:30
Kovid Goyal
b7a4281985 Allow ignoring failure to close windows/tabs via rc commands 2022-08-24 14:13:31 +05:30
Kovid Goyal
9e9aa52553 Ensure extract_rt_targets is run only once per build 2022-08-24 14:00:44 +05:30
Kovid Goyal
77fbdfbb53 Fix finding local docs when running from source on macOS 2022-08-24 13:54:14 +05:30
Kovid Goyal
214416f1e3 Fix handling of :doc: in CLI help output 2022-08-24 13:43:47 +05:30
pagedown
800437ec6b Remote control: Add --no-response to some commands 2022-08-24 15:14:53 +08:00
Kovid Goyal
957eafbef0 Merge branch 'docs' of https://github.com/page-down/kitty 2022-08-24 12:35:00 +05:30
pagedown
7f228bcbf5 Docs: Unify the list style of available values
Highlight the value and provide hyperlink in the description.
2022-08-24 13:30:52 +08:00
pagedown
fd4a682c5b Fix doc website URL with duplicate slashes 2022-08-24 13:29:51 +08:00
pagedown
ba9afc61a4 Hyperlink doc text role 2022-08-24 13:29:07 +08:00
pagedown
9a70709bba Shorten the reference link to the top of the page
Reduce the length of the link :ref:`shell_integration` in commented conf.
2022-08-24 13:27:19 +08:00
pagedown
c437a36794 Fix GitHub links in commented configuration
Hyperlink GitHub related text roles: iss, pull, disc
2022-08-24 13:27:12 +08:00
pagedown
0e0578ff49 Docs: Use --help long option name in the document
Remove the extra empty line in the CLI help for `--replay-commands`.
2022-08-24 13:27:06 +08:00
pagedown
64a202a125 Docs: Using the lowercase form of the key name consistently 2022-08-24 13:26:50 +08:00
Kovid Goyal
740d1ca146 Merge branch 'high-sierra-compat' of https://github.com/rkitover/kitty 2022-08-20 22:15:10 +05:30
Rafael Kitover
7b75f055ea Fix build on macOS High Sierra
Check for >= 10.14 using Availability.h to use the accessibilityRole
callback which does not seem to be available in 10.13.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
2022-08-20 16:08:28 +00:00
Kovid Goyal
8d6a3cff25 Fix docs build error 2022-08-20 16:26:49 +05:30
Kovid Goyal
10fdde6647 Hyperlink :envvar: as well 2022-08-20 16:24:46 +05:30
Kovid Goyal
e1c45dc23f ... 2022-08-20 16:20:30 +05:30
Kovid Goyal
2efb8f6dc2 Create an API to easily use remote control commands from kittens 2022-08-20 16:19:16 +05:30
Kovid Goyal
3b77f3b4bc Also hyperlink :term: 2022-08-20 15:40:39 +05:30
Kovid Goyal
31f763282f Document the show help shortcut 2022-08-20 14:03:16 +05:30
Kovid Goyal
39434fb1f6 A new default shortcut to show the kitty documentation 2022-08-20 13:55:10 +05:30
Kovid Goyal
44ccdd36d6 Remove socket prewarming
The potential for breakage is too high, and I am working on an
alternative solution that will be better long term.

Prewarming is still used for kittens launched via keybindings
2022-08-20 13:38:33 +05:30
Kovid Goyal
4cc0138a28 Delete the frozen python dir
I verified that all the files remaining in it are loaded via the python
resource system and so are not needed.
2022-08-20 13:05:12 +05:30
Kovid Goyal
6ca39d9d83 Move code to delete empty folders into bypy
So it applies to both linux and mac builds automatically
2022-08-20 12:46:55 +05:30
Kovid Goyal
26c099639c Remove empty folders from macOS package builds 2022-08-20 12:20:18 +05:30
Kovid Goyal
329043ba08 Cleanup build documentation
Note how to build the kitty docs wherever needed instead of in a
separate section
2022-08-20 12:09:36 +05:30
Kovid Goyal
e289f4959f DRYer 2022-08-20 12:03:33 +05:30
Kovid Goyal
b6760a59fa Another bug in resolve_ref 2022-08-20 11:45:48 +05:30
Kovid Goyal
cd35f92607 Fix resolve_ref() 2022-08-20 11:29:40 +05:30
Kovid Goyal
ea8f223298 Cleanup the wrap implementation
Make it more efficient and add support for hyperlink escapes
2022-08-20 09:17:05 +05:30
Kovid Goyal
a4c3154dab ... 2022-08-20 08:27:24 +05:30
Kovid Goyal
6aa3405c78 Clean up build docs a bit 2022-08-20 08:13:42 +05:30
Kovid Goyal
da618584af Fix some outdated docs 2022-08-19 15:48:17 +05:30
Kovid Goyal
9bc31a5651 Use locally built docs when running from source if they exist 2022-08-19 15:01:20 +05:30
Kovid Goyal
314dd97059 Command line tools shouldnt need to resolve documentation refs
Instead use a new kitty+doc protocol and have kitty navigate to the
docs. Uses a default open action for the protocol, which can be
overriden by the user should they so desire.
2022-08-19 14:35:17 +05:30
Kovid Goyal
0b66f20934 Fix mapping of ref targets with underscores 2022-08-19 14:34:25 +05:30
Kovid Goyal
aba634ce88 Fix building of docs on macOS without warnings
--detach doesnt exist on macOS
2022-08-19 14:16:28 +05:30
Kovid Goyal
033950dae9 Only hyperlink when stdout is a tty 2022-08-19 14:05:53 +05:30
Kovid Goyal
a59e1adee1 Also hyperlink the :ac: role in CLI help output 2022-08-19 14:05:11 +05:30
Kovid Goyal
5350eb29c1 A new mappable action to show kitty docs in the browser 2022-08-19 14:00:30 +05:30
Kovid Goyal
2bb42e67d7 We have to build docs to test building of package now 2022-08-19 13:51:35 +05:30
Kovid Goyal
8745c4cd4a Make the kitty man pages automatically available inside kitty when using a binary build 2022-08-19 12:59:10 +05:30
Kovid Goyal
3288400005 Make the docs and man pages available in the macos bundle as well 2022-08-19 12:38:10 +05:30
Kovid Goyal
1f499a7c6c Add newline to end of generated file 2022-08-19 11:29:47 +05:30
Kovid Goyal
012731c3be Clean _generated.h files 2022-08-19 11:22:30 +05:30
Kovid Goyal
5deed81737 Dont maintain ref_map manually 2022-08-19 11:20:50 +05:30
Kovid Goyal
6f6e23bf61 Update docs 2022-08-19 10:00:06 +05:30
Kovid Goyal
d2d0487356 Hyperlink :ref: roles in CLI help 2022-08-19 09:57:52 +05:30
Kovid Goyal
30df4e5de2 Improve formatting of --stdin-source 2022-08-19 09:34:52 +05:30
Kovid Goyal
3f4588c408 Improve formatting of launch --type help message 2022-08-19 09:30:22 +05:30
Kovid Goyal
4e4ca366d9 Merge branch 'docs' of https://github.com/page-down/kitty 2022-08-18 17:52:24 +05:30
pagedown
040ff0cc9d For running the new code KITTY_PREWARM_SOCKET needs to be dropped 2022-08-18 17:06:07 +08:00
pagedown
b01ad4bb3b ... 2022-08-18 17:05:35 +08:00
pagedown
4476251b76 List the available data names for tab_title_template in commented conf
List syntax starting with * becomes a block of text in the commented
configuration file.
2022-08-18 17:05:24 +08:00
pagedown
0f4cb1955f Use the plus sign to connect shortcut keys consistently 2022-08-18 17:05:00 +08:00
Kovid Goyal
c161ee7b5e Merge branch 'rc-password' of https://github.com/page-down/kitty 2022-08-17 18:41:48 +05:30
pagedown
a5bb2548a6 Do not set KITTY_LISTEN_ON after the window rc password is configured 2022-08-17 19:37:52 +08:00
Kovid Goyal
2898a3ef8c Some documentation cleanup 2022-08-17 06:48:33 +05:30
Kovid Goyal
a0568334b5 Change the default for allow_remote_control back to no
That way if there are any bugs in the implementation, we wont be
exposing users by default. In the future after the implementation has
been battle tested, we can revisit.
2022-08-17 06:42:51 +05:30
Kovid Goyal
4005cfdff2 Disallow passwords that start with - to allow for future addition of options 2022-08-17 00:58:11 +05:30
Kovid Goyal
1d8c5e65b9 Ignore generated .go files 2022-08-17 00:55:12 +05:30
Kovid Goyal
56f45e8b0f Fix unhandled exceptions not being printed to stderr on macOS when run from launch services and using prewarming 2022-08-16 15:28:07 +05:30
Kovid Goyal
48a9584688 Hide the password when asking for rc permission
Can press a key or click on it to reveal it
2022-08-16 14:07:36 +05:30
Kovid Goyal
bfcd324993 ask kitten: allow having hidden text in the message 2022-08-16 13:57:58 +05:30
Kovid Goyal
a75235a260 rcp ars should be a sequnce not a set 2022-08-16 12:10:15 +05:30
Kovid Goyal
e8de2def96 Fix --allow-remote-control not working with allow_remote_control=no 2022-08-16 11:42:39 +05:30
Kovid Goyal
5ffc4c6498 DRYer 2022-08-16 11:37:31 +05:30
Kovid Goyal
d0c50248ea Graphics protocol: Only delete temp files if they have the string tty-graphics-protocol in their file paths.
This prevents deletion of arbitrary files in /tmp via the graphics
protocol.
2022-08-16 11:25:33 +05:30
Kovid Goyal
ca2a121696 Nicer error when listen on socket is not found 2022-08-16 10:59:51 +05:30
Kovid Goyal
02d06d6726 Fix --allow-remote-control without passwords not working 2022-08-16 10:51:54 +05:30
Kovid Goyal
18bf76d49e Dont set KITTY_LISTEN_ON for windows with --allow-remote-control 2022-08-16 10:50:17 +05:30
Kovid Goyal
6961845167 ask kitten: fix button click area offset vertically 2022-08-16 10:35:51 +05:30
Kovid Goyal
4c5f7f50f7 Control KITTY_LISTEN_ON more precisely 2022-08-16 10:16:18 +05:30
Kovid Goyal
572e920466 Allow restricting the remote control actions in specific windows 2022-08-16 07:08:51 +05:30
Kovid Goyal
b81fb3c865 Disable pre-warming when running gen-config.py 2022-08-16 05:41:46 +05:30
Kovid Goyal
814dd8a275 allow_remote_control should be per window not per child 2022-08-15 21:32:14 +05:30
Kovid Goyal
1619687d1d Allow specifying allowed actions when no password is sent 2022-08-15 21:05:53 +05:30
Kovid Goyal
65fc61a507 Remove unused code 2022-08-15 20:54:17 +05:30
Kovid Goyal
d027f524ce Make allow_remote_control a little more fine grained
Also, only respect listen_on if there is a possiblility of rc commands
over it being accepted
2022-08-15 20:51:11 +05:30
Kovid Goyal
df5e6e1563 simpler ignore pattern 2022-08-15 20:15:30 +05:30
Kovid Goyal
5541e3c2ff More robust cleaning of launcher dir 2022-08-14 23:39:26 +05:30
Kovid Goyal
57dfc379ae Fix cocoa being loaded before the fork on macOS 2022-08-14 22:17:27 +05:30
Kovid Goyal
b5467b8e26 Set the cocoa uncaught exception handler during glfw init not at module import time 2022-08-14 19:33:32 +05:30
Kovid Goyal
a9f1928913 ... 2022-08-14 19:16:47 +05:30
Kovid Goyal
ae16fed39b Fix repeated make app failing on macOS 2022-08-14 19:01:58 +05:30
Kovid Goyal
848a795d26 Fix minimal macos bundle build 2022-08-14 13:48:45 +05:30
Kovid Goyal
deb8c3dacd Dont put the launcher source files in the root directory 2022-08-14 13:01:29 +05:30
Kovid Goyal
3cb572b47a Fix build on older gcc 2022-08-14 10:12:17 +05:30
Kovid Goyal
df3846fbb8 Add instructions on how to install the man pages under desktop integration 2022-08-12 23:33:06 +05:30
Kovid Goyal
d73ceb26ae Use the RFC as the reference for base-85 encoding 2022-08-12 15:38:28 +05:30
Kovid Goyal
da9ffc9b93 Allow using IV and tags longer than the minimum lengths 2022-08-12 13:21:57 +05:30
Kovid Goyal
63fa0c4e94 Nicer fix for human_repr of keys defined with kitty_mod 2022-08-12 12:37:15 +05:30
Kovid Goyal
ce91b6d9d9 Switch to using the new SingleKey implementation 2022-08-12 12:21:06 +05:30
Kovid Goyal
c982f24faf Add some tests for hashing and __eq__ 2022-08-12 12:02:22 +05:30
Kovid Goyal
9f865adb83 DRYer 2022-08-12 11:39:26 +05:30
Kovid Goyal
b54dd1cb48 Increase the max key num that is storeable 2022-08-12 11:37:54 +05:30
Kovid Goyal
ef621aa099 DRYer
Also dont store negative values for key. Unset is 0 not -1
2022-08-12 11:35:45 +05:30
Kovid Goyal
df4738f080 ... 2022-08-12 11:24:18 +05:30
Kovid Goyal
8d0a06325c Update config types for new value of KITTY_MOD 2022-08-12 11:07:11 +05:30
Kovid Goyal
f3329fcd34 Fix storage for GLFW_MOD_KITTY 2022-08-12 09:58:50 +05:30
Kovid Goyal
af48547d8b Implement SingleKey._replace 2022-08-12 09:40:58 +05:30
Kovid Goyal
f228f8368a A faster version of SingleKey 2022-08-12 09:17:42 +05:30
Kovid Goyal
9bb2c1a27b Type objects should be static 2022-08-12 08:32:11 +05:30
Kovid Goyal
aa0b07a90d Fix #5371 2022-08-12 08:15:25 +05:30
Kovid Goyal
d4075bfa9a ... 2022-08-12 07:01:40 +05:30
Weng Xuetian
7fd119d0eb Fix message recursion between wayland compositor (#5360)
1. Only update preedit if preedit changed.
2. Only send cursor update if cursor position is not changed.
2022-08-11 15:45:45 -07:00
Kovid Goyal
2b7455e353 Use kitty_mod in debug config output
Fixes #5367
2022-08-11 23:45:23 +05:30
Kovid Goyal
f42d2c63a6 Add type annotations to rc protocol field definitions 2022-08-11 22:14:33 +05:30
Kovid Goyal
6be3ae9efc Start work on standalone remote control script 2022-08-11 21:05:04 +05:30
Kovid Goyal
2fd2e07342 Fix #5366 2022-08-11 15:47:06 +05:30
Kovid Goyal
1e0e32e282 DRYer 2022-08-11 13:42:38 +05:30
Kovid Goyal
b2d8f24499 Clean up the text a bit 2022-08-11 07:47:15 +05:30
Kovid Goyal
12c99741a0 Add an example of restricting the launch command 2022-08-11 07:35:18 +05:30
Kovid Goyal
91dbcf4df0 Link to encryption spec 2022-08-11 07:29:56 +05:30
Kovid Goyal
6ebd82a84c Note which version remote_control_password was added 2022-08-11 06:52:37 +05:30
Kovid Goyal
c07178f43a Avoid transmitting the currently un-needed enc_proto 2022-08-11 06:48:35 +05:30
Kovid Goyal
78a5957863 Highlight the JSON blocks appropriately 2022-08-11 06:46:42 +05:30
Kovid Goyal
cd6882d21e ... 2022-08-11 06:40:44 +05:30
Kovid Goyal
926a2828ab 5 minutes does not actually prevent replay just minimise it 2022-08-11 06:38:59 +05:30
Kovid Goyal
daa7df96d1 ... 2022-08-11 06:38:04 +05:30
Kovid Goyal
84ca83ef69 Document the encryption used by remote_control_password 2022-08-11 06:35:25 +05:30
Kovid Goyal
ac9c85e783 Add a note about password auth over SSH 2022-08-11 06:08:28 +05:30
Kovid Goyal
331f6d4903 Document remote_control_password more thoroughly
Also ignore failures in custom auth functions
2022-08-11 05:58:02 +05:30
Kovid Goyal
2e422e5ba8 Use getpass() to read the password from STDIN when it is a tty 2022-08-11 05:20:05 +05:30
Kovid Goyal
20cffc728e Close tty_fd after dup2 2022-08-11 05:10:15 +05:30
Kovid Goyal
b06cbc9465 Use the OS secure random number generator rather than the OpenSSL one to generate IVs
The OpenSSL one is not fork safe, and in general I trust kernel CSRNG
more than OpenSSL
2022-08-11 05:07:38 +05:30
Kovid Goyal
1348327414 Pressing esc for the permission dialog should be same as reject this request 2022-08-10 20:36:15 +05:30
Kovid Goyal
cd3eeb7a95 Center choice message correctly when it is multi-line
Also fix button wrap calculation. It was not taking the borders into
account.
2022-08-10 20:34:25 +05:30
Kovid Goyal
7be6b28011 Preserve blanks lines and per line formatting in the ask kitten for the message with choices 2022-08-10 20:10:17 +05:30
Kovid Goyal
ef1bee0f48 Shorten text 2022-08-10 20:00:20 +05:30
Kovid Goyal
702da542dd Use a as the default accelerator rather than t 2022-08-10 19:11:18 +05:30
Kovid Goyal
5ba92d06cf Get async response working with sockets 2022-08-10 19:10:04 +05:30
Kovid Goyal
34a7b42063 Dont print traceback when socket is unexpectedly closed 2022-08-10 19:06:57 +05:30
Kovid Goyal
963d1b58f8 Better error message when socket is closed without response 2022-08-10 18:53:15 +05:30
Kovid Goyal
fe598bac8a Quote ^ as it is a special char in some shells 2022-08-10 17:39:05 +05:30
Kovid Goyal
45736d7f1d ... 2022-08-10 17:28:22 +05:30
Kovid Goyal
0fe4f5a686 Fix password based rc not working with generator responses 2022-08-10 17:24:10 +05:30
Kovid Goyal
e9ce5c02d0 Allow remote control commands to be interrupted by ctrl-c while waiting for a response 2022-08-10 17:00:04 +05:30
Kovid Goyal
5916d82580 Send disallowed responses when permission for rc is denied 2022-08-10 16:28:14 +05:30
Kovid Goyal
2c83b9902e Implement the permissions system for password based rc requests 2022-08-10 15:49:50 +05:30
Kovid Goyal
fe07825ad9 Work on new permissions framework for rc commands 2022-08-10 12:36:04 +05:30
Kovid Goyal
56e83d7d07 Write code to decrypt commands received in kitty 2022-08-10 12:36:04 +05:30
Kovid Goyal
c7e3c92a0a Allow listen_on to be used even without allow_remote_control
Since we intend to allow password based access, which works regardless
of the value of allow_remote_control
2022-08-10 12:36:04 +05:30
Kovid Goyal
1a643441f3 Make the kitty public key available as an env var to child processes 2022-08-10 12:36:04 +05:30
Kovid Goyal
2aee746da9 Write the code to encrypt rc messages to kitty 2022-08-10 12:36:04 +05:30
Kovid Goyal
e64b1ba67c Start work on remote control passwords 2022-08-10 12:36:04 +05:30
Kovid Goyal
31be4f041e remove unused code 2022-08-10 12:31:47 +05:30
Kovid Goyal
1f5ebc408d When searching macOS for openssl search for the same version as used by the python we are running 2022-08-10 12:30:36 +05:30
Kovid Goyal
b4d9a22df8 Install the same version of OpenSSL as used by python on brew based CI 2022-08-10 12:21:01 +05:30
Kovid Goyal
d4168e3b80 Dont add openssl to the brewfile
We only need to install it on CI because the python on CI doesnt come
from brew. Normal brewfile based installation will install openssl as a
dependency of python
2022-08-10 12:02:43 +05:30
Kovid Goyal
241c7af855 DRYer 2022-08-10 11:45:07 +05:30
Kovid Goyal
080fcd8fc1 Link against newer rather than older openssl 2022-08-10 11:36:56 +05:30
Kovid Goyal
1aad4c7ec3 Only search for brew openssl on failure 2022-08-10 11:35:43 +05:30
Kovid Goyal
e0e0582b53 Fix #5364
macOS is *the* worst UNIX I have ever seen.
2022-08-10 11:33:30 +05:30
Kovid Goyal
0a6276b007 Implement completion for kitty @ global options 2022-08-09 18:54:38 +05:30
Kovid Goyal
2a2256f7d9 ... 2022-08-09 16:11:23 +05:30
Kovid Goyal
ed81a60065 Add keywords completion for --cwd and --config 2022-08-09 16:07:04 +05:30
Kovid Goyal
5ad55dd165 Allow using file completion for any type of command line arg 2022-08-09 15:57:01 +05:30
Kovid Goyal
6860f7ffd6 fix zsh serialization of directory candidates ending with / 2022-08-09 14:51:14 +05:30
Kovid Goyal
33a3e3fb61 Add completion for kitty @ launch --logo 2022-08-09 14:30:13 +05:30
Kovid Goyal
d4df3f67b6 Allow specifying completion for command line arguments that expect paths 2022-08-09 14:21:12 +05:30
Kovid Goyal
f15a2f0c1f Change --session to resolve relative paths from the kitty config dir 2022-08-09 12:36:16 +05:30
Kovid Goyal
252288aff2 kitten completion: Fix --long-opt <TAB> not working 2022-08-09 12:02:25 +05:30
Kovid Goyal
65a20a2407 Merge branch 'show-key-kitten' of https://github.com/page-down/kitty 2022-08-09 11:32:10 +05:30
pagedown
5f180dbd9a ... 2022-08-09 12:29:22 +08:00
pagedown
ee4e9aa678 Add missing modifier key aliases 2022-08-09 12:15:55 +08:00
pagedown
9f1c9529aa Allow completion for show_key kitten
Use the lowercase form of kitty.
2022-08-09 12:15:48 +08:00
Kovid Goyal
5bba1a0851 get_current_selection should return char* not const char* 2022-08-09 09:05:13 +05:30
Kovid Goyal
e9823eb40c Cleanup previous PR 2022-08-09 08:54:47 +05:30
Kovid Goyal
14fc3f6ac4 Merge branch 'macos-accessibility' of https://github.com/page-down/kitty 2022-08-09 08:52:44 +05:30
pagedown
74714f942a Implement macOS accessibility protocol to provide selected text
Allow "Speak selection" (Option+Esc) to work properly.
2022-08-09 11:02:12 +08:00
pagedown
0d116e6ef0 Use four spaces to indent 2022-08-08 22:31:55 +05:30
pagedown
06108d66b1 Replace tab with four spaces indent 2022-08-08 22:31:55 +05:30
Kovid Goyal
21eece4c6d Ensure no bytecode is written when running shell based tests 2022-08-08 17:50:59 +05:30
Kovid Goyal
4dd696e4e0 Add API to glfw to get the currently active text selection 2022-08-08 15:52:34 +05:30
Kovid Goyal
d04d4444af implement primary selection api on cocoa as stubs, can be useful for #5357 2022-08-06 12:59:15 +05:30
Kovid Goyal
a487a78200 Add type definitions for the crypto data types 2022-08-05 14:39:20 +05:30
Kovid Goyal
f06a72b418 OpenSSL 3.0 apparently has API to get rid of the tag length magic number. Lets hope it works 2022-08-05 14:28:56 +05:30
Kovid Goyal
3270c9a527 Get rid of various magic length constants 2022-08-05 14:17:42 +05:30
Kovid Goyal
a7b7fb560a Add tests for AES256GCM 2022-08-05 13:50:03 +05:30
Kovid Goyal
384eba6cd4 Wrap the OpenSSL API for AES 256 GCM encryption 2022-08-05 13:14:25 +05:30
Kovid Goyal
dc7e3ba1ec DRYer 2022-08-05 08:57:22 +05:30
Kovid Goyal
b1e0adcfdc ... 2022-08-05 08:14:29 +05:30
Kovid Goyal
2a5922ce92 Cleanup previous PR
The reason maxsplit is 1 is because some layout action in the future may need more
sophisticated args processing, for example, shlex.split() instead of
plain split(), or even a full command line parser.
2022-08-05 08:12:05 +05:30
Kovid Goyal
93694925ce Merge branch 'feature/toggle_bias' of https://github.com/mong8se/kitty 2022-08-05 08:11:35 +05:30
Steven Moazami
adfcbb004f Add layout_action to change bias on tall layout
Can specify 1 bias to toggle between that and 50%.

Can specify multiple biases to rotate through them with each call to the
layout_action.

Left a comment regarding working around either a possible bug or a
design decision.
2022-08-04 19:29:17 -04:00
Kovid Goyal
6595898b73 Merge branch 'patch-4' of https://github.com/ctrlcctrlv/kitty 2022-08-04 20:45:29 +05:30
Fredrick Brennan
81b33f1f6f Document how to build docs 2022-08-04 11:12:04 -04:00
Kovid Goyal
a1c4ffec20 Private raw key should be returned as a secret 2022-08-04 20:27:38 +05:30
Kovid Goyal
89854cca8b Test for secret derivation 2022-08-04 20:05:19 +05:30
Kovid Goyal
4fe5211ed7 Code to derive the shared secret with elliptic curve keys 2022-08-04 19:42:38 +05:30
Kovid Goyal
795b32efd7 Bash integration: Fix the inherit_errexit option being set by shell integration
Fixes #5349
2022-08-04 16:23:52 +05:30
Kovid Goyal
153064ef3a Fail if mlock fails 2022-08-04 11:16:36 +05:30
Kovid Goyal
183a31c884 mlock() the returned private key to prevent it from being saved to swap 2022-08-04 11:08:54 +05:30
Kovid Goyal
adf47bed89 Use an actual type for the EC key rather than a capsule 2022-08-04 11:01:14 +05:30
Kovid Goyal
cc297a8984 Merge branch 'patch-1' of https://github.com/TomFaulkner/kitty 2022-08-04 07:39:38 +05:30
Tom Faulkner
4ef17edace Fix doc typo: throught to throughout
Just a typo in the docs. Kitty is great, thanks for all the hard work.
2022-08-03 23:52:00 +00:00
Kovid Goyal
e56fa9d31f Try and get Homebrew installed OpenSSL to work 2022-08-03 23:17:47 +05:30
Kovid Goyal
791d4b30fb We need openssl installed via brew 2022-08-03 22:47:11 +05:30
Kovid Goyal
a9a9f1ac00 Add a mappable action to toggle the mirrored setting for the tall and fat layouts
Fixes #5344
2022-08-03 22:45:38 +05:30
Kovid Goyal
fd6bc55db6 Start work on implementing public key crypto
Will come in handy for various things in the future, so lets just setup
the API now. No new dependencies are needed since Python already depends
on OpenSSL.
2022-08-03 22:37:35 +05:30
Kovid Goyal
97d7329d14 A nicer fix for kitty @ ls | less
We rely on the fact that cfmakeraw() and less's code to put the tty in
raw state diverge. This is obv a hack but then so is kitty @ ls | less

This hack allows

kitty +kitten clipboard --get-clipboard > output

to work.
2022-08-02 18:33:53 +05:30
Kovid Goyal
609d42e2bc Ignore EAGAIN when doing tty io 2022-08-02 17:21:28 +05:30
Kovid Goyal
3463931dad Rewrite clipboard kitten to only change termios settings while it is actually reading from terminal 2022-08-02 17:14:27 +05:30
Kovid Goyal
f637bf2377 socket prewarm: Dont control the tty if STDOUT is not a tty
This is because we could be being piped to a program like less that does
want to control the tty itself
2022-08-02 14:09:34 +05:30
Kovid Goyal
2271eb5e60 Document KITTY_PREWARM_SOCKET_REAL_TTY 2022-08-02 08:38:07 +05:30
Kovid Goyal
a5cbb552f0 Allow prewarming of kitty @ commands 2022-08-01 19:47:28 +05:30
Kovid Goyal
e43ca5b031 Add an implementation using splice() for in-kernel tty copies
Sadly splice is currently not functional in Linux, so the implementation
is turned off
2022-08-01 19:16:51 +05:30
Kovid Goyal
cc7e668ad6 Cleanup editing of proc environ 2022-08-01 19:03:03 +05:30
Kovid Goyal
a01dbbdf04 Fix launcher not building universal 2022-08-01 19:03:03 +05:30
Kovid Goyal
e0ce0a67cc ensure setting KITTY_PREWARM_SOCKET_REAL_TTY does not clobber the environ 2022-08-01 19:03:03 +05:30
Kovid Goyal
0d83a8866b Make setting the real tty name more robust 2022-08-01 19:03:03 +05:30
Kovid Goyal
f7a7e39a36 prewarm wrapper should indicate it is active via the process environment 2022-08-01 19:03:03 +05:30
Kovid Goyal
67cb466ea9 ... 2022-08-01 19:03:03 +05:30
Kovid Goyal
376688ab9f Add a test for SIGTSTP via ctrl-z 2022-08-01 19:03:03 +05:30
Kovid Goyal
8668087d15 flush data when exiting on signal as well
should make the signal tests less flaky
2022-08-01 19:03:03 +05:30
Kovid Goyal
9b1c23987c Fix stdout line_buffering incorrect when parent kitty instance has its stdout redirected to a file 2022-08-01 19:03:03 +05:30
Kovid Goyal
784daa1a4b Update changelog for socket prewarm 2022-08-01 19:03:03 +05:30
Kovid Goyal
06f9b73a7b Workaround mypy bug 2022-08-01 19:03:03 +05:30
Kovid Goyal
62c0272df2 Get test.py working when prewarm socket is in operation 2022-08-01 19:03:03 +05:30
Kovid Goyal
7ce2b4c641 Indicate in kitty_run_data we are prewarmed 2022-08-01 19:03:03 +05:30
Kovid Goyal
08c2de541f Nicer establish_controlling_tty 2022-08-01 19:03:03 +05:30
Kovid Goyal
94551623ec Make JSON reading test a bit more robust 2022-08-01 19:03:02 +05:30
Kovid Goyal
cb0d23bae8 Use sub tests for the various prewarm things 2022-08-01 19:03:02 +05:30
Kovid Goyal
cb5157f2d1 Nicer implementation of eintr_retry that does not prevent type checking of wrapped functions arguments 2022-08-01 19:03:02 +05:30
Kovid Goyal
32dcbbb5e1 ... 2022-08-01 19:03:02 +05:30
Kovid Goyal
4eedf0d36c macOS needs SIGTTOU SIGTTIN explicitly ignored to allow the supervisor to use TIOCSWINSZ 2022-08-01 19:03:02 +05:30
Kovid Goyal
be458303c5 Debounce WINSZ events 2022-08-01 19:03:02 +05:30
Kovid Goyal
78542ede14 Separate test for SIGWINCH handling 2022-08-01 19:03:02 +05:30
Kovid Goyal
df8800b7ff tcsetpgrp can raise EINTR despite python claiming to auto retry 2022-08-01 19:03:02 +05:30
Kovid Goyal
9c30cd8891 Use a process supervisor for socket workers
This simplifies the code and also allows SIGTSTP to work as the worker
process is no longer in an orphaned process group.
2022-08-01 19:03:02 +05:30
Kovid Goyal
dda28efd66 Use the same signal to stop as stopped the child 2022-08-01 19:03:02 +05:30
Kovid Goyal
b78183972c Report child stop to wrapper process 2022-08-01 19:03:02 +05:30
Kovid Goyal
fc06196a3e Restore termios state when stopping 2022-08-01 19:03:02 +05:30
Kovid Goyal
2a1809a2d8 When exiting with a signal run cleanup 2022-08-01 19:03:02 +05:30
Kovid Goyal
ac5c312267 Work on handling child stop events 2022-08-01 19:03:02 +05:30
Kovid Goyal
8f3174038b Fix running of test suite inside kitty 2022-08-01 19:03:02 +05:30
Kovid Goyal
2d8113e0e0 Give up on signal delivery tests 2022-08-01 19:03:02 +05:30
Kovid Goyal
e881850bb4 ... 2022-08-01 19:03:02 +05:30
Kovid Goyal
4cbae1db89 ... 2022-08-01 19:03:02 +05:30
Kovid Goyal
97bce7be18 and again 2022-08-01 19:03:01 +05:30
Kovid Goyal
5d2a276172 ... 2022-08-01 19:03:01 +05:30
Kovid Goyal
762dfe8315 increase timeout since signal delivery on CI is flakey 2022-08-01 19:03:01 +05:30
Kovid Goyal
1c0d1ec8a9 wait for child events explicitly 2022-08-01 19:03:01 +05:30
Kovid Goyal
e650699217 py3.8 compat 2022-08-01 19:03:01 +05:30
Kovid Goyal
5ff2b5be1c Clear out any signals before ending test 2022-08-01 19:03:01 +05:30
Kovid Goyal
f1841d7c81 DRYer 2022-08-01 19:03:01 +05:30
Kovid Goyal
fd6231a778 Fix signal reading in prewarm wrapper 2022-08-01 19:03:01 +05:30
Kovid Goyal
751a52153d Restore python signal handlers properly after the test 2022-08-01 19:03:01 +05:30
Kovid Goyal
61b733bae9 Add a test for SIGCHLD on SIGTSTP 2022-08-01 19:03:01 +05:30
Kovid Goyal
624e96df9b wrapper process should exit with signal if prewarmed worker exits with signal 2022-08-01 19:03:01 +05:30
Kovid Goyal
a3f1a44d83 OK I give up I cant get signal delivery to work reliably 2022-08-01 19:03:01 +05:30
Kovid Goyal
ed1547938e When running tests ensure the signal mask is empty for processes run in the testing pty 2022-08-01 19:03:01 +05:30
Kovid Goyal
f96a13e9e4 mask handled signals when running signal handler 2022-08-01 19:03:01 +05:30
Kovid Goyal
7b70ed96b6 DRYer 2022-08-01 19:03:01 +05:30
Kovid Goyal
9379853d47 Get the SIGINT test working on macOS 2022-08-01 19:03:01 +05:30
Kovid Goyal
6ccfebd9e3 ... 2022-08-01 19:03:01 +05:30
Kovid Goyal
45186a17ca macOS doesnt allow TIOCSWINSZ from any process other than the process connected to the terminal or its parent
So send it over the socket to the zygote and have it resize the
terminal. Sigh.
2022-08-01 19:03:00 +05:30
Kovid Goyal
24bb4585af Allow easily skipping tests when updating on ox 2022-08-01 19:03:00 +05:30
Kovid Goyal
feb96f1be8 Use O_CLOEXEC for temp ctty fds 2022-08-01 19:03:00 +05:30
Kovid Goyal
b7d3d64975 Ignore error condition on master fd of testing pty 2022-08-01 19:03:00 +05:30
Kovid Goyal
6114b49630 Ensure pty is in utf8 2022-08-01 19:03:00 +05:30
Kovid Goyal
87d95caae0 Dont bother sending slave fd over the socket as it doesnt help on macOS anyway 2022-08-01 19:03:00 +05:30
Kovid Goyal
9535bc94ff Use both open and the ioctl to set the controlling terminal 2022-08-01 19:03:00 +05:30
Kovid Goyal
0841be7803 Test sigwinch handling 2022-08-01 19:03:00 +05:30
Kovid Goyal
6cec89181b dont abort when failing to write to a tty 2022-08-01 19:03:00 +05:30
Kovid Goyal
cb78e17594 dont break when socket is pre-closed 2022-08-01 19:03:00 +05:30
Kovid Goyal
285c399ae5 ... 2022-08-01 19:03:00 +05:30
Kovid Goyal
c9b14f6f78 Switch to using select() instead of poll() in prewarm wrapper
This is because poll() is broken on macOS with pty fds
2022-08-01 19:03:00 +05:30
Kovid Goyal
6a101c51d2 Close tty_fd in master on fork() rather than on close() 2022-08-01 19:03:00 +05:30
Kovid Goyal
8998970adc Make the socket prewarm test a bit more robust 2022-08-01 19:03:00 +05:30
Kovid Goyal
991fbacb99 Fix ttyfd passing 2022-08-01 19:03:00 +05:30
Kovid Goyal
72f3e8cd40 Avoid passing around pty paths, instead send the pty fd 2022-08-01 19:03:00 +05:30
Kovid Goyal
cf8113ea24 Even more flexible management of poll data 2022-08-01 19:03:00 +05:30
Kovid Goyal
5d1cf49fb6 Only set control msg metadata when actually sending a control msg 2022-08-01 19:03:00 +05:30
Kovid Goyal
90f3c0f9af Workaround macOS weirdness 2022-08-01 19:02:59 +05:30
Kovid Goyal
d02598688a Show full traceback for failures to fork socket child 2022-08-01 19:02:59 +05:30
Kovid Goyal
1991f1ccd7 Better handling of multiple optional to poll fds 2022-08-01 19:02:59 +05:30
Kovid Goyal
8fad8972d5 ... 2022-08-01 19:02:59 +05:30
Kovid Goyal
fc3e78e226 Also handle SIGQUIT 2022-08-01 19:02:59 +05:30
Kovid Goyal
15aace29a1 Restore python signal handlers in forked workers 2022-08-01 19:02:59 +05:30
Kovid Goyal
12a3a2d7fe Only set switch interval after prewarm fork 2022-08-01 19:02:59 +05:30
Kovid Goyal
7e26a340a3 Try to read from child pty even after zygote signals its death 2022-08-01 19:02:59 +05:30
Kovid Goyal
f0764c24d2 Retry read/write while there is space 2022-08-01 19:02:59 +05:30
Kovid Goyal
d080bf3b9c Forward termination signals 2022-08-01 19:02:59 +05:30
Kovid Goyal
51698dff07 ... 2022-08-01 19:02:59 +05:30
Kovid Goyal
4154926be7 Get the test to pass on macOS 2022-08-01 19:02:59 +05:30
Kovid Goyal
806ca2b224 Fix atexit handlers being called in forked children
In particular the atexit handler for random_unix_socket()
2022-08-01 19:02:59 +05:30
Kovid Goyal
92bbf08343 Fix socket connect call on non-linux 2022-08-01 19:02:59 +05:30
Kovid Goyal
dc84e3de67 Do not hang forever waiting for child death 2022-08-01 19:02:59 +05:30
Kovid Goyal
8011801549 re-init openssl PRNG when forking for prewarm 2022-08-01 19:02:59 +05:30
Kovid Goyal
dfec88ed15 Inherit full outside env 2022-08-01 19:02:59 +05:30
Kovid Goyal
5d3e2c7111 ... 2022-08-01 19:02:58 +05:30
Kovid Goyal
af1c48e0f7 Dont rely on having source of test modules available 2022-08-01 19:02:58 +05:30
Kovid Goyal
d4bc906c5c Fix launcher build with sanitize 2022-08-01 19:02:58 +05:30
Kovid Goyal
62fe467336 ... 2022-08-01 19:02:58 +05:30
Kovid Goyal
ef3e9d1c2e make various compilers happy 2022-08-01 19:02:58 +05:30
Kovid Goyal
09ddbbf600 Finish move of prewarm launcher into its own compilation unit 2022-08-01 19:02:58 +05:30
Kovid Goyal
4195c239c8 Start moving prewarm launcher into its own compilation unit 2022-08-01 19:02:58 +05:30
Kovid Goyal
a6c3c57d40 Test stdio redirection with socket prewarm 2022-08-01 19:02:58 +05:30
Kovid Goyal
de9263a117 Verify uid/gid of connection from a prewarm client 2022-08-01 19:02:58 +05:30
Kovid Goyal
7b7f1ecc54 Add basic tests for socket prewarm 2022-08-01 19:02:58 +05:30
Kovid Goyal
d1b028c27a Dont pass inherited KITTY_PREWARM_SOCKET 2022-08-01 19:02:58 +05:30
Kovid Goyal
055aae2382 Use correct exit codes for signals 2022-08-01 19:02:58 +05:30
Kovid Goyal
dbb084da7a Cleanup closing of socket child 2022-08-01 19:02:58 +05:30
Kovid Goyal
8332cd2f79 Avoid needing to call os.getpid() repeatedly 2022-08-01 19:02:58 +05:30
Kovid Goyal
4e29c0c16b Propagate SIGWINCH 2022-08-01 19:02:58 +05:30
Kovid Goyal
320d45a3f5 Only use prewarm socket if uid and gid match 2022-08-01 19:02:58 +05:30
Kovid Goyal
73795b5257 detect when socket child closes its tty 2022-08-01 19:02:58 +05:30
Kovid Goyal
16e59784c6 handle failures to send data over socket gracefully 2022-08-01 19:02:58 +05:30
Kovid Goyal
65a7ec3f85 move socket launch handling into its own function 2022-08-01 19:02:57 +05:30
Kovid Goyal
360ff35061 Better error logging from prewarm zygote 2022-08-01 19:02:57 +05:30
Kovid Goyal
5098792723 Make the tty pipes non-blocking 2022-08-01 19:02:57 +05:30
Kovid Goyal
a4883e6d41 Transfer data between ttys 2022-08-01 19:02:57 +05:30
Kovid Goyal
44c9d66dd4 Use a map for pid -> socketchild 2022-08-01 19:02:57 +05:30
Kovid Goyal
c7718d078c Fix parsing of child pid and exit code 2022-08-01 19:02:57 +05:30
Kovid Goyal
2525994db4 ... 2022-08-01 19:02:57 +05:30
Kovid Goyal
81e6afa9b3 Cleanup fd transmit 2022-08-01 19:02:57 +05:30
Kovid Goyal
d8f5ccf9e4 Make master tty raw and print error messages with more context 2022-08-01 19:02:57 +05:30
Kovid Goyal
774489c578 ... 2022-08-01 19:02:57 +05:30
Kovid Goyal
39bb0ecfcf more work on socket based prewarm 2022-08-01 19:02:57 +05:30
Kovid Goyal
b222ab1bf6 Start work on socket based prewarm 2022-08-01 19:02:57 +05:30
Kovid Goyal
7a31c7ff50 Start work on everywhere prewarm 2022-08-01 19:02:57 +05:30
Kovid Goyal
132f87d152 show_key: use a better representation of the space key when 2022-08-01 13:25:56 +05:30
Kovid Goyal
aedda4bf9b ... 2022-07-31 10:36:03 +05:30
Kovid Goyal
40bba70bfe Wayland IME: Avoid printing errors for compositors that pointlessly acknowledge previous IME commits rather than just the current one. Apparently kwin is one such. Fixes #5339 2022-07-31 10:22:40 +05:30
Kovid Goyal
8202247b27 DRYer 2022-07-29 12:51:36 +05:30
Kovid Goyal
e2117ee8a4 ssh kitten: Allow completion of ssh options between the destination and command
This contravenes the documented command line parsing behavior of ssh but
matches its actual implementation. Sigh.

Fixes #5322
2022-07-29 08:29:49 +05:30
Kovid Goyal
e3a4150fea Second draw attempt has single fade edge 2022-07-29 08:15:38 +05:30
Kovid Goyal
0ce2a23af3 Allow tab title templates to use the current max title length 2022-07-29 07:43:55 +05:30
Kovid Goyal
6b2337c9c0 Merge branch 'master' of https://github.com/newbee1905/kitty-1 2022-07-26 20:27:59 +05:30
newbee1905
54661b7fc4 reflector: replace unecessary while loop 2022-07-26 21:47:52 +07:00
Kovid Goyal
a1f895b781 Merge branch 'master' of https://github.com/nullchilly/kitty 2022-07-26 19:10:34 +05:30
nullchilly
199c271edc Fix modify_font underline_position 1 2022-07-26 20:08:04 +07:00
Kovid Goyal
9ac744ae63 DRYer 2022-07-26 16:10:43 +05:30
Kovid Goyal
93b05bcd1e Make the calculation of the bound for underline_position more precise
Fixes #5308
2022-07-26 16:07:01 +05:30
Kovid Goyal
546cdbefae Don't expose all Tab methods in title template
They can have side effects so prevent user from foot shot
2022-07-26 13:13:00 +05:30
Kovid Goyal
352c07987b Nicer fix for showing cwd in tab titles 2022-07-26 12:35:07 +05:30
Kovid Goyal
f6a1eb19d7 Only import ReferenceType when type checking 2022-07-26 11:06:19 +05:30
Kovid Goyal
a352804c14 Merge branch 'misc' of https://github.com/page-down/kitty 2022-07-26 11:04:01 +05:30
pagedown
28ae8c4d20 Expand ~ when resolving editor path and applying exe_search_path 2022-07-26 13:21:50 +08:00
pagedown
1eef584382 Replace tr with string built-in in fish integration 2022-07-26 13:21:36 +08:00
pagedown
4e1cd0590b Use builtin to call read in zsh integration and bash integration 2022-07-26 13:20:50 +08:00
pagedown
fa670e1f5d ... 2022-07-26 13:20:41 +08:00
Kovid Goyal
c7fa6f620a py3.8 compat 2022-07-26 08:39:33 +05:30
Kovid Goyal
04690c8c7c Dont incur the cost of checking the cwd of a process on every tabbar update unless actually needed 2022-07-26 08:19:14 +05:30
Kovid Goyal
4345ea6602 Remove debugging code I left in the last commit accidentally 2022-07-26 08:17:44 +05:30
Kovid Goyal
d39c212336 Merge branch 'add-cwd-TabBarData' of https://github.com/nxvxl/kitty 2022-07-26 08:08:14 +05:30
Kovid Goyal
54d2f06abe remote files kitten: Fix working with files whose names have characters that need to be quoted in shell scripts
Fixes #5313
2022-07-26 08:06:25 +05:30
noval
237bfc9a6e add cwd to TabBarData
this option add current working directory to the tab by using active windows child directory.
2022-07-26 09:33:55 +07:00
Kovid Goyal
29b3d49cd5 Note that the crossterm library has added support for the kitty keyboard protocol 2022-07-26 07:45:57 +05:30
Kovid Goyal
fe8892ec54 Update changelog for previous PR 2022-07-21 20:03:46 +05:30
Kovid Goyal
2d8dd7a53e Merge branch 'rc-scroll-window' of https://github.com/page-down/kitty 2022-07-21 20:03:05 +05:30
pagedown
b493599690 Remote control: Allow half-scrolling when scrolling window by page 2022-07-21 21:05:56 +08:00
Kovid Goyal
d9371dc265 ssh kitten: Better handling of exit on keyboard interrupt 2022-07-20 21:40:51 +05:30
Kovid Goyal
ef2a12fbdf Ignore sigint while draining the tty 2022-07-20 19:40:23 +05:30
Kovid Goyal
7215c6d6be ssh kitten: Allow pressing Ctrl-C to abort ssh before the connection is completed
Fixing this involved adding a new mode to kitty where it handles
ctrl-c/z/q by sending signals to the tty foreground process group
instead of delegating to the kernel to do that. Since the pipe may be
full we have no way of knowing when the kernel will get around to
reading the signal byte. So send the signal ourselves.

Fixes #5271
2022-07-20 19:11:14 +05:30
Kovid Goyal
bd9e1f58fe ssh kitten: Make discarding of garbage data after ssh fails more robust
We now roundtrip an UUID via the terminal and only exit after receiving
it back. This guarantees that any pending data in the pipe is discarded.
2022-07-20 13:28:51 +05:30
Kovid Goyal
79dec269e1 ... 2022-07-16 10:25:18 +05:30
Kovid Goyal
d6ffbf4f3c Rebuild before and after publishing if a branch change was needed
Sometimes branches break things
2022-07-16 10:18:05 +05:30
Kovid Goyal
32588939ae Deprecate the adjust_baseline adjust_line_height and adjust_column_width options in favor of modify_font
Unifies handling and allow using pt units for those adjustments.
Note that the behavior of percentage sizes for adjust baseline is
backwards incompatible. It now uses the baseline value as the base
rather than the cell height.
2022-07-15 15:29:42 +05:30
Kovid Goyal
a02e07bfe8 Add modify_fonts to the changelog
Fixes #5265
2022-07-15 12:29:08 +05:30
Kovid Goyal
03df0c3cca Actually implement modify_font 2022-07-15 12:27:42 +05:30
Kovid Goyal
1aa50b73a1 Allow pixel based adjustments as well 2022-07-15 11:45:43 +05:30
Kovid Goyal
c910f483bf Improve formatting of config diff for modify_font 2022-07-15 11:15:57 +05:30
Kovid Goyal
14f4a8d28e Make modify_font available to C code 2022-07-15 11:06:24 +05:30
Kovid Goyal
ee931a17b0 Start work on option to modify font characteristics
Implement parsing of the option
2022-07-15 08:54:53 +05:30
Kovid Goyal
0a2ba3fb66 Merge branch 'fix-macos-launch' of https://github.com/page-down/kitty 2022-07-14 16:45:08 +05:30
pagedown
512db660a1 macOS: Fix unable to open new tab/window when there is no OS window 2022-07-14 18:25:00 +08:00
Kovid Goyal
b0666c9180 test.py now needs kitty built 2022-07-13 20:00:54 +05:30
Kovid Goyal
57d3d09679 DRYer 2022-07-13 19:49:40 +05:30
Kovid Goyal
3a17f54bca Add a note about how to exclude directories in the copy command 2022-07-12 16:23:48 +05:30
Kovid Goyal
4c2800b294 mask handled signals when running the signal handler 2022-07-10 12:52:51 +05:30
Kovid Goyal
8358377ec3 Fix reading multiple signals from buffer on macOS 2022-07-10 12:07:54 +05:30
Kovid Goyal
3ab12c616c Merge branch 'patch-1' of https://github.com/kidonng/kitty 2022-07-09 14:45:48 +05:30
Kid
ef4e784121 Fix link formatting in docs 2022-07-09 16:00:51 +08:00
Kovid Goyal
1ead20a5b9 Add a GitHub icon to the docs footer 2022-07-08 20:36:32 +05:30
Kovid Goyal
31dfee8a95 Nicer error message for zsh versions before 5.1 2022-07-08 20:28:42 +05:30
Kovid Goyal
d6492264c7 Bash integration: Fix declare not creating global variables in .bashrc
Fixes #5254
2022-07-08 18:55:04 +05:30
Kovid Goyal
7281b9dbb1 Ensure local kitty is used when running the tests 2022-07-05 21:09:09 +05:30
Kovid Goyal
4b63ee036e Run the test suite using the kitty binary 2022-07-05 21:05:03 +05:30
Kovid Goyal
fb8eb69c20 ... 2022-07-03 20:51:59 +05:30
Kovid Goyal
4b1fa2609d Match behavior of who when getting num_users by ignoring zombie pids 2022-07-03 14:46:54 +05:30
Kovid Goyal
a8b756f040 ssh kitten: A new option :code:--symlink-strategy to control how symlinks are copied to the remote machine
Fixes #5249
2022-07-03 14:03:56 +05:30
Kovid Goyal
a94a0f3026 Fix fd leak in prewarm zygote 2022-07-03 13:32:09 +05:30
Kovid Goyal
71c902eaf8 Build the launcher with debug symbols when using --debug 2022-07-03 13:28:57 +05:30
Kovid Goyal
6e7af8ce2e Merge branch 'fix-last-cmd-output' of https://github.com/page-down/kitty 2022-07-02 10:18:16 +05:30
pagedown
6c80cd040c Fix missing last line when getting output of the running command 2022-07-02 12:33:58 +08:00
Kovid Goyal
4ed413eaa7 Switch to GA2 2022-06-30 17:00:14 +05:30
Kovid Goyal
86357d2c38 ... 2022-06-29 18:53:11 +05:30
Kovid Goyal
c0d4d01b88 ... 2022-06-29 18:41:39 +05:30
Kovid Goyal
b3fcb53625 ssh kitten: Allow ssh kitten to work from inside tmux, provided the tmux session inherits the correct KITTY env vars
Fixes #5227
2022-06-29 18:40:22 +05:30
Kovid Goyal
4f29dea8ef Utility function to detect when running inside tmux 2022-06-29 17:51:38 +05:30
Kovid Goyal
4f8ef05058 Linux: Update cursor position after all key presses not just pre-edit text changes
Fixes #5241
2022-06-29 11:37:35 +05:30
Kovid Goyal
7fc1735a21 swaps_disallowed is used only on wayland 2022-06-28 20:19:52 +05:30
Kovid Goyal
1e49038747 Fix edit-in-kitty not working with editors that use file replace to save changes 2022-06-28 11:51:03 +05:30
Kovid Goyal
295fbe42ad Merge branch 'misc' of https://github.com/page-down/kitty 2022-06-28 11:42:37 +05:30
Kovid Goyal
60d33f2847 Wayland: Reduce flicker at startup by not using render frames immediately after a resize
Fixes #5235
2022-06-28 11:29:57 +05:30
Kovid Goyal
cd369f633a Wayland: Ensure that opengl buffer swapping does not happen till the xdg surface is configured 2022-06-28 10:47:33 +05:30
pagedown
c3df6d2fe3 Remove executable perms from kitten files 2022-06-28 11:59:47 +08:00
Kovid Goyal
72dfa74b3e Avoid an extra buffer swap during startup
glfw should not be swapping buffers behind the clients back. Since we
control the client, we can ensure that the OpenGL VRAM is cleared before
the window is shown.

Also fixes the issue with the glfw wayland backend where the buffer was
being created before the surface was configured
2022-06-28 09:25:24 +05:30
pagedown
1411269187 Docs: Improve documentation for remote commands
Use text roles in the document to apply the style in the cli output.
Add more links.
Unify the text roles.
Use code blocks instead of quote blocks.
Use '+' to connect the shortcut key names.
2022-06-28 11:52:20 +08:00
pagedown
185d959f25 ssh kitten: Add MacPorts paths to the common locations for login shell 2022-06-28 11:43:19 +08:00
pagedown
1652d41992 Fix edit-in-kitty not working when option editor comes with arguments 2022-06-28 11:41:27 +08:00
pagedown
297dea881d Use the same fish completion function for commands 2022-06-28 11:35:11 +08:00
pagedown
01df828353 Refactor the fish implementation of edit-in-kitty
Clean up global variable and signal handling function before exit.
For commands allowing the use of valid functions or binary executables.
2022-06-28 11:31:42 +08:00
pagedown
617115d447 Docs: edit-in-kitty works with neovim 2022-06-28 11:22:52 +08:00
Kovid Goyal
31f9978599 Merge branch 'patch-1' of https://github.com/AnonymouX47/kitty 2022-06-27 15:54:23 +05:30
My Avatar ;D
dc068c16e8 Update projects using kitty graphics protocol
Add `term-image` to the list of projects using the kitty graphics protocol.
2022-06-27 10:35:39 +01:00
Kovid Goyal
89626a462f ... 2022-06-25 20:46:02 +05:30
Kovid Goyal
a043588b4a Update changelog for last PR 2022-06-25 16:50:46 +05:30
Kovid Goyal
2e08ee16c2 Merge branch 'fix-macos-jis-kbd' of https://github.com/page-down/kitty
Fixes #5232
2022-06-25 16:49:46 +05:30
pagedown
2cc506476b macOS: Fix JIS Eisu and Kana keys not working 2022-06-25 19:01:02 +08:00
Kovid Goyal
0a462ad706 Forgot one place to change over to kitty_run_data 2022-06-24 10:31:55 +05:30
Kovid Goyal
81c1bfe1c5 ... 2022-06-24 09:26:38 +05:30
Kovid Goyal
8ce80e39d9 kitty now needs python >= 3.8 2022-06-24 00:01:35 +05:30
Kovid Goyal
fa823a37ae Backport 6281f498c8 2022-06-23 13:00:28 +05:30
Kovid Goyal
17f67fbe28 Add a note that WezTerm implements the kitty keyboard protocol as well 2022-06-23 11:22:01 +05:30
Kovid Goyal
560b78bc35 Dont leak kitty_run_data on error 2022-06-23 08:59:31 +05:30
Kovid Goyal
f023f047ff Workaround for Python 3.11 breaking sys._xoptions
Apparently in Python-land its acceptable behavior to break backward
compatibility with documented interfaces on a whim. Bloody joke.
https://github.com/python/cpython/pull/28823

Fixes #5223
2022-06-23 08:44:34 +05:30
Kovid Goyal
5673359be2 Merge branch 'sam/modern-whiskers-icon' of https://github.com/samholmes/kitty 2022-06-22 04:11:41 +05:30
Samuel Holmes
666696d142 Add "modern whiskers" alternative icon to FAQ 2022-06-21 11:04:24 -07:00
Kovid Goyal
f95bc48f9b kitty @ set-colors: Fix changing inactive_tab_foreground not working
Fixes #5214
2022-06-19 20:20:58 +05:30
Kovid Goyal
8d18fc09fa Merge branch 'fix-rc-new-window' of https://github.com/page-down/kitty 2022-06-19 18:21:22 +05:30
Kovid Goyal
a3d42a90f2 Get rid of os.waitid() since its not present on macOS we cannot rely on it anyway 2022-06-19 18:11:23 +05:30
pagedown
1da5f2ecc6 Fix the rc command new-window does not open the shell by default 2022-06-19 20:25:12 +08:00
Kovid Goyal
d226e82f68 It is only possible to not have an OS Window on macOS 2022-06-19 09:39:40 +05:30
Kovid Goyal
60cc2cb26c Merge branch 'fix-rc-launch' of https://github.com/page-down/kitty 2022-06-19 09:38:30 +05:30
pagedown
1ac90cf464 Allow remote control to launch a new OS window when there is none 2022-06-19 11:51:58 +08:00
Kovid Goyal
d3ffaebd17 Ignore exceptions in kitten result processors 2022-06-18 08:20:01 +05:30
Kovid Goyal
bf01c549f5 Allow kittens to handle multiple results in a window 2022-06-18 08:18:25 +05:30
Kovid Goyal
6912d8c086 No need for entire screen object when scaling a scroll 2022-06-18 06:55:28 +05:30
Kovid Goyal
a89e1b5573 Fix horizontal wheel events not being reported to client programs when they grab the mouse
Fixes #2819
2022-06-18 06:47:42 +05:30
Kovid Goyal
3a9c6088b2 Add debug output for scroll events 2022-06-18 05:54:26 +05:30
Kovid Goyal
fba629f385 Merge branch 'globinclude-sorted' of https://github.com/amarshall/kitty 2022-06-18 04:59:25 +05:30
Andrew Marshall
90477825c2 Make globinclude sort files before loading
`Path.glob` gives no guarantee about the order results are returned in.
This means that if files included by `globinclude` override each other,
the resulting config was non-deterministic. Resolve this by sorting the
results from `glob` to give consistent, well-defined order.
2022-06-17 18:50:16 -04:00
Kovid Goyal
1e56d39777 Wakeup main loop when refreshing window as well as io loop 2022-06-17 19:33:43 +05:30
Kovid Goyal
2829971412 Merge branch 'expose-wakeup-main-loop' of https://github.com/sirno/kitty 2022-06-17 19:09:07 +05:30
Nicolas Ochsner
c147fda6ca Expose wakeup main loop in python api. 2022-06-17 15:26:16 +02:00
Kovid Goyal
a27dfd8b7c Increase the timeout for prewarm I/O on CI 2022-06-14 21:17:28 +05:30
Kovid Goyal
a7c65efc45 Ensure local kitty is used in tests even when another kitty is present in the system PATH
Fixes #5194
2022-06-14 21:08:58 +05:30
Kovid Goyal
646a524c8e Sort imports 2022-06-14 20:06:12 +05:30
Kovid Goyal
f8d01d2c4f Use the same parser for resize_window actions and session setting 2022-06-14 20:03:21 +05:30
Kovid Goyal
1d846f3744 Cleanup previous PR
Merge branch 'session-resize-window' of https://github.com/sirno/kitty
2022-06-14 19:59:01 +05:30
Nicolas Ochsner
6bbe58f876 Change to pass window specs. 2022-06-14 12:28:41 +02:00
Nicolas Ochsner
36719fb086 Cleanup. 2022-06-14 11:23:35 +02:00
Nicolas Ochsner
78fd7a8458 Enable resizing in session files. 2022-06-14 11:09:26 +02:00
Kovid Goyal
f5976d0d63 Remove unneeded code 2022-06-13 21:33:07 +05:30
Kovid Goyal
b313fc3fbe Forgot to also add SIGUSR1 handler 2022-06-13 21:09:32 +05:30
Kovid Goyal
cf667b8c47 Use a signal handler instead of a pipe for child death notification 2022-06-13 20:40:04 +05:30
Kovid Goyal
7e3bd8586f Dont use SIGTSTP and SIGCONT in the test as they are very flaky 2022-06-13 20:29:58 +05:30
Kovid Goyal
d5df301317 Finer grained polling 2022-06-13 19:41:40 +05:30
Kovid Goyal
628246c3da Workaround for python 3.8 that doesnt have the CLD_* constants 2022-06-13 19:22:37 +05:30
Kovid Goyal
d228acd30a Use a busy loop for signaled process 2022-06-13 19:11:29 +05:30
Kovid Goyal
18cd97d914 Skip SIGSTSTP test when CLD_STOPPED is not available 2022-06-13 19:05:49 +05:30
Kovid Goyal
5f13946bac Allow using our signal handlers in python event loops via an fd
pythons signal fd only return signal numbers not the full siginfo struct
2022-06-13 18:52:23 +05:30
Kovid Goyal
8fb24fbc1e poll() takes times in ms not seconds 2022-06-13 18:51:35 +05:30
Kovid Goyal
f0d4952055 Use an iterator 2022-06-13 08:14:51 +05:30
Kovid Goyal
7113580db2 macOS has no waitid
Le Sigh
2022-06-13 02:19:51 +05:30
Kovid Goyal
163c211219 Use waitid() rather than waitpid() to get full exit status 2022-06-13 00:19:56 +05:30
Kovid Goyal
6993157b3a ... 2022-06-13 00:15:07 +05:30
Kovid Goyal
e2efdf674d Reap prewarmed processes 2022-06-13 00:11:16 +05:30
Kovid Goyal
9fcb8e5b6e Close unneeded fds in forked children 2022-06-12 20:26:20 +05:30
Kovid Goyal
a1a637c7f1 Restore SIGUSR1 handling in prewarmed child 2022-06-12 18:59:55 +05:30
Kovid Goyal
4f87f3e9f4 ... 2022-06-12 18:15:23 +05:30
Kovid Goyal
da6faa656c Use a fork() without exec() to create prewarm process
This has the advantages:

1) Even first kitten use is fast
2) Computer has to do less work overall since prewarm process is itself prewarmed
2022-06-12 18:06:51 +05:30
Kovid Goyal
e1ad75e932 Graphics protocol: Make it explicit what is supposed to happen when two images with the same z-index overlap
Fixes #5187
2022-06-10 22:10:11 +05:30
Kovid Goyal
646bdbd002 Wayland: Fix a regression in the previous release that caused mouse cursor animation and keyboard repeat to stop working when switching seats
Fixes #5188
2022-06-10 21:38:30 +05:30
Kovid Goyal
9184de1997 ... 2022-06-10 18:44:23 +05:30
Kovid Goyal
eabc29ec4d Changelog entry for prewarming 2022-06-09 10:43:00 +05:30
Kovid Goyal
e338cdab31 Increase the timeout when talking to prewarm process 2022-06-09 07:01:42 +05:30
Kovid Goyal
7001d609fa Fix spurious warning from runpy module when prewarmed 2022-06-09 07:01:42 +05:30
Kovid Goyal
c8399ce3d2 clear signal handlers in prewarm controller 2022-06-09 07:01:42 +05:30
Kovid Goyal
3e1d701dce DRYer 2022-06-09 07:01:41 +05:30
Kovid Goyal
a385c39c2e Fix reading of dead prewarmed child pids 2022-06-09 07:01:41 +05:30
Kovid Goyal
5d1cf339a7 Simplify child death tracking
Re-use the existing fd instead of catching signals
2022-06-09 07:01:41 +05:30
Kovid Goyal
fafb8518e0 Fix compilation on platforms without SO_PASSCRED 2022-06-09 07:01:41 +05:30
Kovid Goyal
6807f4d4ea Report the correct cmdline for prewarmed processes 2022-06-09 07:01:41 +05:30
Kovid Goyal
0ed7b2f3c0 Manage fd lifecycles a bit better 2022-06-09 07:01:41 +05:30
Kovid Goyal
116128ebb5 Get prewarm working
Needed to wait in the control process for child to set its controlling
terminal so that closing the slave fd in kitty is safe.
2022-06-09 07:01:41 +05:30
Kovid Goyal
0c870c5fcd handle child death and config reload for prewarmed processes 2022-06-09 07:01:41 +05:30
Kovid Goyal
90bc3ab770 Function to create a randomly named UNIX domain socket 2022-06-09 07:01:41 +05:30
Kovid Goyal
0021b0c242 Prewarm all kittens 2022-06-09 07:01:41 +05:30
Kovid Goyal
6dc076f5d1 Complete move to prewarm.py 2022-06-09 06:54:05 +05:30
Kovid Goyal
2dd1201c3f Dont use a kitten for prewarm 2022-06-09 06:53:51 +05:30
Kovid Goyal
9be68966b4 Also detect ssh kitten run as an overlay 2022-06-08 18:53:54 +05:30
Kovid Goyal
47d482dca9 Clear signal handlers when running processes 2022-06-08 17:50:42 +05:30
Kovid Goyal
18dd13c872 Make init_loop_data a little safer to use 2022-06-08 15:10:52 +05:30
Kovid Goyal
c71bb877c3 Handle SIGHUP gradefully 2022-06-08 09:06:28 +05:30
Kovid Goyal
eee8106f9e Fix a regression that broke completion when using a kitty alias instead of having kitty on PATH 2022-06-08 07:36:09 +05:30
Kovid Goyal
80ad596d3d Yet another place where macos_colorspace was broken 2022-06-08 07:17:34 +05:30
Kovid Goyal
9dbafcc368 Remove unneccessary argument to connection_sharing_args() 2022-06-07 20:40:01 +05:30
Kovid Goyal
9f5f113840 ... 2022-06-07 13:05:07 +05:30
Kovid Goyal
6afbdbe94f Use correct kitty config in prewarmed process 2022-06-07 12:53:39 +05:30
Kovid Goyal
061a0c8cb6 Reset global options object in the tests 2022-06-07 10:58:03 +05:30
Kovid Goyal
ad128a3c29 version 0.25.2 2022-06-07 07:32:35 +05:30
Kovid Goyal
b71d2e04ca Clarify behavior of placement id when image id is zero 2022-06-07 07:22:12 +05:30
Kovid Goyal
cc3c7b0286 Fix waitpid() call on python 3.8 2022-06-06 21:22:04 +05:30
Kovid Goyal
bf6c90a69a Compare realpaths for cwd test 2022-06-06 20:46:49 +05:30
Kovid Goyal
4c9a75c1ba Remove unused code 2022-06-06 20:45:40 +05:30
Kovid Goyal
98f46f8bd7 Start work on prewarming
The prewarm process and its controller are implemented with some basic
tests.
2022-06-06 20:39:36 +05:30
Kovid Goyal
dec62b1929 Allow ignoring SHM close failures
Useful if we export the mmap beyond the lifetime of the shm object
2022-06-06 20:31:13 +05:30
Kovid Goyal
79f7954048 Cleanup previous PR 2022-06-06 17:19:52 +05:30
Kovid Goyal
fc217dafba Merge branch 'master' of https://github.com/suvayu/kitty 2022-06-06 16:55:08 +05:30
Kovid Goyal
a6aff817cf Prepare for prewarm testing 2022-06-06 15:59:34 +05:30
Suvayu Ali
38cb18fe92 diff kitten: tests for directory walking 2022-06-06 11:01:45 +02:00
Suvayu Ali
20b6a97159 Update in response to feedback
- one configuration option: ignore_paths
- use shlex to parse option to support whitespace and in-line comments
- change option type to Tuple[str, ...]
- remove ignored directories from dirnames to prevent scanning
2022-06-06 11:00:45 +02:00
Kovid Goyal
98f6e24106 Move block outside try/except as it doesnt need to be in there 2022-06-06 08:17:15 +05:30
Kovid Goyal
4ed6364b61 Fix compiler warning on 32bit builds 2022-06-06 07:19:52 +05:30
Kovid Goyal
cd7751681d hints kitten: Fix surrounding quotes/brackets and embedded carriage returns not being removed when using line number processing
Fixes #5170
2022-06-05 18:07:16 +05:30
Kovid Goyal
76531d2f7a Python wrapper function to establish controlling tty 2022-06-05 15:36:05 +05:30
Suvayu Ali
eea652f1d0 kittens/diff: move empty pattern check to dir tree walk 2022-06-05 10:11:21 +02:00
Kovid Goyal
f20f4762a8 Use builtin facility for removing cloexec 2022-06-05 12:33:34 +05:30
Kovid Goyal
c004fd1f4d Declare the set of handled signals in only one place 2022-06-05 08:01:26 +05:30
Kovid Goyal
f29039db29 Make the full signal info available in our signal handler 2022-06-05 07:22:38 +05:30
Suvayu Ali
fbf1ec43c7 diff kitten: add options to ignore paths when comparing directories
Tested locally & over SSH:

    $ kitty +kitten diff /local/path /local/path2
    $ kitty +kitten diff /local/path ssh:remote:/path
2022-06-05 00:11:30 +02:00
Kovid Goyal
a42200a430 Use the log_error function to log SIGUSR2 2022-06-04 15:38:56 +05:30
Kovid Goyal
ad576c333c Also restore signal handlers for SIGUSR1 and SIGUSR2 2022-06-04 15:15:39 +05:30
Kovid Goyal
5a0a980648 Make getting cmdline of a PID a bit more convenient 2022-06-04 15:07:08 +05:30
Kovid Goyal
b3578a4fa5 ... 2022-06-04 14:54:32 +05:30
Kovid Goyal
3c952b01d3 Fix reloading in all kitties skipping kitty processes started as kitty +open 2022-06-04 14:53:13 +05:30
Kovid Goyal
b1453a51f6 Better error message for kitty + 2022-06-04 14:47:13 +05:30
Kovid Goyal
2c3a7b5f41 Restore a couple more signal handlers that python nukes 2022-06-04 14:30:08 +05:30
Kovid Goyal
0df5a6c6c8 Utility function to test if PID is alive 2022-06-04 14:14:24 +05:30
Kovid Goyal
bf4dc6365a Add support for sigqueue() and also handle SIGUSR2
I anticipate using sigqueue() for simpler handling of SIGCHLD
notifications from the prewram process to the its parent.
2022-06-04 14:09:45 +05:30
Kovid Goyal
ce3322bf91 Remote control: Fix commands with asynchronous payloads not sending responses
Fixes #5165
2022-06-04 10:13:21 +05:30
Kovid Goyal
835cb31501 Fix incorrect dispatch of poll events when more than one peer is present 2022-06-04 09:26:57 +05:30
Kovid Goyal
762dd065f3 Nicer reverse loop 2022-06-04 09:06:35 +05:30
Kovid Goyal
7b91447d89 Use a full chekcout in CI when building docs
The :commit: docs role requires it
2022-06-04 08:00:00 +05:30
Kovid Goyal
1146c4ea3f Merge branch 'ignore-fig-osc' of https://github.com/grant0417/kitty 2022-06-04 07:44:17 +05:30
grant0417
729f7b8e03 Add custom message for Fig OSC 2022-06-03 18:57:53 -07:00
grant0417
d3ec632b9f Ignore Fig OSC codes 2022-06-03 17:07:44 -07:00
Kovid Goyal
cb01b5ee44 DRYer 2022-06-03 21:38:49 +05:30
Kovid Goyal
0828096e9e ... 2022-06-03 18:30:14 +05:30
Kovid Goyal
ebcbed290f Make loading of kitty options in kitten re-useable 2022-06-03 17:49:58 +05:30
Kovid Goyal
d6afe6f2cb Move entrypoints into their own module 2022-06-03 11:12:13 +05:30
Kovid Goyal
4daf70f636 ... 2022-06-03 11:08:41 +05:30
Kovid Goyal
2f3dd72c84 Weston: Fix client side decorations flickering on slow computers during window resize
Fixes #5162
2022-06-03 11:00:56 +05:30
Kovid Goyal
dca8c65376 Fix display of url open failures not working 2022-06-02 10:41:08 +05:30
Kovid Goyal
12d8175d9a Use inode/executable rather than application/executable 2022-06-02 10:33:56 +05:30
Kovid Goyal
609bcd68dd Fix #5161 2022-06-02 10:32:43 +05:30
Kovid Goyal
313136803c DRYer 2022-06-02 10:21:34 +05:30
Kovid Goyal
b937033411 macOS: Allow opening executables without a file extension with kitty as well
Fixes #5160
2022-06-02 09:25:30 +05:30
Kovid Goyal
55eeb9c11e Dont import kitty.complete in ssh.main 2022-06-02 08:08:33 +05:30
Kovid Goyal
8fbec2dfd5 remove unused arg 2022-06-02 08:07:53 +05:30
Kovid Goyal
c4521290b8 ... 2022-06-01 19:43:41 +05:30
Kovid Goyal
e12a9f3caf Iosevka: Fix incorrect rendering when there is a combining char that does not group with its neighbors
Fixes #5153
2022-06-01 12:00:53 +05:30
Kovid Goyal
56f8a06362 DRYer 2022-06-01 08:47:19 +05:30
Kovid Goyal
5c4abe749b Merge branch 'fontconfig-special-sources' of https://github.com/leungbk/kitty 2022-06-01 08:33:13 +05:30
Brian Leung
62c27b3db7 Add kitty/fontconfig.c to SPECIAL_SOURCES
Fixup of bec620a8d3.
2022-05-31 19:58:42 -07:00
Kovid Goyal
1283a2b7e5 ... 2022-06-01 08:21:23 +05:30
Kovid Goyal
bec620a8d3 Fix #5154 2022-06-01 08:19:11 +05:30
Kovid Goyal
6b0bb2e845 Sphinx v5 needs language to be not None 2022-06-01 06:47:06 +05:30
Kovid Goyal
135818f34b Note about __main__.py with +launch 2022-05-31 07:56:01 +05:30
Kovid Goyal
2a361d1de1 Update changelog for last PR 2022-05-31 07:46:00 +05:30
Kovid Goyal
761a941d43 Merge branch 'kovidgoyal-master' of https://github.com/jimbob3806/kitty 2022-05-31 07:41:40 +05:30
Kovid Goyal
c03630a487 ... 2022-05-31 07:26:04 +05:30
James Reid
0b79cbdb3b Add "user" tab to themes kitten
Add new tab named "user" to the built-in themes kitten - new tab
filters and displays only user-defined color themes, identified by
adding "is_user_defined" property to "Theme" class which defaults
to False, and is set True when a theme is fetched using the
"load_from_dir" method.
2022-05-30 19:25:09 +01:00
James Reid
1dc6b49e02 Remove hard coded tab string in ThemesHandler
Remove hard coded tab string and replace with self.tabs, which is
a reference to the same tab string defined in the __init__ of
ThemesHandler
2022-05-30 19:17:07 +01:00
Kovid Goyal
1962f8e5a0 Advertise edit-in-kitty a bit more 2022-05-30 15:27:23 +05:30
Kovid Goyal
cabfcbcb69 macOS: When pasting text and the clipboard has a filesystem path, paste the full path instead of the text, which is sometimes just the file name
Fixes #5142
2022-05-30 14:40:45 +05:30
Kovid Goyal
48bb43a2c4 fish: completion for edit-in-kitty clone-in-kitty
fish's wrapping facility does not preserve argv[0] so it cannot be used
unlike for zsh and bash
2022-05-30 10:50:19 +05:30
Kovid Goyal
af5e3e0c18 Add a reference to edit-in-kitty to the remote file kitten docs 2022-05-30 08:19:33 +05:30
Kovid Goyal
fb8398c2eb bash: completion for edit/clone-in-kitty 2022-05-30 08:16:51 +05:30
Kovid Goyal
eefd4bb3e3 zsh: Completion for edit-in-kitty and clone-in-kitty 2022-05-30 08:12:09 +05:30
Kovid Goyal
581c388838 ... 2022-05-29 15:02:37 +05:30
Kovid Goyal
7a63ea6480 Drop python 3.7 from CI 2022-05-29 14:54:51 +05:30
Kovid Goyal
65f1329635 Wayland: When the seat is closed remove any pending pointer animation and key repeat timers
Fixes #5145
2022-05-29 14:50:34 +05:30
Kovid Goyal
0df9a5d5c5 Fix compilation on Python 3.11
Python 3.11 deprecates the supposedly "stable API" PySys_AddXOption().
So switch to using PyConfig.xoptions instead. This means dropping
support for python 3.7 since PyConfig is not available there. So it
rolls.

Fixes #5143
2022-05-29 14:37:14 +05:30
Kovid Goyal
6405849a1b Bash integration clone test was accidentally running zsh
Fixes #5144
2022-05-29 08:46:06 +05:30
Kovid Goyal
e9340dfaaf Some more tests for last non empty command output 2022-05-28 15:22:17 +05:30
Kovid Goyal
0509855930 Allow getting the last non-empty command output easily via an action or remote control
Fixes #4973
2022-05-28 15:19:24 +05:30
Kovid Goyal
4c74462763 ssh kitten: Look in common locations for login shell if it is not in PATH 2022-05-28 11:29:09 +05:30
Kovid Goyal
7f69381221 Update changelog 2022-05-28 11:13:35 +05:30
Kovid Goyal
75942fb47e Implement edit-in-kitty for fish 2022-05-28 11:12:11 +05:30
Kovid Goyal
0893d7164a _run_kitten -> run_kitten_with_metadata 2022-05-28 11:00:25 +05:30
Kovid Goyal
27906ea853 Skip login shell detection when login shell is set to nologin 2022-05-28 08:09:30 +05:30
Kovid Goyal
8540ca3990 Workaround for nix package messing with kitty file permissions 2022-05-28 08:03:17 +05:30
Kovid Goyal
e82c5a63b5 Avoid unnecessary use of cat 2022-05-27 14:18:16 +05:30
Kovid Goyal
83602d7e53 Make chunked transmit code re-useable in fish integration script 2022-05-27 13:21:26 +05:30
Kovid Goyal
64e30e5299 Ignore permission errors when stating file to edit 2022-05-27 13:04:02 +05:30
Kovid Goyal
83ce23ff9f Use zsh's builtin stat instead of relying on the stat command 2022-05-27 12:50:52 +05:30
Kovid Goyal
c5e5ec618d Also trap SIGTERM to cleanup 2022-05-27 12:39:22 +05:30
Kovid Goyal
bd84ec03ce Implement edit-in-kitty for bash 2022-05-27 12:38:26 +05:30
Kovid Goyal
d71f18566e forgot to declare data local 2022-05-27 12:29:11 +05:30
Kovid Goyal
76e75d9f89 Ensure self.tdir exists in __del__ 2022-05-27 10:48:16 +05:30
Kovid Goyal
f5695ac4f4 Increase edit file size limit to 8MB 2022-05-27 10:45:36 +05:30
Kovid Goyal
b748cd21cf Allow opening files at a spedific line number with edit-in-kitty 2022-05-27 09:53:43 +05:30
Kovid Goyal
3a8bdf3b48 React instantly to editor window being closed 2022-05-27 09:15:16 +05:30
Kovid Goyal
196c6b07aa Merge branch 'fix-window-menu' of https://github.com/henryhchchc/kitty 2022-05-27 09:12:56 +05:30
Henry Chu
1978cc5b55 Fixed #5132 2022-05-27 11:15:16 +08:00
Kovid Goyal
ea47cee23f Document edit-in-kitty 2022-05-27 07:41:54 +05:30
Kovid Goyal
e6844ad6f2 ssh kitten: Run bash as a login shell
This fell through the cracks in the rewrite for automatic shell
integration. Fixes #5130
2022-05-26 21:24:32 +05:30
Kovid Goyal
02d5b3eafa Fix shebang 2022-05-26 21:21:36 +05:30
Kovid Goyal
151dacf17f Update changelog 2022-05-26 21:21:27 +05:30
Kovid Goyal
117d1b02be Start work on edit-in-kitty 2022-05-26 21:16:42 +05:30
Kovid Goyal
cb55878efd Fix #5129 2022-05-26 19:42:20 +05:30
Kovid Goyal
ea4751eae5 Move logic for handling chunked remote data into a separate function
Use the existing clipboard_max_size as the limit for remote data
2022-05-26 08:52:20 +05:30
Kovid Goyal
cc4f1c0a24 version 0.25.1 2022-05-26 07:59:25 +05:30
Kovid Goyal
3eb5320e29 Add tpix to list of programs that speak the graphics protocol 2022-05-25 12:27:38 +05:30
Kovid Goyal
4f63cff1a4 Make _run_kitten public API 2022-05-25 07:14:18 +05:30
Kovid Goyal
8381171c8d Forgot trailing newline 2022-05-24 06:54:53 +05:30
Kovid Goyal
1b2d54d97a Output a warning when libwayland-cursor returns incorrectly sized cursor images 2022-05-23 12:50:47 +05:30
Kovid Goyal
e7da874b82 GNOME: Workaround for GNOME's text input system going into an infinite loop if cursor position is updated in response to a done event
Fixes #5105
2022-05-23 10:36:58 +05:30
Kovid Goyal
ea8bed2a71 Fix #5113 2022-05-20 20:45:08 +05:30
Kovid Goyal
c747e681a2 Merge branch 'patch-1' of https://github.com/jack1142/kitty 2022-05-20 20:42:11 +05:30
Jakub Kuczys
a9a9ec80b5 Support the short pretty flag (-p) in hyperlinked_grep kitten 2022-05-20 10:57:42 +02:00
Kovid Goyal
eb84990f5a Fix #5110 2022-05-19 09:55:12 +05:30
Kovid Goyal
1938ba3108 Add changelog entry for previous PR 2022-05-18 20:04:09 +05:30
Kovid Goyal
0eee2db199 Merge branch 'add-option-select_by_word_characters_forward' of https://github.com/kgraefe/kitty 2022-05-18 20:02:11 +05:30
Kovid Goyal
bba1455e28 Dont import all of the ssh kitten just to detect commandlines 2022-05-18 15:58:06 +05:30
Konrad Gräfe
8c41cc8d3e Add option select_by_word_characters_forward
This adds an option to select separate characters for forward and
backward word extension on double click. If it is empty the old behavior
is preserved. This is the default.

If it is not empty, select_by_word_characters_forward will be used for
extending the selection in forward direction (right) and
select_by_word_characters will be used for extending in backward
direction (left).

Signed-off-by: Konrad Gräfe <kgraefe@paktolos.net>
2022-05-16 11:09:36 +02:00
Kovid Goyal
5efcb35cfb Only integrate with ssh kitten if shared connections are enabled for that host 2022-05-14 10:37:05 +05:30
Kovid Goyal
1b4cf1fea7 Remote file kitten: Integrate with the ssh kitten 2022-05-14 10:31:18 +05:30
Kovid Goyal
d3656bf7e9 Linux: Load libfontconfig at runtime to allow the binaries to work for running kittens on servers without FontConfig 2022-05-13 19:56:19 +05:30
Kovid Goyal
aaffec1cbc Better error message 2022-05-13 19:25:37 +05:30
Kovid Goyal
ed9391d4d6 Add a note explaining why fontconfig is not bundled 2022-05-13 17:45:16 +05:30
Kovid Goyal
58333f260b Fix spurious error print in test 2022-05-13 17:42:00 +05:30
Kovid Goyal
cf8ccabad9 Fix deleting images by row not calculating image bounds correctly
Fixes #5081
2022-05-13 09:51:25 +05:30
Kovid Goyal
600c595fdf Fix reloading of config not working when kitty.conf does not exist when kitty is launched
Fixes #5071
2022-05-08 20:57:23 +05:30
Kovid Goyal
2427d2d9da Workaround Apple's "hardening" breaking the platform module
Fix #5065
Fix #5051
2022-05-07 20:43:10 +05:30
Kovid Goyal
4ca70bfa26 ... 2022-05-04 13:21:17 +05:30
Kovid Goyal
4e8eb2f7f0 Merge branch 'rc-match' of https://github.com/page-down/kitty 2022-05-01 21:23:58 +05:30
pagedown
b6cf4bc78f ... 2022-05-01 23:27:33 +08:00
pagedown
622cd5531a Raise an exception when not in broadcast and no match for send-text
send-text still won't return an error code when there is no match,
since no_response is True by default.
2022-05-01 23:05:44 +08:00
pagedown
ec35b0cc7c Fix remote command --match=all returns empty 2022-05-01 23:05:22 +08:00
pagedown
0719c7f8bb DRYer: Use window matching function in remote commands 2022-05-01 23:04:50 +08:00
Kovid Goyal
bb7e4039e8 Merge branch 'rc-err' of https://github.com/page-down/kitty 2022-05-01 07:11:21 +05:30
pagedown
a0559e506b Show error message when remote command arguments are invalid 2022-04-30 22:01:58 +08:00
Kovid Goyal
4ce4176bbe cleanup previous PR 2022-04-30 15:03:27 +05:30
Kovid Goyal
99409f0a8b Merge branch 'docs' of https://github.com/page-down/kitty 2022-04-30 14:41:12 +05:30
pagedown
13303416b8 Docs: Improve the documentations
Add more text roles and links.
Fix typos.
Adjust the default shortcut order in overview.
Notes on the impact of kitty-open.desktop on the default open apps.
Document KITTY_DEVELOP_FROM in glossary.
Add Python type hints to the watcher example.
Mention clone-in-kitty in launch --copy-env.
Fix remote control ls example does not work, by escaping the backslash.
2022-04-30 17:07:36 +08:00
Kovid Goyal
9811d677e5 query terminal kitten: Return fast when run in non-kitty terminals 2022-04-30 14:25:39 +05:30
pagedown
b9fd039668 Docs: Document the env vars set by kitty for auto shell integration 2022-04-30 16:54:53 +08:00
pagedown
6c1f20bb27 Docs: Mention close_shared_ssh_connections in ssh kitten config docs 2022-04-30 16:54:46 +08:00
pagedown
2b58316c64 ... 2022-04-30 16:54:41 +08:00
Kovid Goyal
f2df629634 ... 2022-04-30 09:38:08 +05:30
Kovid Goyal
8f46505a50 Header to print stack traces in C 2022-04-30 09:28:05 +05:30
Kovid Goyal
c48bf4fd85 Output debug lines for when kitty sets the pointer in Wayland 2022-04-30 09:13:08 +05:30
Kovid Goyal
8c67f5aea8 Merge branch 'fix-gen-conf' of https://github.com/page-down/kitty 2022-04-30 07:35:15 +05:30
pagedown
76f84e32c4 Fix the generated sample kitty.conf containing invalid options 2022-04-30 02:23:33 +08:00
Kovid Goyal
4a7125ec92 ssh kitten: Suppress error prints about invalid items in kitty.conf
Fixes #4985
2022-04-29 20:39:32 +05:30
Kovid Goyal
92c3af6a92 Allow using --match=all in all rc commands 2022-04-29 17:17:07 +05:30
Kovid Goyal
443f36ebc7 Merge branch 'docs' of https://github.com/page-down/kitty 2022-04-29 07:11:40 +05:30
pagedown
17632dea3c Docs: Improve remote control command documentation
Improve the --match option description.
Add more text roles and links.
Fix typos.
2022-04-29 01:31:11 +08:00
pagedown
bb78dc5ccb Docs: Fix the help text of query_terminal and other minor tweaks
Use --match-tab in broadcast kitten example.
2022-04-29 01:30:45 +08:00
Kovid Goyal
2737cb7dd0 Fix #5026 2022-04-28 22:12:43 +05:30
Kovid Goyal
08b2ce444f Also dont apply umask when extracting bootstrap data 2022-04-28 17:28:40 +05:30
Kovid Goyal
289028b468 Prevent umask from interfering with tar file extraction
Fixes #5025
2022-04-28 17:21:34 +05:30
Kovid Goyal
2b3be147e6 Allow three combining chars per cell
Makes use of otherwise wasted padding in the CPUCell struct
2022-04-28 09:45:34 +05:30
Kovid Goyal
1a2d9c6fba Fix a couple of issues highlighted by updated mypy 2022-04-28 07:03:35 +05:30
Kovid Goyal
af15b0313a Ensure there are no duplicate watchers for send-text sessions 2022-04-27 22:17:09 +05:30
Kovid Goyal
b080296326 Remove unused code 2022-04-27 21:25:39 +05:30
Kovid Goyal
516e0e8bb3 broadcast kitten: Keep the ghost cursors in target windows as long as broadcast window has focus 2022-04-27 21:24:18 +05:30
Kovid Goyal
57e23bd4e3 Handle zero blink time correctly 2022-04-27 20:37:23 +05:30
Kovid Goyal
59534d620e Use cursor blink interval as TIMEOUT_FOR_SESSION 2022-04-27 20:31:16 +05:30
Kovid Goyal
068b7e8d63 remove unused adjust_line_height() function 2022-04-27 20:21:36 +05:30
Kovid Goyal
2c1edb9611 Merge branch 'docs' of https://github.com/page-down/kitty 2022-04-27 20:18:39 +05:30
pagedown
510022c3c1 Docs: Improve the documentation for kittens
Add more text roles and links.
Add an example that broadcasts only to other windows in the current tab.
Initial capitalization of the key names in the kbd text role.
Add Python type hints for custom kittens.
Note about hyperlink support for ls on macOS.
Add description text for show_key.
2022-04-27 16:14:54 +08:00
Kovid Goyal
627c79ffbb Show detailed traceback when using show_error() 2022-04-26 13:58:57 +05:30
Kovid Goyal
e80cd36237 Show traceback on stderr for action failures 2022-04-26 11:58:17 +05:30
Kovid Goyal
92ebada9a6 ... 2022-04-26 11:15:45 +05:30
Kovid Goyal
462ae3bb58 ... 2022-04-26 11:15:33 +05:30
Kovid Goyal
6d6d9cc26b macOS: Add the macos_colorspace option to control what color space colors are rendered in
Fixed #4686
2022-04-26 11:14:01 +05:30
Kovid Goyal
a36d5dcde1 GLFW API for changing colorspace of windows on cocoa 2022-04-26 10:56:34 +05:30
Kovid Goyal
f9f6f98527 Note that neovim is also getting support for the kitty keyboard protocol 2022-04-26 08:39:44 +05:30
Kovid Goyal
ee94114eb2 Fix #5016 2022-04-26 08:20:24 +05:30
Kovid Goyal
8e98fcf2f6 Merge branch 'docs' of https://github.com/page-down/kitty 2022-04-25 14:16:16 +05:30
pagedown
c4710bf9cb Docs: Add text to the ref text role and minor tweaks
The text will be used when generating the commented configuration file.
Use inline literal to quote codes with spaces, as the `code` text role
will be removed when the commented configuration is generated, making it
indistinguishable from normal text.
2022-04-25 15:36:57 +08:00
pagedown
97a568a405 Docs: Improve the FAQ
Add more text roles and links.
Document `PATH` in the glossary.
2022-04-25 15:36:51 +08:00
pagedown
7bace19aed clone-in-kitty: Skip more SSH env vars to use the correct values 2022-04-25 15:36:43 +08:00
pagedown
7282f1f684 Docs: Improve ssh kitten documentation
Add more text roles.
Put the env example at the end.
The alias syntax of fish and bash requires quotation marks.
Document `SSH_ASKPASS` in the glossary.
2022-04-25 15:36:37 +08:00
Kovid Goyal
9edb772a81 Merge branch 'fix-launch-cwd-oldest' of https://github.com/rafikdraoui/kitty 2022-04-24 22:04:05 +05:30
Rafik Draoui
d123b6c377 Fix launch --cwd=oldest 2022-04-24 13:19:22 -03:00
Kovid Goyal
c9ba3695d3 ... 2022-04-24 15:50:02 +05:30
Kovid Goyal
0ee970b418 --hold is not suitable for replay commands as it outputs to the terminal 2022-04-24 15:37:20 +05:30
Kovid Goyal
8239cb1b5a Merge branch 'docs' of https://github.com/page-down/kitty 2022-04-24 15:36:35 +05:30
pagedown
97caa073b0 Docs: Improvements to the configuration documentation
Slightly adjust and simplify the config option descriptions.
Add more text roles.
Initial capitalized key names.
Change some examples to better demonstrate configurations.
Fix listen_on description.
Also document cmd+c and cmd+v.
Fix doc text role links in commented out configuration file.
2022-04-24 17:32:49 +08:00
pagedown
45bbe17559 Docs: Minor improvements to the kitty cli help documentation
Add some text roles.
Use `kitty --hold`.
Use `appname` and `conf_name`.
`appname` is also applied to the system-wide configuration path.
2022-04-24 17:18:55 +08:00
pagedown
288d16f7be Docs: Minor tweaks to the help documentation of hints kitten 2022-04-24 17:18:45 +08:00
pagedown
ecb60b313e Docs: Improve clone-in-kitty documentation and fix LANG descriptions
Reduce duplicate `launch`.
Add links to python venv and conda.
Adjust the order of env vars, `.._CODE` takes precedence over `.._PATH`.
Add clone-in-kitty env vars to glossary.
Correct the description of the LANG env var.
2022-04-24 17:18:31 +08:00
Kovid Goyal
cf2a20e4ea Merge branch 'fix-f-string' of https://github.com/page-down/kitty 2022-04-24 08:03:51 +05:30
pagedown
bc4f40fea7 ... 2022-04-24 09:34:22 +08:00
Kovid Goyal
102097da5a DRYer 2022-04-23 12:51:02 +05:30
Kovid Goyal
0e3528df14 Merge branch 'feat-macos-open-website' of https://github.com/page-down/kitty 2022-04-23 12:49:21 +05:30
Kovid Goyal
214631c2dd Sort frozenset literals in generated options class definition 2022-04-23 11:23:21 +05:30
pagedown
e919857dfc macOS: Make the global menu shortcut to open kitty website configurable
This allows remapping the key combination shift+cmd+/
2022-04-23 13:22:27 +08:00
pagedown
a5bd1dcb08 Add a new mappable action open_url 2022-04-23 13:17:28 +08:00
Kovid Goyal
37cdaea9ed Also save command history before cloning in bash 2022-04-22 23:40:59 +05:30
Kovid Goyal
6bbaf5f1cf zsh cloning: save history so that it is up-to-date in cloned shell 2022-04-22 23:34:34 +05:30
Kovid Goyal
8808a252ae Merge branch 'docs' of https://github.com/page-down/kitty 2022-04-22 13:29:24 +05:30
pagedown
5f1376b9a0 ... 2022-04-22 15:02:23 +08:00
Kovid Goyal
efa873bf50 DRYer 2022-04-22 10:53:25 +05:30
Kovid Goyal
714461de76 Also ensure oldest cwd request type is honored by modify_argv 2022-04-22 08:40:18 +05:30
Kovid Goyal
b753cf6879 Forgot to implement at_prompt use of reported cwd in modify_argv 2022-04-22 08:25:46 +05:30
Kovid Goyal
27010d0446 Merge branch 'docs' of https://github.com/page-down/kitty 2022-04-21 15:24:18 +05:30
Kovid Goyal
bdc039fbf5 Fix docstring 2022-04-21 14:51:23 +05:30
pagedown
72f92f3174 Docs: Mention again that kitty.conf will be created if not present 2022-04-21 16:45:12 +08:00
Kovid Goyal
8fcd5e40d4 Proper fix for reporting button in drag events to children 2022-04-21 11:41:57 +05:30
Kovid Goyal
b76319b7e8 Update changelog 2022-04-21 11:34:18 +05:30
Kovid Goyal
feeb8f28c4 Fix #4993 2022-04-21 11:00:34 +05:30
Kovid Goyal
55b21b741e Fix a regression in the previous release that caused mouse move events to be incorrectly reported as drag events even when a button is not pressed
Fixes #4992

Will need to investigate a different fix for #4925. xterm does report
the button press that caused the drag to start with move events, so we
will have to track that to match its behavior as glfw does not track it
for us.
2022-04-21 07:53:37 +05:30
Kovid Goyal
6941884221 ... 2022-04-20 13:36:26 +05:30
Kovid Goyal
6174c2008f ... 2022-04-20 10:10:05 +05:30
Kovid Goyal
1a32e79470 ... 2022-04-19 21:14:34 +05:30
Kovid Goyal
dd032db89c Merge branch 'docs' of https://github.com/page-down/kitty 2022-04-19 21:07:03 +05:30
pagedown
f70e0e216c Docs: Show copy button for installation command snippets 2022-04-19 23:28:51 +08:00
Kovid Goyal
51362706d7 Fix closing a tab incorrectly storing the tab to its right in the active tab history 2022-04-19 17:44:01 +05:30
Kovid Goyal
b2c317ebc6 ... 2022-04-19 17:38:16 +05:30
Kovid Goyal
90acbd0dd5 Add a note about ssh kitten colors to FAQ 2022-04-19 15:21:05 +05:30
Kovid Goyal
402fac3edf ... 2022-04-19 10:53:18 +05:30
Kovid Goyal
c4c62c1505 When using --keep-focus ensure active history list is not affected
Fixes #4987
2022-04-18 20:23:15 +05:30
Kovid Goyal
b569c01b49 Fix #4986 2022-04-18 17:04:05 +05:30
Kovid Goyal
c0d9b6e979 Merge branch 'docs' of https://github.com/page-down/kitty 2022-04-18 12:41:05 +05:30
pagedown
b94afbba13 ... 2022-04-18 14:51:15 +08:00
Kovid Goyal
1994c17c75 Note on how clone-in-kitty works 2022-04-18 12:08:32 +05:30
Kovid Goyal
f88a4fe986 ... 2022-04-18 11:13:16 +05:30
Kovid Goyal
25616aaa7b Merge branch 'clone-in-kitty' of https://github.com/page-down/kitty 2022-04-18 10:57:55 +05:30
pagedown
19fdcec358 ... 2022-04-18 11:54:14 +08:00
pagedown
45eb4a0760 clone-in-kitty: Remove duplicate PATH entries in fish implementation 2022-04-18 11:46:29 +08:00
pagedown
9e026983e6 clone-in-kitty: Remove CONDA_PREFIX_* env vars 2022-04-18 11:42:22 +08:00
Kovid Goyal
be0a524e23 Yet another try to get zsh to de-dup $PATH 2022-04-18 07:40:37 +05:30
Kovid Goyal
339af1b4b2 Add more send_text examples 2022-04-17 22:48:03 +05:30
Kovid Goyal
31fda568e4 typeset -U both path and PATH 2022-04-17 21:27:08 +05:30
Kovid Goyal
3efbccc850 ... 2022-04-17 20:56:24 +05:30
Kovid Goyal
93c23f99cb conda activate now works under fish so use it 2022-04-17 20:55:53 +05:30
Kovid Goyal
6590d0690e Document venv and sourcing behavior of clone-in-kitty 2022-04-17 19:51:27 +05:30
Kovid Goyal
230a9f4678 Implement option to control clone sourcing strategies 2022-04-17 19:39:32 +05:30
Kovid Goyal
f2189b3e70 only pass VIRTUAL_ENV if it is currently active 2022-04-17 15:43:57 +05:30
Kovid Goyal
0ee5712e00 Start work on option to control sourcing strategies 2022-04-17 15:30:57 +05:30
Kovid Goyal
f9cad2c4ea Add a note about show__key limitations 2022-04-17 08:45:27 +05:30
Kovid Goyal
4372cf2893 ... 2022-04-17 08:43:23 +05:30
Kovid Goyal
34c18bacd8 Free up memory used to store copy of child env block 2022-04-17 08:35:55 +05:30
Kovid Goyal
3af11e92d6 Ensure the clone launch env var is not set accidentally 2022-04-17 08:29:47 +05:30
Kovid Goyal
74d5f2c259 Dont allow inappropriate types for cloning 2022-04-17 08:19:01 +05:30
Kovid Goyal
291f9e9a5e Make cloning safer
Now env vars are set after shell rc files are sourced. And the clone
request cannot specify the cmdline to execute.
2022-04-17 07:49:58 +05:30
Kovid Goyal
38e1d32065 Actually implement allow_cloning 2022-04-16 22:40:05 +05:30
Kovid Goyal
b45fedd794 Infrastructure for serializing env blocks 2022-04-16 22:16:20 +05:30
Kovid Goyal
df9b13fb74 Ask for confirmation before doing a clone by default 2022-04-16 20:04:26 +05:30
Kovid Goyal
53788c4c89 Get conda working with fish 2022-04-16 15:16:53 +05:30
Kovid Goyal
831043b773 Implement venv detection for fish 2022-04-16 14:45:02 +05:30
Kovid Goyal
1daf745d74 Add explicit support for python and conda venvs to clone-in-kitty
Still needs to be implemented for fish
2022-04-16 13:15:10 +05:30
Kovid Goyal
d6c5b40ead ... 2022-04-16 09:26:53 +05:30
Kovid Goyal
57ea524464 Merge branch 'clone-in-kitty' of https://github.com/page-down/kitty 2022-04-15 20:27:36 +05:30
pagedown
e19ce6cce6 clone-in-kitty: Skip some user-related environment variables 2022-04-15 22:47:57 +08:00
Kovid Goyal
8d4f6681e8 Merge branch 'clone-in-kitty' of https://github.com/page-down/kitty 2022-04-15 19:49:33 +05:30
pagedown
9c855a8377 Skip environment variables such as SSH_TTY when using clone-in-kitty 2022-04-15 19:43:40 +08:00
Kovid Goyal
716813e38a Proper fix for macOS argv[0] 2022-04-15 15:23:45 +05:30
Kovid Goyal
e5322cdc52 Fix clone-in-kitty --env not working over ssh 2022-04-15 15:20:38 +05:30
Kovid Goyal
b5701691c6 Dont clone prompt related env variables
These really shouldnt be exported but people often do
2022-04-15 15:18:43 +05:30
Kovid Goyal
aab9482e31 ... 2022-04-15 15:01:13 +05:30
Kovid Goyal
775584b5a5 Use literal quoting for env vars sent over ssh by clone 2022-04-15 14:34:21 +05:30
Kovid Goyal
25f022cc14 Ensure copy_env is False 2022-04-15 14:04:52 +05:30
Kovid Goyal
981ad88309 Allow nuking expandvars globally 2022-04-15 13:58:01 +05:30
Kovid Goyal
e71b9091a3 Dont rely on env -0 for bash either 2022-04-15 13:33:32 +05:30
Kovid Goyal
bde468594e ssh kitten: handle newlines in env vars 2022-04-15 12:49:35 +05:30
Kovid Goyal
0fcfe104e3 Handle argv[0] being buggered on macOS 2022-04-15 12:25:05 +05:30
Kovid Goyal
4cf54d2dfb Dont rely on env -0 in zsh
zsh outputs env vars in a nice one per line format using $'' encoding.
So exploit it
2022-04-15 12:17:59 +05:30
Kovid Goyal
b866c3e783 Add a zsh test for clone env serialization 2022-04-15 12:04:50 +05:30
Kovid Goyal
c15a31e725 Ensure colors are copied form the correct window when cloning
Also, encapsulate clone command into its own class to ease testing
2022-04-15 11:53:28 +05:30
Kovid Goyal
afaf866b15 Merge branch 'ksi-fish-clone-in-kitty' of https://github.com/page-down/kitty 2022-04-14 19:47:41 +05:30
pagedown
af6b1837cb Minor refactoring for fish clone-in-kitty and allow use without env -0
The builtin option from the latest version of fish is not used for now.
clone-in-kitty has been tested with fish 3.2.x.
BusyBox env does not support the -0 option.
2022-04-14 21:32:28 +08:00
Kovid Goyal
aab6f3e450 ... 2022-04-14 17:28:41 +05:30
Kovid Goyal
829ed0ec0d Fix #4964 2022-04-14 17:20:30 +05:30
Kovid Goyal
d9899cb489 Add missing item to changelog 2022-04-14 15:04:48 +05:30
Kovid Goyal
1a370ea9b6 Put the examples front and center 2022-04-14 07:59:32 +05:30
Kovid Goyal
cc07b1f79d Use 2048 chunk size in fish as well 2022-04-13 22:50:24 +05:30
Kovid Goyal
3ddea42660 ... 2022-04-13 22:45:36 +05:30
Kovid Goyal
236dbd95c9 ... 2022-04-13 22:34:23 +05:30
Kovid Goyal
6b078c4267 Implement clone-in-kitty for the fish shell 2022-04-13 22:33:21 +05:30
Kovid Goyal
1dec5f2e08 Help message for clone-in-kitty 2022-04-13 21:38:33 +05:30
Kovid Goyal
e5f70b7306 ... 2022-04-13 21:22:27 +05:30
Kovid Goyal
e2bb856e41 Document clone-in-kitty 2022-04-13 21:01:45 +05:30
Kovid Goyal
88d597f6b2 Dont define clone-in-kitty in POSIX mode
POSIX mode doesnt allow - in identifiers
2022-04-13 20:55:00 +05:30
Kovid Goyal
d0c0b01724 Get clone-in-kitty working for bash as well 2022-04-13 20:38:04 +05:30
Kovid Goyal
4b7c50518e Fix usage of chunk_num 2022-04-13 20:16:51 +05:30
Kovid Goyal
a1bfcd9fc5 Also transfer env vars when cloning over ssh kitten 2022-04-13 20:08:06 +05:30
Kovid Goyal
eb024fa40a ... 2022-04-13 15:51:00 +05:30
Kovid Goyal
122475ad4d Work on getting cloning working with the SSH kitten
Still need to do environment passing
2022-04-13 15:41:42 +05:30
Kovid Goyal
f7114bc1c5 ... 2022-04-13 15:35:06 +05:30
Kovid Goyal
feea6998f8 Allow using the cwd of the oldest as well as the newest foreground process for launch --cwd 2022-04-13 15:31:17 +05:30
Kovid Goyal
e187110611 Use $PWD instead of pwd -P as we want the exact same cwd not the resolved one when cloning 2022-04-13 15:13:58 +05:30
Kovid Goyal
c19e69855a Start work on a command to clone the current working env into a new kitty window 2022-04-13 15:02:22 +05:30
Kovid Goyal
7788f48dd5 Ensure IFS is correct when iterating over KITTY_SHELL_INTEGRATION 2022-04-12 23:03:05 +05:30
Kovid Goyal
073eecb6bb Also package kitty.termcap 2022-04-12 22:43:22 +05:30
Kovid Goyal
030e7e2db3 termcap should be generated in generate not compile 2022-04-12 22:41:19 +05:30
Kovid Goyal
aead3c1c35 Also generate a termcap database entry when building terminfo 2022-04-12 22:38:52 +05:30
Kovid Goyal
587f44ad4e A working implementation of cwd_of_process for FreeBSD 2022-04-12 22:06:46 +05:30
Kovid Goyal
c9ef4aa8c8 Sessions: Fix os_window_size and os_window_class not applying to the first OS Window
Fixes #4957
2022-04-12 21:38:29 +05:30
Kovid Goyal
aabadd8517 ... 2022-04-12 21:19:28 +05:30
Kovid Goyal
b8866371a3 avoid unneccessary session creation during startup 2022-04-12 21:18:18 +05:30
Kovid Goyal
0f3883af02 ... 2022-04-12 21:13:56 +05:30
Kovid Goyal
5876ce0845 Remove --target-group in favor of the new boolean search expressions with matching on window/tab state 2022-04-12 20:41:17 +05:30
Kovid Goyal
2c72c56e22 Add a couple more states to match against
So we can now select windows/tabs that are not active/focused but are in
the active/focused tab/os window.
2022-04-12 20:35:31 +05:30
Kovid Goyal
f15ce21da1 Markup the --match options help text a bit more 2022-04-12 20:20:29 +05:30
Kovid Goyal
b3fa7310cb Allow matching on window/tab state 2022-04-12 20:14:01 +05:30
Kovid Goyal
ade38870a0 Allow using boolean operators when matching windows or tabs 2022-04-12 19:55:20 +05:30
Kovid Goyal
11bc1b100c Handle <> inside :ref: on the CLI 2022-04-12 19:48:09 +05:30
Kovid Goyal
93a7b220c9 Fix parsing of quoted words 2022-04-12 19:31:56 +05:30
Kovid Goyal
8f92c594f2 Create a search query parser 2022-04-12 19:26:25 +05:30
Kovid Goyal
afebea8635 --tab-title=current should respect any override title set on the tab 2022-04-12 12:53:59 +05:30
Kovid Goyal
5d76cfb578 Remove output start mark from last command output 2022-04-12 08:55:07 +05:30
Kovid Goyal
f085f853bd unactive -> inactive 2022-04-12 06:35:29 +05:30
Kovid Goyal
4ac2312b2a Fix #4954 2022-04-12 06:33:35 +05:30
Kovid Goyal
c6dcbe6521 Dont check if running in kitty when updating
I dont actually know if it causes any problems and its fairly
inconvenient to use another terminal.
2022-04-11 22:07:36 +05:30
Kovid Goyal
49efbf0c6e Remove the code to generate installer.sh from installer.py 2022-04-11 21:35:59 +05:30
Kovid Goyal
1d8d669a43 version 0.25.0 2022-04-11 19:31:45 +05:30
Kovid Goyal
f4d44f30b4 Allow copying current window/tab/os window titles when creating new ones via the launch command. Fixes #4933 2022-04-11 15:38:33 +05:30
Kovid Goyal
4c77b0c562 Fix #4947 2022-04-11 15:00:27 +05:30
Kovid Goyal
2f367fa90c Note that wayst also has graphics protocol support 2022-04-10 07:38:55 +05:30
Kovid Goyal
970ec9c839 Merge branch 'feat-close-other-tabs' of https://github.com/page-down/kitty 2022-04-10 07:17:31 +05:30
pagedown
be52f29792 ... 2022-04-09 18:27:32 +08:00
pagedown
8ae2f06828 Add a new mappable action close_other_tabs_in_os_window 2022-04-09 18:26:31 +08:00
Kovid Goyal
601b2a05ac Add instructions for how to do debug builds 2022-04-09 08:07:29 +05:30
Kovid Goyal
b78fbb4521 Fix #4938 2022-04-08 15:44:33 +05:30
Kovid Goyal
c40ef01445 Fix resizing window that is extra tall/wide because of left-over cells not working reliably
Fixes #4913
2022-04-08 15:41:53 +05:30
Kovid Goyal
ab8a4c6b9f Make per cell bias calculation overridable more easily 2022-04-08 14:52:53 +05:30
Kovid Goyal
dd331ca12e ssh kitten: Allow changing terminal colors when connecting 2022-04-08 12:10:59 +05:30
Kovid Goyal
c3b23679f3 Make some themes code re-useable 2022-04-08 11:33:50 +05:30
Kovid Goyal
d0398dca28 Bash shell integration: Fix yet another inconsistent use of SYS_BASHRC
Why Linux distros are constitutionally incapable of using consistent
names and values for anything is beyond me.

Fixes #4934
Fixes #4935
2022-04-07 17:54:52 +05:30
Kovid Goyal
e66c732b41 Forgot to adjust test for new mouse encoding 2022-04-07 17:23:23 +05:30
Kovid Goyal
e7b216ba68 DRYer 2022-04-07 16:24:57 +05:30
Kovid Goyal
838a85ee8b Fix drag event reporting not specifying the current button.
xterm does this, so in the absence of a spec we copy xterm. Fixes #4925
2022-04-07 16:22:26 +05:30
Kovid Goyal
3ec93e0b4e Fix #4932 2022-04-07 15:29:15 +05:30
Kovid Goyal
e8a9bbb51d Merge branch 'fix-inactive-text-alpha' of https://github.com/page-down/kitty
Fixes #4928
2022-04-07 15:16:26 +05:30
pagedown
25c2a0e241 Update cursor focus flag when preparing to render OS window
Fix inactive text alpha always being applied when starting a program
with cursor hidden via session.
2022-04-07 11:48:53 +08:00
Kovid Goyal
de12dddbef Better error message when ripgrep is not found 2022-04-06 16:38:18 +05:30
Kovid Goyal
24eeeedb1f ... 2022-04-05 16:08:24 +05:30
Kovid Goyal
c2bc24de35 Read appearance setting from desktop portal as well 2022-04-05 15:44:27 +05:30
Kovid Goyal
21446e36c1 Restore invalid LANG after trying to get python to set the locale without it 2022-04-04 20:01:01 +05:30
Kovid Goyal
0f734719e7 ... 2022-04-04 19:09:13 +05:30
Kovid Goyal
f3c96f308d Only do update checking in binary builds
Distro packages and source builds will no longer do update checking.
Remove the packaging defaults instructions since they are not needed
any more. The shell integration scripts shouldnt be installed system
wide anyway.
2022-04-04 16:02:38 +05:30
Kovid Goyal
8ff841f1ac ... 2022-04-04 15:34:07 +05:30
Kovid Goyal
709c4abb53 Do not do automatic upgrades of remote kitty
Can be disruptive, since upgrading outputs to the terminal.
Instead updating can be triggerred manually with kitty update-kitty
2022-04-04 14:51:49 +05:30
Kovid Goyal
c1f06941f5 Do not depend on python to install kitty
Now the installer is implemented as pure POSIX sh. This makes it
possible to install kitty on systems without python, easily.
2022-04-04 13:42:20 +05:30
Kovid Goyal
ecb74aed29 ... 2022-04-04 11:05:36 +05:30
Kovid Goyal
c72154782b Simplify getting released kitty version
Also if fetching release version fails and local version exists, use it
2022-04-04 10:22:25 +05:30
Kovid Goyal
9520006466 Dont use alternate screen as it is too disruptive 2022-04-04 07:53:48 +05:30
Kovid Goyal
40f04284d4 Update the text to reflect current support status 2022-04-04 07:51:22 +05:30
Kovid Goyal
832534aac9 Show installation output in alternate screen 2022-04-03 22:13:02 +05:30
Kovid Goyal
6cc89416ce Implement locking for the kitty bootstrap install 2022-04-03 21:53:23 +05:30
Kovid Goyal
b3fc2cb118 Avoid executing kitty just to read installed kitty version 2022-04-03 20:47:02 +05:30
Kovid Goyal
69efd9801b Add a mention of on-demand kitty in the features list 2022-04-03 20:35:48 +05:30
Kovid Goyal
c07f164154 Implement an option to control the installation of the kitty bootstrap script 2022-04-03 20:30:16 +05:30
Kovid Goyal
a2d1140229 Forgot to run gen-config.py after changing default for confirm_os_window_close 2022-04-03 19:57:54 +05:30
Kovid Goyal
bae9b095b4 Start work on kitty launcher for remote servers
This will automatically download kitty and run it. The ssh kitten
can add it to PATH thereby making kitty available on the remote machine
at low cost.
2022-04-03 15:10:20 +05:30
Kovid Goyal
efe6ff6188 Try to ensure builtin command is used 2022-04-03 12:16:13 +05:30
Kovid Goyal
3257fdf24f Merge branch 'master-macos_option_as_alt_docs' of https://github.com/miguno/kitty 2022-04-01 18:27:14 +05:30
Michael G. Noll
3284d71300 Clarify documentation of macos_option_as_alt
See discussion at https://github.com/kovidgoyal/kitty/issues/4908
2022-04-01 14:52:12 +02:00
Kovid Goyal
cdb3e2c1cd Added a version added note for the ssh kitten 2022-04-01 14:23:31 +05:30
Kovid Goyal
57cffc71b7 Fix building on macOS with a non-framework Python
Fixes #289
2022-04-01 07:39:54 +05:30
Kovid Goyal
a4f1caeb4e Missed a couple of actions invocations 2022-04-01 07:31:10 +05:30
Kovid Goyal
45de091ee6 Use versioned actions as master for setup-python is currently broken 2022-04-01 07:19:41 +05:30
Kovid Goyal
00c1802319 Change the default for confirm_os_window_close
Now that the new ssh kitten makes shell integration easy even on remote
servers, it makes sense to change the default behavior to ask for
confirmation when closing windows not at a shell prompt.
2022-03-31 20:33:58 +05:30
Kovid Goyal
02c2d24360 Merge branch 'feat-vis-sel-chars' of https://github.com/page-down/kitty 2022-03-31 15:15:00 +05:30
pagedown
499c255e81 Use the configured chars when visually selecting windows on stack layout
Also list the current active window in the candidates and gray it out to
make sure the order is consistent.
2022-03-31 17:32:10 +08:00
Kovid Goyal
30cad2e0a6 select_tab: Use stable numbers when selecting the tab
Fixes #4792
2022-03-31 13:16:08 +05:30
Kovid Goyal
6e838b83d8 Add a note about how to use a new target tab to --target-tab docs 2022-03-31 12:52:08 +05:30
Kovid Goyal
5297223ee3 Dont use a blank line for empty subtitle 2022-03-31 12:43:28 +05:30
Kovid Goyal
2340d5be8d Merge branch 'ksi-fish' of https://github.com/page-down/kitty 2022-03-30 18:51:16 +05:30
Kovid Goyal
7de1a145aa Merge branch 'docs' of https://github.com/page-down/kitty 2022-03-30 18:44:41 +05:30
pagedown
32426d61c3 Shell integration: Mark fish prompt on cancel or syntax error
The fish_prompt event will not be fired, even if a new prompt has been
drawn.
2022-03-30 20:49:48 +08:00
pagedown
3ce47660a0 Docs: Add instructions for compiling terminfo under macOS 2022-03-30 20:12:18 +08:00
Kovid Goyal
0dff455ffa declare oldval local 2022-03-30 11:57:46 +05:30
Kovid Goyal
81739288e8 handle multiple trailing spaces and semi-colons 2022-03-30 11:54:06 +05:30
Kovid Goyal
5641668bc1 Bash integration: Handle existing PROMPT_COMMAND ending with a literal newline 2022-03-30 10:44:59 +05:30
Kovid Goyal
5c03a52a0b ... 2022-03-29 15:34:34 +05:30
Kovid Goyal
087b52e3e0 Merge branch 'feat-scroll-prompt-to-top' of https://github.com/page-down/kitty 2022-03-29 15:00:46 +05:30
pagedown
733b8e7c1c Update changelog 2022-03-29 17:01:41 +08:00
pagedown
aa83f42f2d Avoid using already defined shortcuts in examples 2022-03-29 16:45:02 +08:00
pagedown
4ed2854791 Add a new standalone action scroll_prompt_to_top
Refactor clear_terminal to move the functions to Window.
Fix the action not scrolling to the bottom when the screen is scrolled.
2022-03-29 16:42:29 +08:00
Kovid Goyal
73cdd87d91 Fix completion for kitty +open 2022-03-29 13:04:55 +05:30
Kovid Goyal
51c8e3b2c6 Add some more debug about scale changes 2022-03-29 09:47:48 +05:30
Kovid Goyal
e522095fae ... 2022-03-26 07:39:16 +05:30
Kovid Goyal
6fc1226028 Merge branch 'fix-overlay-ready' of https://github.com/page-down/kitty 2022-03-26 07:38:01 +05:30
Kovid Goyal
fb40280d3c Use x-shellscript in addition to x-sh
/etc/mime.types uses x-sh and file --mime-type uses x-shellscript. Sigh.
Fixes #4881
2022-03-26 07:35:42 +05:30
pagedown
746cb3684a Eliminate flickering when hints kitten exits 2022-03-25 22:53:38 +08:00
pagedown
16c6545e93 Report overlay ready in case of no match 2022-03-25 22:52:35 +08:00
Kovid Goyal
0c4b20aa4e typo 2022-03-25 16:30:48 +05:30
Kovid Goyal
15e3e8d8b1 typo 2022-03-25 16:18:00 +05:30
Kovid Goyal
6123de52c2 Merge branch 'fix-macos-drop-files' of https://github.com/page-down/kitty 2022-03-25 07:29:07 +05:30
pagedown
3db0aab24b macOS: Fix the path encoding issue from drag and drop files 2022-03-25 09:14:56 +08:00
Kovid Goyal
ae77f696ce Merge branch 'ssh-kitten' of https://github.com/page-down/kitty 2022-03-24 20:14:22 +05:30
pagedown
98369db7f5 Unset shell integration env var before exec command 2022-03-24 22:01:11 +08:00
pagedown
bc9d6892d4 Clean up login shell environment variable earlier
Does not pollute the environment when executing commands.
2022-03-24 22:00:51 +08:00
pagedown
5c02c370d4 ssh kitten: Allow to configure HOME environment variable
Useful if the user does not have a home directory or the directory is
not writable.
2022-03-24 22:00:41 +08:00
pagedown
b944cdddeb ssh kitten: Fix python bootstrap checking zsh rc files with ZDOTDIR 2022-03-24 22:00:16 +08:00
Kovid Goyal
a1d203d34a Clean up paste_actions docs 2022-03-24 17:35:07 +05:30
Kovid Goyal
e151b8e604 Make detection of pasted URLs a little stricter 2022-03-24 17:30:47 +05:30
Kovid Goyal
3c67e991c2 Allow defining actions to take when pasting
Fixes #4873
2022-03-24 17:22:46 +05:30
Kovid Goyal
cb7aed3234 DRYer 2022-03-24 11:54:13 +05:30
Kovid Goyal
ff80b906d0 Report full traceback when highlighting fails 2022-03-24 11:39:31 +05:30
Kovid Goyal
8300436481 Make setting kitten_result more robust 2022-03-24 11:34:12 +05:30
Kovid Goyal
6b13454091 ... 2022-03-24 09:50:50 +05:30
Kovid Goyal
9eae4ad913 ... 2022-03-24 09:37:13 +05:30
Kovid Goyal
bfb8532c52 Jump through the hoops needed to ensure error reporting is done in case of early termination of kittens that use overlay ready notifications 2022-03-24 08:49:36 +05:30
Kovid Goyal
c41405fd57 Merge branch 'ssh-kitten' of https://github.com/page-down/kitty 2022-03-23 18:19:12 +05:30
pagedown
276ba7754a Add ssh kitten URL test 2022-03-23 20:08:50 +08:00
pagedown
8569be81ea ... 2022-03-23 19:49:34 +08:00
pagedown
a765d551e4 Fix bash integration cwd reporting missing hostname 2022-03-23 19:29:18 +08:00
pagedown
4309aa1ace ssh kitten: Fix SSH URL hostname matching 2022-03-23 18:39:27 +08:00
Kovid Goyal
6ef83a09d3 Avoid clearing the screen when exiting a kitten as its not needed any more 2022-03-23 16:06:38 +05:30
Kovid Goyal
adcc616c92 ... 2022-03-23 16:04:01 +05:30
Kovid Goyal
6dc1617429 Avoid flicker when starting kittens such as the hints kitten
Fixes #4674
2022-03-23 15:55:11 +05:30
Kovid Goyal
1837168b0b Micro optimization 2022-03-23 14:51:22 +05:30
Kovid Goyal
1be1864657 Allow sending more than a screenful of output from a kitten
Also Fixes #4866
2022-03-23 14:33:53 +05:30
Kovid Goyal
49c335972f Update padding color on colorprofile pop 2022-03-23 08:35:36 +05:30
Kovid Goyal
aabc99c7bf ... 2022-03-22 21:12:35 +05:30
Kovid Goyal
7c91dc6183 Merge branch 'docs' of https://github.com/page-down/kitty 2022-03-22 21:07:05 +05:30
pagedown
ff8a99211d Docs: Unify and generalize the terms remote computer, machine and host 2022-03-22 23:26:15 +08:00
pagedown
efda0ea455 Docs: Categorize the ssh kitten configuration options and minor tweaks 2022-03-22 23:25:59 +08:00
Kovid Goyal
906be21b8d Make GNOME detection a bit more tolerant 2022-03-22 11:36:09 +05:30
Kovid Goyal
5a36fbfe7b Only move overlay line/pre-edit position when cursor is visible
This might help with #4849
2022-03-22 10:35:55 +05:30
Kovid Goyal
f9f69a0577 ... 2022-03-22 10:28:41 +05:30
Kovid Goyal
8ccbb96b8d Update changelog for last PR
Fixes #4853
2022-03-22 08:22:15 +05:30
Kovid Goyal
8ae7256fd6 Merge branch 'fix-ime' of https://github.com/page-down/kitty 2022-03-22 08:21:31 +05:30
Kovid Goyal
ba401c19c2 Pass mode when opening existing shm buffer 2022-03-21 16:12:26 +05:30
pagedown
11343d42c3 Wayland: Fix backspace cannot clear the last character of pre-edit text 2022-03-21 18:36:35 +08:00
pagedown
6c628bc594 Wayland: Fix IME is not enabled after switching the focus 2022-03-21 18:36:25 +08:00
Kovid Goyal
f6cbca1aeb ... 2022-03-20 14:50:04 +05:30
Kovid Goyal
51e7c8c136 Move the splitting code into python
Less code and more robust
2022-03-20 14:40:02 +05:30
Kovid Goyal
f952694ffd Merge branch 'macos-multi-dirs-here' of https://github.com/page-down/kitty 2022-03-20 14:12:08 +05:30
pagedown
59afdfc4e9 macOS: Allow the New kitty Here services to open multiple folders 2022-03-20 14:51:47 +08:00
Kovid Goyal
27ec1e4b3c Clean up logic for getting CWD 2022-03-18 12:25:01 +05:30
Kovid Goyal
e791a8a7bb Add the SSH kitten to the Changelog 2022-03-18 10:45:16 +05:30
Kovid Goyal
66fe53ceb1 Merge branch 'docs' of https://github.com/page-down/kitty 2022-03-18 09:36:36 +05:30
Kovid Goyal
de3cc11423 Merge branch 'version-check' of https://github.com/page-down/kitty 2022-03-18 09:35:49 +05:30
pagedown
901eae9604 Docs: no-cwd will not disable fish's built-in CWD reporting 2022-03-18 11:10:21 +08:00
pagedown
1962519666 Only write to the OpenSSH version sentinel file once 2022-03-17 22:23:48 +08:00
pagedown
1e84cbe2ab Check macOS less version 2022-03-17 22:23:37 +08:00
Kovid Goyal
06da2b88ff Also check if states are empty 2022-03-17 17:51:21 +05:30
Kovid Goyal
91b9110dcc Workaround for bug in mutter that caused first OS window to not have functional CSD when launched from activities
Fixes #4802
2022-03-17 17:35:56 +05:30
Kovid Goyal
d57abb56ce Dont use remote cwd as child cwd 2022-03-17 16:42:11 +05:30
Kovid Goyal
f6edb774fc Merge branch 'ssh-cwd' of https://github.com/page-down/kitty 2022-03-17 15:34:11 +05:30
pagedown
ec0f3e9128 Allow *_with_cwd to work with ssh kitten when the shell is configured 2022-03-17 16:40:55 +08:00
Kovid Goyal
6f1404d17b typo 2022-03-17 10:59:41 +05:30
Kovid Goyal
3d9e47c295 typo 2022-03-17 10:52:09 +05:30
Kovid Goyal
afa6128155 Implement --cwd=last_reported 2022-03-17 10:29:31 +05:30
Kovid Goyal
72b1996423 Allow different kinds of cwd requests 2022-03-17 10:24:34 +05:30
Kovid Goyal
6b1a9d635e ... 2022-03-17 09:33:12 +05:30
Kovid Goyal
dea79f16d0 Update the how it works section 2022-03-17 09:31:03 +05:30
Kovid Goyal
2d772d7243 ... 2022-03-16 21:42:37 +05:30
Kovid Goyal
09fb246c8f ... 2022-03-16 21:30:16 +05:30
Kovid Goyal
0a5c16363c Fix continued lines not having their continued status reset on line feed
Fixes #4837
2022-03-16 15:20:25 +05:30
Kovid Goyal
b444f4636e Move another function into bootstrap-utils.sh 2022-03-16 07:37:56 +05:30
Kovid Goyal
2b8acebd6e Make bootstrap.sh even smaller 2022-03-16 07:31:33 +05:30
Kovid Goyal
766010c292 ... 2022-03-16 07:27:52 +05:30
Kovid Goyal
0a2768e496 Split up the bootstrap script to keep its size down 2022-03-16 07:17:12 +05:30
Kovid Goyal
0fd7f3f7b5 Merge branch 'ksi' of https://github.com/page-down/kitty 2022-03-16 07:02:18 +05:30
pagedown
d3472966d3 Fix generating terminfo on NetBSD 2022-03-16 09:15:31 +08:00
pagedown
576ab24609 Preserve line breaks to keep the line numbers in error messages 2022-03-16 08:58:50 +08:00
pagedown
621453b068 ... 2022-03-16 01:33:23 +08:00
pagedown
6638546247 Fix generating terminfo on NetBSD
.terminfo.cdb is the compiled terminfo database file.
Ensure that both .terminfo (dir) and .terminfo.cdb are generated.
2022-03-16 01:04:26 +08:00
pagedown
f99edbae3c Reduce bootstrap script size 2022-03-16 01:04:02 +08:00
pagedown
150bf1a5b0 Reduce bootstrap script length by removing comments and indents
dropbear has 9000 bytes limit on ssh arguments length.
2022-03-16 01:03:51 +08:00
pagedown
91a17e3f0c Fall back to use POSIX SHELL environment variable 2022-03-16 01:03:33 +08:00
pagedown
7160027c14 Use the fish built-in function name to report current working directory
If the feature is enabled by fish in the future, it will override the
built-in one and there will be no duplicate reporting.
2022-03-16 01:03:26 +08:00
pagedown
736d6cf7e6 Simplify fish prompt state checking 2022-03-16 01:03:16 +08:00
Kovid Goyal
82de6a1c56 DRYer 2022-03-15 22:12:49 +05:30
Kovid Goyal
1fbb4f763e Only check OpenSSH version once on a machine if it is new enough 2022-03-15 22:09:40 +05:30
Kovid Goyal
20582431d6 typo 2022-03-15 21:50:55 +05:30
Kovid Goyal
7d9cf0b064 When at shell prompt use reported cwd 2022-03-15 21:16:49 +05:30
Kovid Goyal
a834f221f1 Unquote paths from file:// URLs
The original iTerm spec for this says the urls are supposed to be
percent escaped
2022-03-15 21:07:36 +05:30
Kovid Goyal
c95dca4023 See if we can make the test more robust 2022-03-15 20:38:02 +05:30
Kovid Goyal
c05c0353fd Dont report directory changes during command substitution 2022-03-15 20:34:18 +05:30
Kovid Goyal
e944e2ecae Make a note that cwd reporting is builtin to fish 2022-03-15 20:33:14 +05:30
Kovid Goyal
47b3c37bf0 Add cwd reporting to fish integration 2022-03-15 20:25:39 +05:30
Kovid Goyal
190666dc8a Check that non-ascii paths work in cwd reporting 2022-03-15 20:16:09 +05:30
Kovid Goyal
8c6e7ce61a ... 2022-03-15 20:11:27 +05:30
Kovid Goyal
04ead526b9 Presend data on slave connections since for these SSH does not use the TTY 2022-03-15 20:09:05 +05:30
Kovid Goyal
135fb7e6e4 ... 2022-03-15 20:01:23 +05:30
Kovid Goyal
ce1e22ac95 Have *_with_cwd work with the ssh kitten to open new windows auto-logged into the remote server at the current remote working directory 2022-03-15 19:59:16 +05:30
Kovid Goyal
a216f6bd46 ssh doesnt use askpass even if DISPLAY is set
It only uses askpass if not connected to a terminal
2022-03-15 17:27:57 +05:30
Kovid Goyal
c47e5372b5 native askpass should be used when requested 2022-03-15 15:54:48 +05:30
Kovid Goyal
daa673eff1 Make usage of need_to_request_data clearer 2022-03-15 15:51:49 +05:30
Kovid Goyal
5099dd6aa3 Only use kitty's askpass if DISPLAY is set or OpenSSH is new enough to support SSH_ASKPASS_REQUIRE 2022-03-15 15:47:02 +05:30
Kovid Goyal
f982e754e4 Enable CWD reporting in bash integration 2022-03-15 15:37:17 +05:30
Kovid Goyal
4a1ad7755a Enable CWD reporting in the zsh integration 2022-03-15 14:30:21 +05:30
Kovid Goyal
946589d1f1 ... 2022-03-15 13:18:07 +05:30
Kovid Goyal
7168ceab94 Make askpass a choice var 2022-03-15 13:14:53 +05:30
Kovid Goyal
868d57b818 ... 2022-03-15 12:00:17 +05:30
Kovid Goyal
6057c57ea4 Fix garbage removal pafter SSH failure not working on macOS when run more than once 2022-03-15 11:57:28 +05:30
Kovid Goyal
e8437fd435 Make reading garbage more robust 2022-03-15 11:51:46 +05:30
Kovid Goyal
9e317971b4 Simplify garbage clear logic 2022-03-15 11:41:59 +05:30
Kovid Goyal
bdb55a02fa ... 2022-03-15 11:40:14 +05:30
Kovid Goyal
02e062af65 Add a mappable action to cleanup shared SSH connections 2022-03-15 11:34:56 +05:30
Kovid Goyal
54c5faa12d Simplify hostname matching
Now that we load the opts upfront, we can have load_config return the
final opts object itself
2022-03-15 11:25:21 +05:30
Kovid Goyal
9b0bd81661 Ignore hostname directives when using overrides 2022-03-15 10:38:03 +05:30
Kovid Goyal
52da68876d Use a zero mtime for data.sh
Its a temp file and that way no chance of the time being in the future
2022-03-15 10:30:15 +05:30
Kovid Goyal
2780630a18 Suppress STDERR for tar 2022-03-15 10:28:14 +05:30
Kovid Goyal
8f77cc65e2 Use a full window object rather than a child PID to get cwd
This allows implementation of more sophisticated algorithmhs
for getting the cwd
2022-03-15 07:58:57 +05:30
Kovid Goyal
7224363639 ... 2022-03-15 07:27:25 +05:30
Kovid Goyal
43851fc1c4 Ignore OSC 6 2022-03-14 22:04:38 +05:30
Kovid Goyal
e33bf11012 Store last reported CWD via OSC 7
Can be used with shell integration to give more accurate
cwd detection and also combined with the ssh kitten
to magically open new windows connected to remote servers
at the correct cwd on the remote server instantly.
2022-03-14 22:00:41 +05:30
Kovid Goyal
0e21376538 Update changelog
Fixes #4831
2022-03-14 20:20:33 +05:30
Kovid Goyal
7a463c1240 Merge branch 'fix-diff-kitten' of https://github.com/page-down/kitty 2022-03-14 20:01:36 +05:30
pagedown
8e03da855f diff kitten: Fix wrong number of scrolling lines after context switch 2022-03-14 20:29:15 +08:00
Kovid Goyal
942881d1b7 Add a ntoe about the importance of askpass 2022-03-14 16:44:12 +05:30
Kovid Goyal
2a50203fcd ... 2022-03-14 13:44:18 +05:30
Kovid Goyal
08ce8ffa54 py2 compat 2022-03-14 12:36:43 +05:30
Kovid Goyal
90561682cf Make using kitty askpass optional 2022-03-14 11:38:31 +05:30
Kovid Goyal
71027e74e0 py2 compat 2022-03-14 11:28:46 +05:30
Kovid Goyal
be8bfbe370 Refactor launch sequence in preparation for optionising it 2022-03-14 10:40:07 +05:30
Kovid Goyal
f7e4447b66 Dont transmit sensitive data unless actually needed 2022-03-13 15:43:14 +05:30
Kovid Goyal
df4e58bc39 Improve disposal of garbage data on ssh failure 2022-03-13 15:37:46 +05:30
Kovid Goyal
441ea7d696 askpass.py should be executable 2022-03-13 14:49:36 +05:30
Kovid Goyal
2b06ca5e1a ssh kitten: Send data without a roundtrip
Send data to the remote side without waiting for a data request. Avoids
an extra roundtrip during initialization.
2022-03-13 13:55:30 +05:30
Kovid Goyal
434ef97952 Dont need atexit anymore since cleanup only closes tty_fd 2022-03-13 13:55:30 +05:30
Kovid Goyal
e1504c4775 Avoid needing to initialize tty state in bootstrap scripts 2022-03-13 13:55:30 +05:30
Kovid Goyal
74f0057ec8 Dont change tty state to raw
Just turn off echo. Makes the code much simpler, can just use shell
builtin POSIX read function.
2022-03-13 13:55:30 +05:30
Kovid Goyal
7cd74cb852 Allow writing memoryview to child 2022-03-13 13:55:30 +05:30
Kovid Goyal
b2e74e4830 Switch to using the hostname from the CLI for settings
This removes the need to wait for data from the remote machine
before sending data to it.
2022-03-13 13:55:30 +05:30
Kovid Goyal
f54a3e8036 Make requesting data optional 2022-03-13 13:55:30 +05:30
Kovid Goyal
f3088c5646 Only try to chmod runtime dir if actually needed 2022-03-13 13:45:03 +05:30
Kovid Goyal
db00adaf69 macOS: Use the POSIX user cache dir as the runtime dir
It's path length is 49 chars which is still too long, but it is at least
well defined.
2022-03-13 06:27:41 +05:30
Kovid Goyal
ea74add814 ssh kitten: Restore terminal state after running ssh 2022-03-12 15:48:52 +05:30
Kovid Goyal
ba1b3c3c2d Fix mypy failures 2022-03-12 08:28:43 +05:30
Kovid Goyal
d5c48ddb94 Allow inputting fingerprint check 2022-03-12 08:23:10 +05:30
Kovid Goyal
9687318b22 Retry reading HEAD commit 2022-03-12 08:14:06 +05:30
Kovid Goyal
f6fb36c58a Merge branch 'fix-icat_typeerror_on_print_window_size' of https://github.com/nertro/kitty 2022-03-12 08:08:32 +05:30
Mena Jacobs
c8a258f36b Fix icat fail on mac with --print-window-size
passing tty as TextIOWrapper to screen_size_function results in a TypeError since the screen_size_function expects an int. calling fileno() on tty gives us the desired int. This also fixes the kitty matplotlib backend, if MPLBACEND_KITTY_SIZING is not set to manual
2022-03-12 02:17:01 +01:00
Kovid Goyal
14e0b01b40 Echo asterisks when inputting the password 2022-03-11 16:44:08 +05:30
Kovid Goyal
76de99a5a8 Use a custom askpass implementation
Keeps OpenSSH from using the tty hopefully allowing us to start sending
data without needing to wait for the remote side to request it.
2022-03-11 16:44:08 +05:30
Kovid Goyal
8613c6e1cd ... 2022-03-11 16:44:08 +05:30
Kovid Goyal
5bb6b29ca3 Allow controlling the prompt used to input the password 2022-03-11 16:44:08 +05:30
Kovid Goyal
61558d518e Get askpass basically working 2022-03-11 16:44:08 +05:30
Kovid Goyal
3b724c8415 Start work on SSH askpass implementation 2022-03-11 16:44:08 +05:30
Kovid Goyal
910565aa7c Mention the shell in the error message 2022-03-11 15:52:51 +05:30
Kovid Goyal
c7a2e060e3 Merge branch 'ksi-ssh' of https://github.com/page-down/kitty 2022-03-11 15:51:16 +05:30
pagedown
740e787f54 ... 2022-03-11 17:28:29 +08:00
pagedown
bd87d50948 Remove the ssh folder in cache_dir 2022-03-11 16:47:03 +08:00
pagedown
d3c0c422a5 Add user uid suffix to tmp runtime dir symlink 2022-03-11 15:42:52 +08:00
pagedown
72718cbab7 Remove login shell name suffix restriction
Some shells do not end with sh, consistent with the python bootstrap
implementation.
2022-03-11 15:42:45 +08:00
pagedown
ea28951e0e Fall back to run the shell without -l option 2022-03-11 15:42:34 +08:00
pagedown
39a78f6be3 Explicitly set STDOUT to binary mode 2022-03-11 15:42:23 +08:00
pagedown
fe8aaca320 Use POSIX LOGNAME environment variable 2022-03-11 15:42:09 +08:00
pagedown
f5cc58ea9d Unset the safe source function in sh script and minor refactoring 2022-03-11 15:41:56 +08:00
Kovid Goyal
44992452cf Fix #4815 2022-03-11 09:42:54 +05:30
Kovid Goyal
f080871911 Update the idiotic design symlink atomically 2022-03-11 07:54:16 +05:30
Kovid Goyal
6789eb88e2 Fix replacement of symlinks to directories 2022-03-11 07:51:50 +05:30
Kovid Goyal
1a97be4a25 Merge branch 'fix-pkg-terminfo' of https://github.com/page-down/kitty 2022-03-11 07:39:25 +05:30
Kovid Goyal
c9ef5c0715 Avoid a race in creating the idiotic_design symlink 2022-03-11 07:37:44 +05:30
pagedown
0a9f8d4f6a Add terminfo src file when packaging
ssh kitten needs to send this file.
2022-03-11 08:35:10 +08:00
Kovid Goyal
cac2c153c2 Fix #4809 2022-03-10 22:55:47 +05:30
Kovid Goyal
f2d6ba8775 Workaround for socket path too long on macOS 2022-03-10 22:50:26 +05:30
Kovid Goyal
92abaad22c Handle cross filesystem untarring in bootstrap.py 2022-03-10 22:43:54 +05:30
Kovid Goyal
3df0194f6e Use a well known runtime dir if XDG_RUNTIME_DIR not available 2022-03-10 22:18:35 +05:30
Kovid Goyal
f774841ee0 More robust copying of terminfo
Dont use symlinks in the tarball, instead create them
in the bootstrap scripts, only if needed.
2022-03-10 21:08:20 +05:30
Kovid Goyal
a9de91087a Add a comment explaining why we dont commit if resized 2022-03-10 20:47:45 +05:30
Kovid Goyal
76a536ece0 On macOS always use the cache dir a runtime dir
Also make the constant parts of the socket name shorter
as there is a 104 bytes limit on it in macOS SSH.
2022-03-10 20:12:40 +05:30
Kovid Goyal
719339e116 Output debug info about CSD rendering 2022-03-10 19:45:31 +05:30
Kovid Goyal
1c3910de5c Output debug info about resized being called 2022-03-10 19:32:17 +05:30
Kovid Goyal
39d3ef6fe8 Output debug for decoration configure when it happens 2022-03-10 17:59:54 +05:30
Kovid Goyal
064d0fa6f1 Merge branch 'wayland-fixes' of https://github.com/Nefsen402/kitty 2022-03-10 17:37:29 +05:30
Alexander Orzechowski
99a5843595 wayland: Don't commit the surface on a resize
This fixes weirdness with GNOME.

On a resize, we will schedule a new frame anyway which will commit
the wl_surface for us anyway. If we don't resize, we'll commit
to stay true to the wayland spec.
2022-03-10 06:02:22 -05:00
Alexander Orzechowski
39e75e39e8 wayland: Correctly handle xdg decoration configures
Much like toplevel configures, xdg decoration configures only take
effect once the xdg shell configure comes through. Also,
let's get rid of some double computations because we unified the code
paths.
2022-03-10 06:01:50 -05:00
Alexander Orzechowski
322a80e76e wayland: track configures through a bit field
This will let us add more stuff later. Also, it's a better spot
to put the bit field outside of the {current, pending} struct as
the bit field doesn't make any sense if it's part of the `current`
values.
2022-03-10 05:56:56 -05:00
Alexander Orzechowski
d4b048735d wayland: Fix CSD size calculations
This is a partial revert of e359094cff

window->wl.{width, height} and window->wl.current.{width, height}
represent different things. The former represents the actual size of the
egl surface viewport used for terminal rendering. The former represents
the size of the entire window including the CSD (client side decorations).

These numbers should be the same if CSD is disabled.
2022-03-10 05:56:56 -05:00
Kovid Goyal
c23e04fd03 DRYer 2022-03-10 15:37:10 +05:30
Kovid Goyal
f67009f554 Flush the write to shm explicitly 2022-03-10 15:01:58 +05:30
Kovid Goyal
4013544efb Cleanup control master sockets in parallel 2022-03-10 12:59:38 +05:30
Kovid Goyal
31d9db7e74 Use XDG_RUNTIME_DIR to store control master sockets
On Linux this has the advantage that the dir is auto cleaned on reboot
2022-03-10 12:51:21 +05:30
Kovid Goyal
384c56f834 When using control masters also enable keep alives
Prevents the master connection from becoming stale. Use ssh protocol
keep alives rather than tcp ones as tcp ones are often blocked by
firewalls and also spoofable.
2022-03-10 11:48:36 +05:30
Kovid Goyal
3282c8200d Dont print to stderr when shutting down master connections at exit 2022-03-10 11:22:46 +05:30
Kovid Goyal
ffbc9174f8 We dont change shell rc files anymore 2022-03-10 11:01:59 +05:30
Kovid Goyal
dceb00f669 typo 2022-03-10 11:00:58 +05:30
Kovid Goyal
920086ae88 unlink SHM file at end of each individual test 2022-03-10 10:57:36 +05:30
Kovid Goyal
a1311a2332 ... 2022-03-10 10:48:08 +05:30
Kovid Goyal
4c392426f6 Get shared memory based data transfer working 2022-03-10 10:46:04 +05:30
Kovid Goyal
4528173ff5 Max length for SHM names on Apple is 30!
Bloody CrApple
2022-03-10 07:37:57 +05:30
Kovid Goyal
d3b63a9c45 Cleanup attribute access 2022-03-10 07:30:05 +05:30
Kovid Goyal
c30a249cf6 Use longer random names for SHM to make double unlink safe 2022-03-10 07:24:39 +05:30
Kovid Goyal
20962d989f Use POSIX shm to pass ssh data to kitty 2022-03-10 06:55:21 +05:30
Kovid Goyal
a1e4b19486 ... 2022-03-10 06:34:50 +05:30
Kovid Goyal
fd0262413e Access to POSIX shared memory from Python 2022-03-10 06:30:03 +05:30
Kovid Goyal
aa4d36cc57 Use secrets to generate the random password 2022-03-10 06:11:58 +05:30
Kovid Goyal
8d119f06b3 Force restrictive permissions on file used to pass ssh data to kitty 2022-03-10 05:30:47 +05:30
Kovid Goyal
708c5126b9 Return the data cookie settings when generating the bootstrap script 2022-03-09 22:18:04 +05:30
Kovid Goyal
577de9f746 ssh kitten: Start work on connection sharing
Basic sharing works. Now investigate if we can eliminate the round-trip
latency by transmitting the data without waiting for the start message
when using a shared connection
2022-03-09 19:27:38 +05:30
Kovid Goyal
38a70f5b51 ... 2022-03-09 15:31:19 +05:30
Kovid Goyal
118306a9ff Avoid an extra process hanging around when running the interpreter on the remote machine 2022-03-09 15:29:57 +05:30
Kovid Goyal
704717ff1d Handle case of tty not being OK 2022-03-09 15:27:24 +05:30
Kovid Goyal
405c472d13 Cleanup previous PR 2022-03-09 14:59:08 +05:30
Kovid Goyal
17c994db57 Merge branch 'ksi-ssh' of https://github.com/page-down/kitty 2022-03-09 14:39:28 +05:30
Kovid Goyal
e227264bad Nicer error message when failing to load FreeType face 2022-03-09 14:28:38 +05:30
Kovid Goyal
8751ea79e7 Clear python error flag when loading fallback face fails 2022-03-09 14:16:56 +05:30
pagedown
3b3ffa7455 Docs: Update support for non-POSIX shell tcsh (csh) 2022-03-09 16:12:28 +08:00
pagedown
4322825ac7 Add support for sh that does not support the -l login shell option
FreeBSD sh does not support using the -l option to run as a login shell.
2022-03-09 16:12:20 +08:00
pagedown
d29fa7b382 ssh kitten: Add FreeBSD tcsh (csh) support
Replace line feeds and exclamation marks for tcsh compatibility.
2022-03-09 16:11:58 +08:00
Kovid Goyal
08bb63fa92 Ensure tdir is deleted on exit 2022-03-09 13:24:24 +05:30
Kovid Goyal
5dde31f80c DRYer 2022-03-09 11:52:36 +05:30
Kovid Goyal
3bb869f725 Also test launching of bootstrap.py 2022-03-09 11:32:14 +05:30
Kovid Goyal
11686b90f7 ... 2022-03-09 11:30:34 +05:30
Kovid Goyal
6df78fa67c Add tests with different shells used as launchers 2022-03-09 11:29:06 +05:30
Kovid Goyal
53b1607c4d When testing ssh kitten launch the bootscrapt script the same way sshd does it 2022-03-09 11:25:02 +05:30
Kovid Goyal
2341a27f63 ... 2022-03-08 23:05:42 +05:30
Kovid Goyal
0661caf9da DRYer 2022-03-08 23:04:58 +05:30
Kovid Goyal
5b5bd77c53 ssh kitten: Fix not working when user's login shell is fish 2022-03-08 22:39:31 +05:30
Kovid Goyal
d36f6b39c7 Fix previous PR 2022-03-08 21:29:09 +05:30
Kovid Goyal
b2a5b07f92 Merge branch 'ksi' of https://github.com/page-down/kitty 2022-03-08 21:29:05 +05:30
pagedown
46889a3a32 Fix shell integration being disabled with one invalid option 2022-03-08 23:42:41 +08:00
Kovid Goyal
958ebb72a6 DRYer 2022-03-08 20:48:37 +05:30
Kovid Goyal
febc5c53a6 Get the python interpreter working with non-POSIX login shells 2022-03-08 20:44:29 +05:30
Kovid Goyal
6e921300e2 Let ssh concat the cli args for us 2022-03-08 19:49:25 +05:30
Kovid Goyal
e167dec8a9 Note that on FreeBSD the login shell needs to be changed as well 2022-03-08 19:31:02 +05:30
Kovid Goyal
0019f07cc0 Fix interpreter opt target 2022-03-08 19:25:11 +05:30
Kovid Goyal
20fc1e6b0c Add a note about BSD servers 2022-03-08 18:23:44 +05:30
Kovid Goyal
908946a067 Merge branch 'ksi-ssh' of https://github.com/page-down/kitty 2022-03-08 11:37:40 +05:30
pagedown
f1df7b1c1f Use Python in preference to Perl 2022-03-08 13:59:32 +08:00
Kovid Goyal
65b9c69bd8 Use python in preference to perl
I know how to make python code robust, no clue about perl.
2022-03-08 11:05:02 +05:30
Kovid Goyal
b91e47c3b6 Merge branch 'ksi-ssh' of https://github.com/page-down/kitty 2022-03-08 10:30:11 +05:30
pagedown
0e3a11c53b Use Perl in bootstrap.sh if available 2022-03-08 12:28:09 +08:00
pagedown
53d8d2aaad Use the more explicit b64encode
Fix using ssh kitten to connect to OpenBSD.
2022-03-08 12:19:57 +08:00
Kovid Goyal
84303cbf2e Use head -c only if available 2022-03-07 21:48:06 +05:30
Kovid Goyal
5e457da30b Only use bz2 compression if bzip2 is available 2022-03-07 20:44:26 +05:30
Kovid Goyal
855718b179 ssh kitten: match hostnames against both remote hostname and hostname used on the command line to connect to it 2022-03-07 20:32:02 +05:30
Kovid Goyal
d037c0b0fc OpenBSD compat 2022-03-07 20:14:02 +05:30
Kovid Goyal
90f5937413 Forgot to use the actual python variable 2022-03-07 19:41:18 +05:30
Kovid Goyal
cbbea37b0c ... 2022-03-07 19:37:30 +05:30
Kovid Goyal
4d74b23f20 Merge branch 'ksi-bash' of https://github.com/page-down/kitty 2022-03-07 19:26:56 +05:30
Kovid Goyal
79dd26a43a ... 2022-03-07 18:38:06 +05:30
Kovid Goyal
259e3076fa Ensure python is searched for only once 2022-03-07 18:36:56 +05:30
Kovid Goyal
f2cb2422f0 Use python when base64 is not available 2022-03-07 18:34:02 +05:30
pagedown
4aea64261e ... 2022-03-07 20:56:02 +08:00
pagedown
cf0cd9acd9 Remove trailing semicolons 2022-03-07 20:53:35 +08:00
pagedown
b4b0bdc853 DCS @ kitty-print should be output to STDERR 2022-03-07 20:49:18 +08:00
pagedown
0b2837fcfa Fix bash integration debug log printing 2022-03-07 20:43:14 +08:00
Kovid Goyal
f20ad7df01 Better error message when base64 is not found 2022-03-07 18:12:01 +05:30
Kovid Goyal
c9071a66ca ssh kitten: Add an option to change the cwd at login 2022-03-07 12:24:37 +05:30
Kovid Goyal
b0ea960159 Dont use --no-same-owner when extracting tar archives
This flag is missing on OpenBSD and is the default on other platforms
when extracting as non-root. Make the uname/gname taringo field empty so
when extracting as root files will always be owned by root.
2022-03-07 12:10:45 +05:30
Kovid Goyal
0e7f1d60d6 Have bootstrap.sh preserve file permissions when untarring 2022-03-07 11:45:14 +05:30
Kovid Goyal
03c79502f9 Use uname -m for hostname in bootstrap.sh if needed 2022-03-07 11:24:44 +05:30
Kovid Goyal
d4d4e00f9d Merge branch 'ksi' of https://github.com/page-down/kitty 2022-03-07 11:18:15 +05:30
Kovid Goyal
b52e5e795e Dont use a double quote in bootstrap.py 2022-03-07 11:11:10 +05:30
Kovid Goyal
68df13d3fe Fix recursive definitions in env vars not expanded 2022-03-07 11:07:26 +05:30
pagedown
5f3d90e411 ... 2022-03-07 12:39:49 +08:00
pagedown
1b68e41db4 Remove the fish integration prompt end B prompt marking
Currently kitty does not use the B prompt marking.
This is consistent with the zsh and bash implementations.
Improve compatibility with most user configurations.
2022-03-07 12:12:52 +08:00
pagedown
817ac82968 Detect SSH sessions without affecting performance
Exclude local runs by KITTY_PID.
Check KITTY_WINDOW_ID to detect connections via ssh kitten.
Check SSH via who -m with the integration manually installed and sudo.
2022-03-07 12:00:55 +08:00
pagedown
43fd8cb13c Unify exec function definition order 2022-03-07 11:36:52 +08:00
pagedown
397fbe7ad3 Avoid unnecessary which and fix typos 2022-03-07 11:30:12 +08:00
pagedown
3095e7a256 Remove trailing semicolons 2022-03-07 11:25:22 +08:00
pagedown
df9e893cbe Explicitly use builtin and command 2022-03-07 11:24:18 +08:00
Kovid Goyal
6ff69c88df ... 2022-03-07 06:58:14 +05:30
Kovid Goyal
6e4d3c98da Ensure pw file is cleaned up on kitten exit
This way it is cleaned up even if ssh fails
2022-03-07 06:54:11 +05:30
Kovid Goyal
2404eba11f ssh kitten: Passthrough to ssh if run outside of kitty
Also, ensure that the ssh data request is only served if it is received
over the tty of the correct kitty window.
2022-03-07 06:48:18 +05:30
Kovid Goyal
e5c57a679d Some more docs for the SSH kitten 2022-03-07 06:26:50 +05:30
Kovid Goyal
33de55540b 2nd which unneccesary 2022-03-06 22:25:03 +05:30
Kovid Goyal
99e1605bba Use the correct which implementation
Same one as used by child.py
2022-03-06 21:54:56 +05:30
Kovid Goyal
95c4e26b24 macOS: When using Apple's less as the pager for viewing scrollback strip out OSC codes as Apple's less cant parse them
Fixes #4788
2022-03-06 21:52:59 +05:30
Kovid Goyal
795953a341 get rid of the who -m ssh session test
I dont like executing a binary in a fast startup script. Lets see
if there are a lot of sessions in the wild that dont use the SSH_TTY
env var
2022-03-06 15:47:08 +05:30
Kovid Goyal
75d5e386d3 Make the integration tests more strict
Actually assert that there are/are not prompt marking bytes in the data
received by the pty
2022-03-06 15:35:24 +05:30
Kovid Goyal
00d2a8527f Fix parsing of env vars in bootstrap.py 2022-03-06 15:05:40 +05:30
Kovid Goyal
a1ade8fc42 Dont use format strings in bootstrap.py 2022-03-06 14:47:44 +05:30
Kovid Goyal
7f9fec061a bootstrap.py is now tested the same as bootsstrap.sh 2022-03-06 14:26:15 +05:30
Kovid Goyal
ec782d3296 More work on bootstrap.py 2022-03-06 13:23:30 +05:30
Kovid Goyal
2444864508 Make compiling of terminfo atomic 2022-03-06 13:04:57 +05:30
Kovid Goyal
1ccc50b21b More work on bootstrap.py 2022-03-06 12:55:36 +05:30
Kovid Goyal
4552a474b7 Make the no-integration test more comprehensive and stronger 2022-03-06 12:23:11 +05:30
Kovid Goyal
85c6d8f16e More robust check for exec -a support 2022-03-06 12:20:06 +05:30
Kovid Goyal
14d391cc2e Check $pipestatus for zsh as well 2022-03-06 11:43:33 +05:30
Kovid Goyal
8fe87a0df5 Search PATH when executing login shell 2022-03-06 11:13:40 +05:30
Kovid Goyal
ff01df3b16 Dont byte compile the bootstrap script during build 2022-03-06 10:54:58 +05:30
Kovid Goyal
c713dc0ca8 Allow using a --kitten argument with the ssh kitten to make it easier to override settings from ssh.conf 2022-03-06 10:07:46 +05:30
Kovid Goyal
31ea5d74a7 Exclude junk directories when adding user files as well 2022-03-06 10:00:02 +05:30
Kovid Goyal
31b01d42c0 use inherited instead of inherit 2022-03-06 09:54:33 +05:30
Kovid Goyal
482b853908 Add a note about typing before the prompt being lost 2022-03-05 15:49:21 +05:30
Kovid Goyal
675411df85 Start work on python bootstrap 2022-03-05 15:43:55 +05:30
Kovid Goyal
f94d33fa6a ... 2022-03-05 15:29:09 +05:30
Kovid Goyal
7fe110dff1 Move code to initialize TTY into its own function 2022-03-05 15:16:04 +05:30
Kovid Goyal
591f711886 DRYer 2022-03-05 15:10:09 +05:30
Kovid Goyal
1dc7fc8ac7 Note that zsh's read function is terminally broken 2022-03-05 14:56:57 +05:30
Kovid Goyal
ffa79d731c Allow configuring the ssh kitten via env vars 2022-03-05 12:29:55 +05:30
Kovid Goyal
01dd0416ac Add an option to control the login shell 2022-03-05 11:16:15 +05:30
Kovid Goyal
0bd1676978 Some cleanup 2022-03-05 10:58:42 +05:30
Kovid Goyal
f3407959a6 Start work on python bootstrap script 2022-03-05 10:54:21 +05:30
Kovid Goyal
30e635a934 Use zsh's builtin functions to do I/O with TTY
Far more robust than the system tools
2022-03-05 10:31:00 +05:30
Kovid Goyal
f6706a55ec ... 2022-03-05 09:20:08 +05:30
Kovid Goyal
f0b79f88b2 Merge branch 'fix-copy-or-interrupt' of https://github.com/page-down/kitty 2022-03-05 08:08:40 +05:30
Kovid Goyal
262ba0197d Allow using - as a synonym for /dev/stdin when reading the config 2022-03-05 08:07:32 +05:30
pagedown
31c2447fb8 Fix not scrolling to the bottom when an interrupt is sent
Replicates the same side effects of keyboard key event.
2022-03-05 10:25:49 +08:00
Kovid Goyal
54a4ebfe48 Merge branch 'dte-kbd-proto' of https://github.com/craigbarnes/kitty 2022-03-05 07:51:13 +05:30
Craig Barnes
106c7a1706 Mention dte text editor in list of apps in docs/keyboard-protocol.rst 2022-03-04 23:56:17 +00:00
Kovid Goyal
e469b46ce5 Avoid calling who is either of SSH_TTY or SSH2_TTY are defined 2022-03-04 21:40:24 +05:30
Kovid Goyal
0c79561977 Fix the ssh_copy test on macOS 2022-03-04 21:31:13 +05:30
Kovid Goyal
9e82397de9 Merge branch 'test-ksi-fish' of https://github.com/page-down/kitty 2022-03-04 21:22:02 +05:30
pagedown
7c166e2194 Try to make the fish vi cursor test more stable 2022-03-04 23:46:39 +08:00
Kovid Goyal
0a2b09da40 Prevent inject loop 2022-03-04 21:12:41 +05:30
Kovid Goyal
c02d578468 Nicer error message if bash version < 4
macOS has bash 3
2022-03-04 20:59:22 +05:30
Kovid Goyal
e990d233e5 ooops 2022-03-04 20:54:26 +05:30
Kovid Goyal
a7cdcfcc16 Bash integration: Prevent shell integration code from running twice if user enables both automatic and manual integration 2022-03-04 20:48:57 +05:30
Kovid Goyal
75224e1661 Merge branch 'ksi-bash' of https://github.com/page-down/kitty 2022-03-04 20:37:05 +05:30
pagedown
d236b34fd4 Shell integration: Fix running bash non-interactively
In POSIX mode, bash does not perform ENV with non-interactive shell, so
the mode cannot be recovered. Check the arguments and do not change the
execution environment.
2022-03-04 19:47:44 +08:00
pagedown
c8313409ff Explicitly call bash builtin 2022-03-04 19:36:38 +08:00
Kovid Goyal
6cba8e0166 remove unused variable 2022-03-04 14:52:55 +05:30
Kovid Goyal
0067726bbe spelling 2022-03-04 13:52:33 +05:30
Kovid Goyal
ce620cec0a Use a memoryview to avoid memcopies 2022-03-04 13:41:23 +05:30
Kovid Goyal
e797ba4800 Allow matching on hostname and username 2022-03-04 12:42:31 +05:30
Kovid Goyal
fe27ee2d79 Allow configuring the interpreter to use on the remote host 2022-03-04 12:18:27 +05:30
Kovid Goyal
95efeee7de Also return user name when requesting bootstrap data 2022-03-04 12:16:45 +05:30
Kovid Goyal
da30536709 bash/zsh integration: Show hostname in title when in an SSH session 2022-03-04 11:13:59 +05:30
Kovid Goyal
108ccffcd8 assume grep is present 2022-03-04 10:13:23 +05:30
Kovid Goyal
c3ce0c26e7 ... 2022-03-04 10:01:33 +05:30
Kovid Goyal
e0c984046c EXEC_CMD must come after login_shell detection since it can use login_shell 2022-03-04 10:00:12 +05:30
Kovid Goyal
64d6337612 ... 2022-03-04 09:54:17 +05:30
Kovid Goyal
603684211f bootstrap should not fail if no tty present 2022-03-04 08:30:23 +05:30
Kovid Goyal
499b30d175 Allow specifying multiple matching hostnames 2022-03-04 07:23:35 +05:30
Kovid Goyal
3f3efab221 Fix hostname detection when hostname binary not present 2022-03-04 07:22:59 +05:30
Kovid Goyal
ef9adc92c8 Note on how to use include for DRYer config 2022-03-04 07:13:56 +05:30
Kovid Goyal
ad7c251f56 Fix ln failing if link exists 2022-03-04 07:08:04 +05:30
Kovid Goyal
1c0d254ec6 More ssh kitten docs 2022-03-04 07:03:38 +05:30
Kovid Goyal
f1ce8c0e8a Add some docs for the ssh kitten 2022-03-03 22:37:24 +05:30
Kovid Goyal
1c558be524 Port HISTFILE fix to ssh bash launcher 2022-03-03 21:24:45 +05:30
Kovid Goyal
7d653cb7bf Allow copying the same file to multiple locations 2022-03-03 21:24:45 +05:30
Kovid Goyal
b4cc38a1d9 Fix symlink extraction over ssh 2022-03-03 21:24:45 +05:30
Kovid Goyal
8867317b6a Allow transferring files outside of HOME 2022-03-03 21:24:45 +05:30
Kovid Goyal
4b6bfaffba More work on ssh copy 2022-03-03 21:24:45 +05:30
Kovid Goyal
fadae42715 Work on parsing copy instructions 2022-03-03 21:24:45 +05:30
Kovid Goyal
77c9affc00 Start work on copy instructions 2022-03-03 21:24:45 +05:30
Kovid Goyal
e5ba15949b $size doesnt need to be global 2022-03-03 21:24:45 +05:30
Kovid Goyal
a3e59697a1 ... 2022-03-03 21:24:45 +05:30
Kovid Goyal
0e2125cda3 When die-ing bring cursor back to zero column explicitly since it could happen in raw mode 2022-03-03 21:24:45 +05:30
Kovid Goyal
95da414511 Avoid one record read 2022-03-03 21:24:45 +05:30
Kovid Goyal
c0d5ace640 Prevent invalid root paths 2022-03-03 21:24:45 +05:30
Kovid Goyal
ae48407b20 untar files atomically 2022-03-03 21:24:45 +05:30
Kovid Goyal
e06bd68379 Split up ssh tests 2022-03-03 21:24:45 +05:30
Kovid Goyal
ae6665493a Implement setting of env vars 2022-03-03 21:24:44 +05:30
Kovid Goyal
c6f37afeff Add config to control shell integration per host 2022-03-03 21:24:44 +05:30
Kovid Goyal
59f656e3ca Allow controlling where on the remote computer the ssh kitten installs its data 2022-03-03 21:24:44 +05:30
Kovid Goyal
12658c4756 Make ssh data start request transmission more robust 2022-03-03 21:24:44 +05:30
Kovid Goyal
37c185462a Handle error messages form terminal during bootstrap 2022-03-03 21:24:44 +05:30
Kovid Goyal
53c8485a7a Get env conf working with tests 2022-03-03 21:24:44 +05:30
Kovid Goyal
846021296f Start work on config infrastructure for ssh kitten 2022-03-03 21:24:44 +05:30
Kovid Goyal
5c8651c7cd bootstrap script should work even when stdout is redirected 2022-03-03 21:24:44 +05:30
Kovid Goyal
ad91f5af53 ... 2022-03-03 21:24:44 +05:30
Kovid Goyal
02a68e7541 Pass the value of shell_integration in the tarfile
Allows per host overrides and also avoids needing to read kitty.conf in
the ssh kitten
2022-03-03 21:24:44 +05:30
Kovid Goyal
6e5dbc5285 Test for handling of leading data 2022-03-03 21:24:44 +05:30
Kovid Goyal
fda9415873 Use a record separator to delimit the start of data
Needed because the user could press keys and send data to the tty
before kitty can send the ssh data
2022-03-03 21:24:44 +05:30
Kovid Goyal
4054163447 DRYer 2022-03-03 21:24:44 +05:30
Kovid Goyal
e1f5ef59c8 Remove integration tests with login_shell=''since that is tested explicitly before 2022-03-03 21:24:44 +05:30
Kovid Goyal
44baeb6924 Run login_shell detection tests with all available shells 2022-03-03 21:24:44 +05:30
Kovid Goyal
c00e8b1709 Add tests for the individual login_shell detection functions 2022-03-03 21:24:44 +05:30
Kovid Goyal
3fb7ce7100 When using KITTY_DEVELOP_FROM load resources from the develop dir 2022-03-03 21:24:44 +05:30
Kovid Goyal
86b15ad693 fix detection of python when no python2 or python3 links present 2022-03-03 21:24:43 +05:30
Kovid Goyal
53c00ac631 Fix detection of login shell from passwd 2022-03-03 21:24:43 +05:30
Kovid Goyal
99d0c2d846 Get reading data working on macOS 2022-03-03 21:24:43 +05:30
Kovid Goyal
55ede897b9 faster fail 2022-03-03 21:24:43 +05:30
Kovid Goyal
a71e7d7eb1 Simplify data transmission 2022-03-03 21:24:43 +05:30
Kovid Goyal
3c28a4f723 sh on macOS doesnt have echo -n 2022-03-03 21:24:43 +05:30
Kovid Goyal
6b681df473 Include all terminfo variants in binary bundles
Needed so that they can be transmitted over ssh easily
2022-03-03 21:24:43 +05:30
Kovid Goyal
22c1ee7dc8 Cannot call the parser from callbacks that are themselves called from the parser 2022-03-03 21:24:43 +05:30
Kovid Goyal
c24e16e8cd debug function 2022-03-03 21:24:43 +05:30
Kovid Goyal
d452a5cdce ... 2022-03-03 21:24:43 +05:30
Kovid Goyal
198dd52700 Better error messages 2022-03-03 21:24:43 +05:30
Kovid Goyal
2dfea0f213 Fix a couple of conditions so they work in older dash 2022-03-03 21:24:43 +05:30
Kovid Goyal
5064b5c2b1 Apparently posh on CI is utterly broken 2022-03-03 21:24:43 +05:30
Kovid Goyal
78b553e55e Add tests for turning off shell integration in the bootstrap script 2022-03-03 21:24:43 +05:30
Kovid Goyal
8ca3a511cc Get the ssh bootstrap tests fully working 2022-03-03 21:24:43 +05:30
Kovid Goyal
bf26a3f569 Skip bash if its too old when testing bootstrap script 2022-03-03 21:24:43 +05:30
Kovid Goyal
ddb8753548 Work on enabling shell integration over ssh 2022-03-03 21:24:43 +05:30
Kovid Goyal
e73525d0a2 Start work on testing the bootstrap script 2022-03-03 21:24:43 +05:30
Kovid Goyal
f37d947dd5 more work on ssh data transmission 2022-03-03 21:24:42 +05:30
Kovid Goyal
4279f20daf Dont depend on the default bash prompt when testing 2022-03-03 21:24:42 +05:30
Kovid Goyal
2dd7c3b939 More work on ssh bootstrap 2022-03-03 21:24:42 +05:30
Kovid Goyal
cf01480ec8 An echo escape code to echo data via the TTY 2022-03-03 21:24:42 +05:30
Kovid Goyal
d8ed42ae8e Move setting of ZLE_RPROMPT_INDENT to zshrc which will hopefully prevent it being overriden 2022-03-03 19:16:44 +05:30
Kovid Goyal
297592242c Fix #4782
Presumably the failure is caused by zsh not having finished drawing the
prompt when the cursor shape is changed. So instead wait till the
expected prompt is drawn. There are probably more places where this
change needs to be made, which I cant tell since I cant reproduce.
2022-03-03 17:22:42 +05:30
Kovid Goyal
1c0a8a49fc Merge branch 'fix-nerd-fonts' of https://github.com/page-down/kitty 2022-03-03 14:41:46 +05:30
pagedown
16298e49c7 Update Unicode input kitten names 2022-03-03 16:45:07 +08:00
pagedown
abb0b95006 Add some reasonable keywords from font awesome official aliases
These glyphs can be searched by name when using Unicode input kitten.
2022-03-03 16:44:56 +08:00
pagedown
32f5ea7b63 Fix overlapping nerd fonts glyph 2022-03-03 16:29:29 +08:00
Kovid Goyal
90ed5959de version 0.24.4 2022-03-03 10:54:01 +05:30
Kovid Goyal
d999cc4143 Merge branch 'patch-1' of https://github.com/rqel/kitty 2022-03-03 08:03:25 +05:30
Kovid Goyal
6c1d8d5c63 Add instructions on where to get the NERD font 2022-03-03 08:01:36 +05:30
rqel
a316242a4b Update symbol_map unicode codepoint range for Symbols Nerd Font
Signed-off-by: rqel <rqel@pm.me>
2022-03-02 18:19:13 -08:00
Kovid Goyal
a4ae090c37 commit surface even for out of order configures 2022-03-03 07:18:04 +05:30
Kovid Goyal
abdcc64053 Merge branch 'always-commit' of https://github.com/Nefsen402/kitty 2022-03-03 07:16:50 +05:30
Alexander Orzechowski
ac407d42de wayland: always commit surface on configure 2022-03-02 14:43:49 -05:00
rqel
19c4a3f0a8 Add U+E0CA
Signed-off-by: rqel <rqel@pm.me>
2022-03-02 07:07:05 -08:00
rqel
3afd96d421 Update symbol_map
Signed-off-by: rqel <rqel@pm.me>
2022-03-02 06:37:18 -08:00
Kovid Goyal
f421666a27 Nicer error message when importing a kitten fails 2022-03-02 08:26:06 +05:30
Kovid Goyal
af6baa33be Ignore out of order surface configure events 2022-03-01 07:59:17 +05:30
Kovid Goyal
1096cbe236 Use an anonymous struct 2022-03-01 07:46:45 +05:30
Kovid Goyal
998be9b90c Merge branch 'wayland-fix-configure' of https://github.com/Nefsen402/kitty 2022-03-01 07:45:24 +05:30
Alexander Orzechowski
854cb8f27e wayland: handle resize requests after acknowledging the configure
The wayland protocol requires that clients commit a new buffer sometime
after `xdg_surface_ack_configure`.
2022-02-28 19:42:11 -05:00
Alexander Orzechowski
e359094cff wayland: move window state 2022-02-28 19:42:11 -05:00
Kovid Goyal
db57230987 Cleanup changelog 2022-02-28 20:47:08 +05:30
Kovid Goyal
4de3cecbbe Update changelog for previous PR
Fixes #4763
2022-02-28 20:21:06 +05:30
Kovid Goyal
c37a8bd3b1 Merge branch 'fix-read-scr-size' of https://github.com/page-down/kitty 2022-02-28 20:19:44 +05:30
Kovid Goyal
e103b280fd Add test for HISTFILE 2022-02-28 20:09:54 +05:30
pagedown
2235ea67e2 Fix ScreenSizeGetter 2022-02-28 22:39:19 +08:00
Kovid Goyal
1f6a4f7bd4 ... 2022-02-28 20:07:57 +05:30
Kovid Goyal
8c7ffc90f3 Fix the default bash HISTFILE changing to .sh_history instead of .bash_history
Fixes #4765
2022-02-28 20:06:48 +05:30
Kovid Goyal
29d85833f1 Merge branch 'ksi-fish' of https://github.com/page-down/kitty 2022-02-28 17:50:05 +05:30
pagedown
74c56d69ac Also fall back to check the last known working version of fish 2022-02-28 19:26:20 +08:00
Kovid Goyal
cf520646a9 Merge branch 'feat-launch-url-err' of https://github.com/page-down/kitty 2022-02-28 13:12:14 +05:30
pagedown
da5213346a show_error kitten: Use green color for closing tips 2022-02-28 15:02:16 +08:00
pagedown
bdcb98eafc Use show_error kitten to display launch URL error messages 2022-02-28 15:02:05 +08:00
Kovid Goyal
ef637cd7d3 ... 2022-02-28 11:28:42 +05:30
Kovid Goyal
dbbabd73c5 Repeat hold message on ctrl+c/d instead of completely ignoring or ending hold 2022-02-28 11:17:00 +05:30
Kovid Goyal
436ef0074a DRYer 2022-02-28 11:08:32 +05:30
Kovid Goyal
0904dec810 Fix exception on ctrl+c exit of program under --hold 2022-02-28 11:02:06 +05:30
Kovid Goyal
0aa07ead7e Bundle wayland client libraries in the binary build
The version of libwayland kitty builds against is now 1.20 and this
introduces the new wl_proxy_marshal_flags function. The usual suspect
distros have too old libwayland-client so we need to bundle.

Fixes #4760
2022-02-28 10:27:44 +05:30
Kovid Goyal
d87cac87ff version 0.24.3 2022-02-28 08:00:18 +05:30
Kovid Goyal
7e8c96896f Do a shutdown and rebuild 2022-02-28 07:21:46 +05:30
Kovid Goyal
2619db0e58 Cleanup previous PR 2022-02-27 21:31:39 +05:30
Kovid Goyal
ee3632b85d Merge branch 'ksi-zsh' of https://github.com/page-down/kitty 2022-02-27 21:31:31 +05:30
pagedown
1c88c13fc2 Shell integration: Try to get ZDOTDIR from /etc/zshenv when no RC files 2022-02-27 23:25:26 +08:00
Kovid Goyal
7f476eb924 Merge branch 'test-ksi-zsh' of https://github.com/page-down/kitty 2022-02-27 18:30:13 +05:30
pagedown
2d4f7e3446 Disable system startup files in zsh integration test with --noglobalrcs 2022-02-27 20:21:05 +08:00
Kovid Goyal
165c1240a9 Make the test a little more robust 2022-02-27 11:04:12 +05:30
Kovid Goyal
ef5c66ee17 Dont bother with new escape code for setting title
Since we are only sending the last command, it cannot have CSI
sequences in it anyway except in extremely contrived situations, so just
strip all ctrl chars out.
2022-02-27 10:55:02 +05:30
Kovid Goyal
33abd31d1a ... 2022-02-27 10:48:52 +05:30
Kovid Goyal
f91463a494 Also add test for handling of control chars in zsh title reporting 2022-02-27 10:47:23 +05:30
Kovid Goyal
30146007d3 Avoid extra tr invocation 2022-02-27 10:23:04 +05:30
Kovid Goyal
d53f8f24c4 Fix #4757
Still have to do the fix for zsh/fish
2022-02-27 10:20:19 +05:30
Kovid Goyal
f9621b1e11 Merge branch 'fix-ksi-fish' of https://github.com/page-down/kitty 2022-02-27 09:32:37 +05:30
pagedown
e2f16ff624 Add fish pipestatus integration tests and changelog entries 2022-02-27 00:27:31 +08:00
pagedown
121778e5c6 Remove unnecessary function checks 2022-02-27 00:08:36 +08:00
pagedown
ef32488890 Shell integration: Fix fish pipestatus being overwritten 2022-02-27 00:07:46 +08:00
Kovid Goyal
9d349d618a Fix #4743 2022-02-26 14:42:21 +05:30
Kovid Goyal
9f0a4f43b8 Add some video reviews to press mentions 2022-02-26 09:54:16 +05:30
Kovid Goyal
a8826f0d02 When dropping URLs/files onto kitty at a shell prompt insert them appropriately quoted and space separated 2022-02-25 10:30:15 +05:30
Kovid Goyal
6689d312a3 macOS: Paste multiple URLs separated by newlines
Fixes #4734
2022-02-25 10:17:36 +05:30
Kovid Goyal
2d7cb25b20 Fix #4739
I hope, since I cannot reproduce.
2022-02-25 05:50:42 +05:30
Kovid Goyal
da10eaca00 Merge branch 'docs' of https://github.com/page-down/kitty 2022-02-24 19:19:12 +05:30
Kovid Goyal
6d3995d4ac Merge branch 'feat-eof-exit' of https://github.com/page-down/kitty 2022-02-24 19:18:52 +05:30
pagedown
e3adf8c6bf show_error kitten: Exit at EOF 2022-02-24 21:13:57 +08:00
pagedown
b8e522484d ... 2022-02-24 20:50:06 +08:00
Kovid Goyal
ef4240e196 Add Python bytes 272 to press mentions 2022-02-24 18:01:55 +05:30
Kovid Goyal
8fa4a48ae5 Merge branch 'ksi-fish' of https://github.com/page-down/kitty 2022-02-24 17:59:41 +05:30
pagedown
4f3da2bc00 Output warnings for outdated versions of fish 2022-02-24 20:25:48 +08:00
pagedown
7b8c2c846f Shell integration: Check fish version and exit on outdated versions 2022-02-24 18:43:46 +08:00
Kovid Goyal
b212fd5bcd Dont actually need a thread for PTY 2022-02-24 10:05:13 +05:30
Kovid Goyal
0a297f4656 proper ordering during shutdown 2022-02-24 00:27:09 +05:30
Kovid Goyal
fa397a1d24 PTY: Write to child in separate thread 2022-02-24 00:26:08 +05:30
Kovid Goyal
0610daaec7 Remove echo dance 2022-02-24 00:08:17 +05:30
Kovid Goyal
8278e2b88d Dont fail test in no PATH in environ 2022-02-23 23:27:24 +05:30
Kovid Goyal
cb4a9d89cf Cleanup linenum matching and add some tests 2022-02-23 23:06:19 +05:30
Kovid Goyal
7800c598f6 hints kitten: Fix a regression that broke recognition of path:linenumber:colnumber
Fixes #4675
2022-02-23 22:38:54 +05:30
Kovid Goyal
fc651b72ab Merge branch 'refactor' of https://github.com/page-down/kitty 2022-02-23 19:52:11 +05:30
pagedown
a9a7912372 ... 2022-02-23 21:37:41 +08:00
pagedown
43f435c334 Avoid shadow the global variable name 2022-02-23 21:30:05 +08:00
pagedown
693fc0f0c7 CI: Disable codeql auto install python dependencies 2022-02-23 21:28:29 +08:00
Kovid Goyal
12e011c481 Merge branch 'test-ksi-fish' of https://github.com/page-down/kitty 2022-02-23 18:31:13 +05:30
Kovid Goyal
668783ba1c Use a version check when skipping bash test 2022-02-23 18:27:20 +05:30
pagedown
c18ebef702 ... 2022-02-23 20:49:32 +08:00
Kovid Goyal
03f9f29ce4 DRYer 2022-02-23 18:14:40 +05:30
Kovid Goyal
f62acab715 Install fish on macOS CI 2022-02-23 18:07:06 +05:30
Kovid Goyal
28ab9bfa2a Merge branch 'test-ksi-fish' of https://github.com/page-down/kitty 2022-02-23 18:02:53 +05:30
pagedown
9c05481f14 ... 2022-02-23 20:05:30 +08:00
pagedown
8ca92e0536 Disable fish integration on CI since the version is outdated and broken 2022-02-23 19:58:09 +08:00
pagedown
c0f6201ac3 Add fish shell integration tests 2022-02-23 19:55:19 +08:00
Kovid Goyal
27f3a5e16a Fix previous PR breaking bash integration 2022-02-23 12:30:02 +05:30
Kovid Goyal
de10dfe91b Merge branch 'ksi-bash' of https://github.com/page-down/kitty 2022-02-23 12:22:00 +05:30
pagedown
444a690a86 Remove the extra comment line 2022-02-23 14:37:45 +08:00
pagedown
3d7b3f7d72 Use the official project name of Bash 2022-02-23 14:21:13 +08:00
pagedown
741ef7f115 Remove new lines with bash 2022-02-23 14:09:13 +08:00
pagedown
e0c84c7176 Use bash builtin 2022-02-23 14:01:47 +08:00
pagedown
393425e3d1 Remove trailing spaces 2022-02-23 13:59:39 +08:00
Kovid Goyal
fc9645832d Add tests for --noprofile, --rcfile, --norc as well 2022-02-23 10:42:25 +05:30
Kovid Goyal
c47f41cfc0 Add tests for bash startup file sourcing 2022-02-23 08:35:24 +05:30
Kovid Goyal
08221489fd Cleanup previous PR 2022-02-23 07:59:41 +05:30
Kovid Goyal
3c6766ff06 Merge branch '4721-lig-check-fallback' of https://github.com/nickwynja/kitty 2022-02-23 07:57:36 +05:30
Kovid Goyal
e28aae620a Add tests for reset of cursor shape when running commands 2022-02-23 07:48:42 +05:30
Nick Wynja
c240e7deaf Also check ### to confirm spacer strategy
relates to #4721
2022-02-22 14:59:19 -05:00
Kovid Goyal
31a5965b01 Splits layout: A new value for :option:launch --location to auto-select the split axis when splitting existing windows. 2022-02-22 22:37:26 +05:30
Kovid Goyal
7a2a849a97 Add a note that shell integration should be removed from bashrc 2022-02-22 21:45:31 +05:30
Kovid Goyal
2c96e49566 ... 2022-02-22 21:40:03 +05:30
Kovid Goyal
e7846f916a Cleanup how it works for bash 2022-02-22 21:37:50 +05:30
Kovid Goyal
d4f4d56f94 DRYer 2022-02-22 21:32:33 +05:30
Kovid Goyal
0108037076 Dont leak the ENV environ var we use to load our integration script into the shell 2022-02-22 21:29:32 +05:30
Kovid Goyal
88091b4ab3 BASH integration: No longer modify .bashrc to load shell integration
I think I have things setup robustly so that the shell integration
is loaded transparently via env vars and the normal bash startup files
are sourced, in the same way that vanilla bash does it. Let's hope I
haven't overlooked something.
2022-02-22 21:24:51 +05:30
Kovid Goyal
4487462b0d bash assumes ECHO is enabled for the tty 2022-02-22 20:43:58 +05:30
Kovid Goyal
dac9b07f16 bash shell integration: Handle both literal and escaped newlines in PS1 2022-02-22 18:30:20 +05:30
Kovid Goyal
b59212696a Skip testing bash on macOS as it is too old 2022-02-22 14:53:46 +05:30
Kovid Goyal
7fe1376e34 DRYer 2022-02-22 14:52:54 +05:30
Kovid Goyal
e25b90c1b6 Add bash integration tests 2022-02-22 12:23:19 +05:30
Kovid Goyal
cb32a0b8fc Handle remote print callback in tests 2022-02-22 11:47:44 +05:30
Kovid Goyal
05617f7dca strip kitty markup from ps1 before checking for newlines 2022-02-22 11:40:09 +05:30
Kovid Goyal
2d2f4b9ba9 Multi-line processing of bash prompts should only be done when the prompt actually contains a newline 2022-02-21 22:54:10 +05:30
Kovid Goyal
65c7ecbc30 Test prompt drawing after screen is shrunk 2022-02-21 21:17:52 +05:30
Kovid Goyal
da5e37620e Also test changing of title when running command 2022-02-21 21:17:52 +05:30
Kovid Goyal
261057396c Fix zsh integration test on CI
Also, add various other robustness improvements to the test
2022-02-21 21:17:41 +05:30
Kovid Goyal
a43f610555 Better error msg when cursor is not changed 2022-02-21 18:23:35 +05:30
Kovid Goyal
45ae52e5d0 Fix assert ordering 2022-02-21 18:07:54 +05:30
Kovid Goyal
a565443d4a Saner tempdir removal 2022-02-21 18:05:36 +05:30
Kovid Goyal
081d6a3f16 Install various shells ON CI so we can test with them 2022-02-21 18:00:23 +05:30
Kovid Goyal
c9cc832875 Add basic tests for zsh shell integration 2022-02-21 17:57:25 +05:30
Kovid Goyal
595698d8e9 Remove dirs in HOME from PATH wen running tests 2022-02-21 16:57:11 +05:30
Kovid Goyal
b28d94ac97 Always use kitty as the python interpreter to run in the tests 2022-02-21 14:45:12 +05:30
Kovid Goyal
b9684879e7 Try to fix tests failing on CI 2022-02-21 14:24:08 +05:30
Kovid Goyal
63f974531b Framework for testing with external programs via a PTY 2022-02-21 14:08:10 +05:30
Kovid Goyal
a559210923 Retry macOS builds as well on nightly
They seem to be failing with some regularity
2022-02-21 11:18:21 +05:30
Kovid Goyal
8d36fb9edc Fix copying of selection after selection has been scrolled off history buffer raising an error
Fixes #4713
2022-02-20 13:07:31 +05:30
Kovid Goyal
f652b23169 Retry ca certs download on macOS 2022-02-20 11:09:58 +05:30
Kovid Goyal
d50a2ea288 Note that Konsole also supports the kitty graphics protocol 2022-02-20 10:59:26 +05:30
Kovid Goyal
80fc3a1faa Fix incorrect function used to get tuple size 2022-02-19 15:29:59 +05:30
Kovid Goyal
9a04405ad2 Cache the bell sound in the canberra server since it is a frequently played sound 2022-02-19 13:07:44 +05:30
Kovid Goyal
fdc9835587 Cleanup previous PR 2022-02-18 13:44:25 +05:30
Kovid Goyal
702bb2cd06 Merge branch 'fix-macos-cur-update' of https://github.com/page-down/kitty 2022-02-18 13:40:05 +05:30
pagedown
58e8609c1a macOS: Ensure the cursor is updated once
macOS will set the cursor to arrow after milliseconds after the switch
desktop animation ends. So the cursor that was updated immediately after
the focus will be changed again. This also affects toggling fullscreen.
2022-02-18 13:52:19 +08:00
pagedown
69c5c49094 Disable cursor rects 2022-02-18 13:52:00 +08:00
pagedown
ff8de7607a Also handles the case where toggleFullScreen does not get called 2022-02-18 13:50:46 +08:00
Kovid Goyal
cfd0872cea Merge branch 'feat-macos-fullscreen' of https://github.com/page-down/kitty 2022-02-17 17:41:00 +05:30
pagedown
7007f2e7fc macOS: Allow to customize global menu full screen shortcut 2022-02-17 16:31:46 +08:00
pagedown
6d0721341b Fix phantom window appears when executing full screen in transition 2022-02-17 15:47:03 +08:00
Kovid Goyal
7a156d5ef3 Also fix --hold not working if program to be executed is not found 2022-02-17 11:16:08 +05:30
Kovid Goyal
185c3320a4 Fix --hold not working with some programs that cause keyboard interrupt to be passed to python 2022-02-17 11:12:33 +05:30
Kovid Goyal
1c9cf32735 Add a few more important env vars to debug output 2022-02-17 07:45:36 +05:30
Kovid Goyal
6bfb6da0ad Make the regex for sgr stripping tighter 2022-02-15 22:33:51 +05:30
Kovid Goyal
56a5738018 Remove unused code 2022-02-15 22:22:07 +05:30
Kovid Goyal
919667129f hints kitten: Avoid double scan of input text 2022-02-15 22:21:31 +05:30
Kovid Goyal
e9f49a3292 Make ANSI sanitizer pattern re-useable 2022-02-15 22:14:14 +05:30
Kovid Goyal
711f8b024e Properly sanitize pagerhist when returning as plain text 2022-02-15 22:11:57 +05:30
Kovid Goyal
53716c084b hints kitten: Strip prompt mark escape codes 2022-02-15 22:04:10 +05:30
Kovid Goyal
2b495bcf9d Merge branch 'docs' of https://github.com/page-down/kitty 2022-02-15 15:26:50 +05:30
pagedown
d10812c6b0 Docs: Fix GitHub discussion link in commented config 2022-02-15 17:42:33 +08:00
Kovid Goyal
80202d2679 Fix show_last_command_output not working when the output is stored partially in the scrollback pager history buffer
Fixes #4435
2022-02-15 13:04:02 +05:30
Kovid Goyal
5d120a2f36 Output prompt marking when serializing to ANSI 2022-02-15 08:57:17 +05:30
Kovid Goyal
cc11326baa Linux: Do not rescale fallback fonts to match the main font cell height
Fixes #4707
2022-02-15 07:51:15 +05:30
Kovid Goyal
f63dbc0ebd clamp min_lines when mouse is grabbed 2022-02-15 07:24:12 +05:30
Kovid Goyal
88630731dc Cleanup previous PR 2022-02-14 20:21:17 +05:30
Kovid Goyal
3e2a8d80d7 Merge branch 'feat-mouse-scroll-min' of https://github.com/page-down/kitty 2022-02-14 20:12:00 +05:30
Kovid Goyal
55626e5a41 Fix symbol_map in gen-config.py 2022-02-14 19:56:41 +05:30
pagedown
7ff07f7620 Add changelog entry 2022-02-14 22:07:01 +08:00
pagedown
d2f522277c Add wheel_scroll_min_lines to set the minimum scrolling lines 2022-02-14 21:53:02 +08:00
Kovid Goyal
0248edbdb9 xkb debug events should be printed to stderr 2022-02-14 15:03:31 +05:30
Kovid Goyal
d24248e93b Merge branch 'master' of https://github.com/ichigozero/kitty 2022-02-14 14:03:45 +05:30
Gary Sentosa
dcd7890a0c Show tab name otherwise tab title for select_tab 2022-02-14 15:48:08 +09:00
Kovid Goyal
f219b10c30 Changelog entry for previous PR 2022-02-14 07:19:54 +05:30
Kovid Goyal
cc039afc1e Merge branch 'glfw-wl-touchpad-scale' of https://github.com/xsrvmy/kitty 2022-02-14 07:18:49 +05:30
Rui Ming (Max) Xiong
d2288d8f83 Scale touchpad input by display scale on wayland 2022-02-13 20:47:02 -05:00
Kovid Goyal
4b4f904aac Dont use global variables for the axis discrete counts 2022-02-13 20:56:55 +05:30
Kovid Goyal
e06b774174 Avoid double scan of output to look for escape codes 2022-02-13 17:33:13 +05:30
Kovid Goyal
8d4772f804 Update bundled pygments
Fixes #4702
2022-02-13 17:10:55 +05:30
Kovid Goyal
3be00bd712 Reduce radius for detection of double click 2022-02-13 15:51:59 +05:30
Kovid Goyal
a0e4449fb2 Ensure prefixchar is written even for empty lines 2022-02-13 15:49:46 +05:30
Kovid Goyal
ebfc19def5 Only add an SGR reset at the end if there is atleast one escape code in the ansi output 2022-02-13 15:14:32 +05:30
Kovid Goyal
a4abe26d32 Fix copy ansi to clipboard ignoring newlines 2022-02-13 15:09:14 +05:30
Kovid Goyal
5f8cb22d02 Merge branch 'fix-mouse-extra-btn' of https://github.com/page-down/kitty 2022-02-13 14:53:40 +05:30
pagedown
cafc3973ec mouse_demo: Add mouse scroll wheel buttons 2022-02-13 16:45:48 +08:00
pagedown
436a57a61e mouse_demo: Fix mouse extra button bit mask 2022-02-13 16:36:51 +08:00
Kovid Goyal
da5111a267 Cleanup mouse debug input reporting 2022-02-13 11:14:41 +05:30
Kovid Goyal
ee5cf90684 Cleanup previous PR and add changelog entry for it
Fixes #4694
2022-02-13 10:53:24 +05:30
Kovid Goyal
108974f4f7 Merge branch 'pointer-resolution' of https://github.com/xsrvmy/kitty 2022-02-13 10:45:17 +05:30
Rui Ming (Max) Xiong
79fa9f1c95 Use counters for discrete flags instead 2022-02-12 17:45:28 -05:00
Rui Ming (Max) Xiong
40bf12af7a Check for discrete mouse events on wayland 2022-02-12 02:12:59 -05:00
Kovid Goyal
263d121f3e Rescale symbol_map faces for the desired cell height
Matches treatment of fallback faces. See #4670
2022-02-12 07:57:03 +05:30
Kovid Goyal
9222d002f7 Merge branch 'docs' of https://github.com/page-down/kitty 2022-02-11 20:46:06 +05:30
pagedown
9a6aab034d Add link for packaging status 2022-02-11 23:05:12 +08:00
Kovid Goyal
b931b06941 Add mouse co-ords to debug output for move events 2022-02-11 15:09:43 +05:30
Kovid Goyal
90dc9b6fe6 ... 2022-02-11 15:00:11 +05:30
Kovid Goyal
275ede6f0a Fix a fast click, move mouse, click sequence causing the first click event to be discarded
Fix #4603
2022-02-11 14:46:37 +05:30
Kovid Goyal
9fd4f8e5c2 Merge branch 'feat-hints-qm' of https://github.com/page-down/kitty 2022-02-11 13:05:34 +05:30
Kovid Goyal
01b4654461 A new option narrow_symbols to turn off opportunistic wide rendering of private use codepoints 2022-02-11 13:04:44 +05:30
pagedown
d40e6a9ece hints kitten: Match and strip Unicode single and double quotes 2022-02-11 14:59:35 +08:00
Kovid Goyal
b2317e0f12 Merge branch 'fix-macos-shortcuts' of https://github.com/page-down/kitty 2022-02-11 12:14:55 +05:30
pagedown
444d9bd341 macOS: Ignore when the global shortcut is disabled 2022-02-11 14:23:57 +08:00
Kovid Goyal
8fbe96744b ... 2022-02-11 10:50:33 +05:30
Kovid Goyal
1c48ec7196 Allow passing a "reset" argument to resize_window 2022-02-11 08:16:17 +05:30
Kovid Goyal
c4b3bbd057 Update changelog for previous PR
Fixes #4657
2022-02-11 06:55:53 +05:30
Kovid Goyal
502ed94f31 Merge branch 'fix-macos-shortcuts' of https://github.com/page-down/kitty 2022-02-11 06:54:31 +05:30
Kovid Goyal
18ce091bfa Fix symbol/PUA glyphs loaded via symbol_map instead of as fallbacks not using following spaces to render larger versions
Fixes #4670
2022-02-11 06:36:54 +05:30
Kovid Goyal
60f675758f Fix touch_scroll_multiplier also taking effect in terminal programs such as vim that handle mouse events themselves
Fixes #4680
2022-02-11 06:22:00 +05:30
Kovid Goyal
9bfa4553a8 Shell integration: bash: Fix rendering of multiline prompts with more than two lines
Fixes #4681
2022-02-11 06:08:34 +05:30
pagedown
358f30ca7a No longer need to fall back and check the default shortcuts 2022-02-11 02:39:50 +08:00
pagedown
e32785831b macOS: Add missing global shortcuts that will be enabled by default 2022-02-11 02:19:27 +08:00
Kovid Goyal
728eceb620 Add implementation for focus moving hardcoded shortcuts 2022-02-10 18:56:47 +05:30
Kovid Goyal
57f591d1ce Simplify default global shortcut lookup
Now if a shortcut is present in the plist, it will not be considered for
default matching
2022-02-10 17:47:11 +05:30
Kovid Goyal
e4397a1c73 Framework for Apple's default global shortcuts 2022-02-10 14:15:21 +05:30
Kovid Goyal
1170cf474f A new action copy_ansi_to_clipboard to copy the current selection with ANSI formatting codes
Fixes #4665
2022-02-10 12:20:19 +05:30
Kovid Goyal
ce8b0cf748 Allow using line_as_ansi with ranges 2022-02-09 21:40:33 +05:30
Kovid Goyal
696f371aa4 Merge branch 'ci' of https://github.com/page-down/kitty 2022-02-09 19:55:05 +05:30
pagedown
8ebd514251 Update Brewfile format 2022-02-09 21:35:22 +08:00
Kovid Goyal
d3bc6001d8 Merge branch 'ksi-fish' of https://github.com/page-down/kitty 2022-02-09 10:58:25 +05:30
pagedown
f5415ca824 Restore XDG_DATA_DIRS right after fish integration script is loaded 2022-02-09 13:06:38 +08:00
Kovid Goyal
0dbe27438d Ensure CSI are stripped from menbar title as well 2022-02-09 08:07:18 +05:30
Kovid Goyal
7448789951 Improve CWD detection when there are multiple foreground processes in the TTY process group 2022-02-08 20:30:00 +05:30
Kovid Goyal
dc6138d286 Add a note about why we check _ksi_prompt_command 2022-02-08 19:52:02 +05:30
Kovid Goyal
7457f637a2 bash shell integration: Dont call _ksi_prompt_command from PROMPT_COMMAND unlessit is set 2022-02-08 19:48:30 +05:30
Kovid Goyal
c9da734c0e Show the output from failed ssh commands 2022-02-08 10:46:34 +05:30
Kovid Goyal
141c814d72 Merge branch 'docs' of https://github.com/page-down/kitty 2022-02-08 05:35:36 +05:30
Kovid Goyal
bdb98cf210 Count chars not bytes when truncating menubar title 2022-02-07 22:37:58 +05:30
pagedown
7cc3d5907f Docs: Prefer namespaced launch points 2022-02-08 01:07:23 +08:00
Kovid Goyal
3c709a28f7 ... 2022-02-07 22:08:28 +05:30
Kovid Goyal
e9ea7b13b6 macOS: Add an option to control the max length of the window title displayed in the global menubar
Fixes #2132
2022-02-07 21:57:36 +05:30
Kovid Goyal
ac16880eec Linux: Fix fontconfig alias not being used if the aliased font is dual spaced instead of monospaced
Fixes #4649
2022-02-07 21:02:47 +05:30
Kovid Goyal
c54bdd921a Allow pressing esc to exit --hold as well 2022-02-07 18:14:54 +05:30
Kovid Goyal
fc17528337 Get --hold to work even when stdin is redirected 2022-02-07 15:39:21 +05:30
Kovid Goyal
9b2db6ec53 Another alternate icon 2022-02-07 14:19:04 +05:30
Kovid Goyal
0fcfaa2a98 Report errors correctly when launching multiple URLs 2022-02-07 14:07:17 +05:30
Kovid Goyal
ba97a728f2 Reduce max remembered window size of 50K pixels 2022-02-07 12:19:32 +05:30
Kovid Goyal
a3b046fdcd Merge branch 'fix-macos-new-tab' of https://github.com/page-down/kitty 2022-02-07 12:07:17 +05:30
pagedown
ddfda3efde Fix launching a new tab when there is no OS window 2022-02-07 13:55:43 +08:00
Kovid Goyal
a2269cb66e Fix launch command not creating a new window if no OS window is present 2022-02-07 11:14:29 +05:30
Kovid Goyal
1358f00969 Raise an exception for empty url schemes 2022-02-06 21:10:41 +05:30
Kovid Goyal
eedc849c45 Cleanup previous PR 2022-02-06 20:49:40 +05:30
Kovid Goyal
89679d07ae Merge branch 'feat-macos-handle-url' of https://github.com/page-down/kitty 2022-02-06 20:29:16 +05:30
Kovid Goyal
01d866f482 Also add openable mimetypes to kitty-open.desktop 2022-02-06 20:27:50 +05:30
Kovid Goyal
73b0312dcb Merge branch 'minor-tweaks' of https://github.com/page-down/kitty 2022-02-06 20:14:26 +05:30
Kovid Goyal
f9d9fe6db4 Shell integration: bash: Dont fail if an existing PROMPT_COMMAND ends with a semi-colon
Fixes #4645
2022-02-06 19:02:39 +05:30
pagedown
e31ca68875 macOS: Add a way to set kitty as the default handler for the URL schemes 2022-02-06 19:51:39 +08:00
pagedown
8ae273ee3a Simplify reassembling for the command 2022-02-06 19:24:02 +08:00
pagedown
73a197fcde Add kitty-launcher.desktop to handle URL scheme for Linux 2022-02-06 19:12:57 +08:00
pagedown
648bff02b5 Only remove the initial window if no startup session is configured 2022-02-06 18:58:52 +08:00
pagedown
7740bc138b Add changelog entry for previous PR 2022-02-06 18:58:40 +08:00
pagedown
f5337096d5 Rename LAUNCH_URL to LAUNCH_URLS 2022-02-06 18:57:40 +08:00
Kovid Goyal
dddff91fad Linux: Fix rendering of emoji when using scalable fonts such as Segoe UI Emoji 2022-02-06 13:31:11 +05:30
Kovid Goyal
f047678711 More robust initial window replacement when launching URLs 2022-02-06 07:11:57 +05:30
Kovid Goyal
aa8b23395f Merge branch 'feat-macos-open-with' of https://github.com/page-down/kitty 2022-02-06 06:53:36 +05:30
Kovid Goyal
7c36c19de0 Cleanup previous PR 2022-02-06 06:31:56 +05:30
Kovid Goyal
49183ced3b Merge branch 'fix-launch-cmd-args' of https://github.com/page-down/kitty 2022-02-06 06:31:22 +05:30
pagedown
007e9697c4 macOS: Add Open with kitty Service
There are still some file types that cannot be matched.
Add a standalone Open With service.
Users can configure shortcut for this service in System Preferences.
2022-02-05 23:20:19 +08:00
pagedown
9989edbe42 macOS: Add archive file type to info plist
List kitty in the Open With menu for archive files.
E.g. compressed files or disk image files
2022-02-05 23:19:33 +08:00
Kovid Goyal
9742e2ec48 Make mypy happy 2022-02-05 19:53:16 +05:30
pagedown
b47711e23a Fix kitty_exe() being executed when the script doesn't have shebang 2022-02-05 20:28:06 +08:00
pagedown
3dfdb3ac89 Fix missing args when running a script without exec perms via launch 2022-02-05 20:28:06 +08:00
Kovid Goyal
4d3e2a07d1 Cleanup previous PR 2022-02-05 17:45:46 +05:30
Kovid Goyal
a42eb3e643 Merge branch 'feat-lines-on-scr' of https://github.com/page-down/kitty
Fixes #4462
2022-02-05 17:44:21 +05:30
Kovid Goyal
39c77a9486 Allow running the launch actions by invoking the kitty executable with +open 2022-02-05 17:39:48 +05:30
pagedown
e22546c56a Add arguments to get the first and last line of text for launch command 2022-02-05 20:02:24 +08:00
Kovid Goyal
ced61096df Add some docs for the previous PR 2022-02-05 12:57:15 +05:30
Kovid Goyal
c0ea127810 Merge branch 'feat-macos-open-url' of https://github.com/page-down/kitty 2022-02-05 12:46:39 +05:30
Kovid Goyal
29b1e3fa46 Sanity check for main() args 2022-02-05 11:56:18 +05:30
Kovid Goyal
b2faa0d9f7 Fix #4637 2022-02-05 11:35:40 +05:30
pagedown
ddb9b67de3 Restrict custom launch actions to be prefixed with kitty:///launch/
Preserve the kitty URL scheme for further use.
2022-02-05 13:23:41 +08:00
pagedown
ffbc533565 Add ftps, ircs, kitty, sftp, and ssh to url_prefixes 2022-02-05 13:10:21 +08:00
pagedown
206e490491 macOS: Add common URL schemes to info plist 2022-02-05 13:09:13 +08:00
pagedown
135066f38c Add default launch action for ssh links 2022-02-05 13:05:58 +08:00
pagedown
51d591e177 macOS: Allow opening URLs with kitty 2022-02-05 13:05:41 +08:00
pagedown
80a62c8d71 Add preamble to generated file and fix gen-config.py filename 2022-02-05 13:05:13 +08:00
Kovid Goyal
90b54c5f7f Get build-dep working again for changes to bypy 2022-02-05 10:27:47 +05:30
Kovid Goyal
99c81e6858 Bump bundled version of wayland 2022-02-05 07:56:40 +05:30
Kovid Goyal
8fcb6278d7 Cleanup previous PR 2022-02-04 20:38:32 +05:30
Kovid Goyal
89e0abd41d Merge branch 'feat-reverse-scroll' of https://github.com/page-down/kitty 2022-02-04 20:34:37 +05:30
pagedown
a1a0c9ab80 Add new mappable action scroll_prompt_to_bottom 2022-02-04 22:52:06 +08:00
Kovid Goyal
9ab2a38d5c ... 2022-02-04 18:26:36 +05:30
Kovid Goyal
b5676a53ee Use a special role for actions documentation 2022-02-04 18:24:39 +05:30
Kovid Goyal
94898a8758 fix incorrect use of :ac: 2022-02-04 17:54:32 +05:30
Kovid Goyal
97a6a11066 Capitalization of menu action 2022-02-04 16:12:46 +05:30
Kovid Goyal
9fe22a5c27 Do a single pass over the cell vertex shader to set the defines 2022-02-04 14:34:41 +05:30
Kovid Goyal
f9b35c71d7 Another place to use NUM_UNDERLINE_STYLES 2022-02-04 14:16:31 +05:30
Kovid Goyal
6b47f6f769 Make adding new underline styles easier in the future 2022-02-04 14:05:19 +05:30
Kovid Goyal
37d8483728 Fix a regression in the previous release that broke strikethrough 2022-02-04 13:37:38 +05:30
Kovid Goyal
4776a9e785 When moving text into scrollback upto cursor actually move up to the prompt the cursor is at 2022-02-04 13:19:24 +05:30
Kovid Goyal
50bc5b0302 macOS: Add the default shortcut cmd+k to clear the terminal screen and scrollback up to the cursor
Fixes #4625
2022-02-04 11:58:52 +05:30
Kovid Goyal
7d496f20a1 Add changelog entry for previous PR 2022-02-04 11:43:57 +05:30
Kovid Goyal
42fbd0a1af A new action to clear scrollback+screen upto the line with the cursor 2022-02-04 11:42:42 +05:30
Kovid Goyal
8960bfebc0 ... 2022-02-04 11:41:45 +05:30
Kovid Goyal
b1209c1e7a Be explicit about python3 2022-02-04 11:19:51 +05:30
Kovid Goyal
365583efd7 Clarify SI docs a little
Fixes #4626
2022-02-04 10:51:41 +05:30
Kovid Goyal
926c2d71ee Merge branch 'fix-macos-ime' of https://github.com/page-down/kitty
Fixes #4621
2022-02-04 10:46:43 +05:30
pagedown
ce57c747cc macOS: Fix select next input source not working
For global shortcut to switch the next input source in the macOS system
preferences, final confirmation is only given when all modifier keys are
released.
2022-02-04 12:51:01 +08:00
Kovid Goyal
3e9129655a ... 2022-02-03 21:00:23 +05:30
Kovid Goyal
12f41f30b3 Only show important env vars in debug output
Also show their values since these are not sensitive
2022-02-03 20:43:23 +05:30
Kovid Goyal
1e7edd0218 ... 2022-02-03 20:14:52 +05:30
Kovid Goyal
2fd8ef389e Fix use-python not working reliably with SSH kitten 2022-02-03 19:58:10 +05:30
Kovid Goyal
53589c3954 ssh kitten: Fix location of generated terminfo files on NetBSD
Fixes #4622
2022-02-03 19:51:37 +05:30
Kovid Goyal
34a0218f35 Fix a regression in the previous release that broke active_tab_foreground
Fixes #4620
2022-02-03 18:12:42 +05:30
606 changed files with 126198 additions and 95043 deletions

View File

@@ -1,12 +1,12 @@
root = true
[*]
indent_style = spaces
indent_style = space
indent_size = 4
end_of_line = lf
trim_trailing_whitespace = true
[{Makefile,*.terminfo}]
[{Makefile,*.terminfo,*.go}]
indent_style = tab
# Autogenerated files with tabs below this line.

5
.gitattributes vendored
View File

@@ -3,7 +3,9 @@ kitty/emoji.h linguist-generated=true
kitty/charsets.c linguist-generated=true
kitty/key_encoding.py linguist-generated=true
kitty/unicode-data.c linguist-generated=true
kitty/rowcolumn-diacritics.c linguist-generated=true
kitty/rgb.py linguist-generated=true
kitty/srgb_gamma.c linguist-generated=true
kitty/gl-wrapper.* linguist-generated=true
kitty/glfw-wrapper.* linguist-generated=true
kitty/parse-graphics-command.h linguist-generated=true
@@ -15,6 +17,9 @@ kittens/diff/options/parse.py linguist-generated=true
glfw/*.c linguist-vendored=true
glfw/*.h linguist-vendored=true
kittens/unicode_input/names.h linguist-generated=true
tools/wcswidth/std.go linguist-generated=true
tools/unicode_names/names.txt linguist-generated=true
*.py text diff=python
*.m text diff=objc
*.go text diff=go

4
.github/FUNDING.yml vendored
View File

@@ -1,4 +1,2 @@
github: kovidgoyal
patreon: kovidgoyal
liberapay: kovidgoyal
custom: https://my.fsf.org/donate
custom: https://sw.kovidgoyal.net/kitty/support.html

View File

@@ -30,13 +30,22 @@ def install_deps():
print('Installing kitty dependencies...')
sys.stdout.flush()
if is_macos:
items = (x.strip() for x in open('Brewfile').readlines() if not x.startswith('#'))
run('brew', 'install', *items)
items = [x.split()[1].strip('"') for x in open('Brewfile').readlines() if x.strip().startswith('brew ')]
openssl = 'openssl'
items.remove('go') # already installed by ci.yml
import ssl
if ssl.OPENSSL_VERSION_INFO[0] == 1:
openssl += '@1.1'
run('brew', 'install', 'fish', openssl, *items)
else:
run('sudo apt-get update')
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 librsync-dev uuid-dev')
' libxcursor-dev libxcb-xkb-dev libdbus-1-dev libxkbcommon-dev libharfbuzz-dev libx11-xcb-dev zsh'
' libpng-dev liblcms2-dev libfontconfig-dev libxkbcommon-x11-dev libcanberra-dev librsync-dev uuid-dev'
' zsh bash dash')
# for some reason these directories are world writable which causes zsh
# compinit to break
run('sudo chmod -R og-w /usr/share/zsh')
if is_bundle:
install_bundle()
else:
@@ -55,7 +64,7 @@ def build_kitty():
def test_kitty():
run('./kitty/launcher/kitty +launch test.py')
run('./test.py')
def package_kitty():
@@ -121,6 +130,12 @@ def main():
package_kitty()
elif action == 'test':
test_kitty()
elif action == 'gofmt':
q = subprocess.check_output('gofmt -s -l tools'.split())
if q.strip():
q = '\n'.join(filter(lambda x: not x.rstrip().endswith('_generated.go'), q.decode().strip().splitlines())).strip()
if q:
raise SystemExit(q)
else:
raise SystemExit(f'Unknown action: {action}')

View File

@@ -6,6 +6,9 @@ env:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
linux:
name: Linux (python=${{ matrix.pyver }} cc=${{ matrix.cc }} sanitize=${{ matrix.sanitize }})
@@ -20,15 +23,15 @@ jobs:
cc: [gcc, clang]
include:
- python: a
pyver: 3.7
pyver: "3.8"
sanitize: 0
- python: b
pyver: 3.8
pyver: "3.11"
sanitize: 1
- python: c
pyver: 3.9
pyver: "3.9"
sanitize: 1
@@ -41,20 +44,26 @@ jobs:
cc: gcc
steps:
- name: Checkout source code
uses: actions/checkout@master
with:
fetch-depth: 10
- name: Set up Python ${{ matrix.pyver }}
uses: actions/setup-python@master
with:
python-version: ${{ matrix.pyver }}
- name: Checkout source code
uses: actions/checkout@v3
with:
fetch-depth: 10
- name: Build kitty
run: python .github/workflows/ci.py build
- name: Set up Python ${{ matrix.pyver }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.pyver }}
- name: Test kitty
run: python .github/workflows/ci.py test
- name: Install Go
uses: actions/setup-go@v3
with:
go-version-file: go.mod
- name: Build kitty
run: python .github/workflows/ci.py build
- name: Test kitty
run: python .github/workflows/ci.py test
linux-package:
name: Linux package
@@ -62,36 +71,53 @@ jobs:
env:
CFLAGS: -funsigned-char
steps:
- name: Checkout source code
uses: actions/checkout@master
with:
fetch-depth: 10
- name: Checkout source code
uses: actions/checkout@v3
with:
fetch-depth: 0 # needed for :commit: docs role
- name: Test for trailing whitespace
run: if grep -Inr '\s$' kitty kitty_tests kittens docs *.py *.asciidoc *.rst .gitattributes .gitignore; then echo Trailing whitespace found, aborting.; exit 1; fi
- name: Test for trailing whitespace
run: if grep -Inr '\s$' kitty kitty_tests kittens docs *.py *.asciidoc *.rst *.go .gitattributes .gitignore; then echo Trailing whitespace found, aborting.; exit 1; fi
- name: Set up Python
uses: actions/setup-python@master
with:
python-version: 3.8
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install build-only deps
run: pip install -r docs/requirements.txt flake8 mypy types-requests types-docutils
- name: Install Go
uses: actions/setup-go@v3
with:
go-version-file: go.mod
- name: Run pyflakes
run: python -m flake8 --count .
- name: Install build-only deps
run: python -m pip install -r docs/requirements.txt ruff mypy types-requests types-docutils
- name: Build kitty package
run: python .github/workflows/ci.py package
- name: Run ruff
run: ruff .
- name: Run mypy
run: python test.py mypy
- name: Run gofmt
run: go version && python .github/workflows/ci.py gofmt
- name: Build man page
run: make FAIL_WARN=1 man
- name: Build kitty package
run: python .github/workflows/ci.py package
- name: Build HTML docs
run: make FAIL_WARN=1 html
- name: Build kitty
run: python setup.py build --debug
- name: Build static kitten
run: python setup.py build-static-binaries
- name: Run mypy
run: which python && python -m mypy --version && ./test.py mypy
- name: Run go vet
run: go version && go vet ./...
- name: Build man page
run: make FAIL_WARN=1 man
- name: Build HTML docs
run: make FAIL_WARN=1 html
bundle:
name: Bundle test (${{ matrix.os }})
@@ -102,31 +128,52 @@ jobs:
env:
KITTY_BUNDLE: 1
steps:
- name: Checkout source code
uses: actions/checkout@master
with:
fetch-depth: 10
- name: Checkout source code
uses: actions/checkout@v3
with:
fetch-depth: 10
- name: Build kitty
run: which python3 && python3 .github/workflows/ci.py build
- name: Install Go
uses: actions/setup-go@v3
with:
go-version-file: go.mod
- name: Test kitty
run: python3 .github/workflows/ci.py test
- name: Build kitty
run: which python3 && python3 .github/workflows/ci.py build
- name: Test kitty
run: python3 .github/workflows/ci.py test
brew:
name: macOS Brew
runs-on: macos-latest
steps:
- name: Checkout source code
uses: actions/checkout@master
with:
fetch-depth: 10
- name: Checkout source code
uses: actions/checkout@v3
with:
fetch-depth: 0 # needed for :commit: docs role
- name: Build kitty
run: python3 .github/workflows/ci.py build
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Test kitty
run: python3 .github/workflows/ci.py test
- name: Install Go
uses: actions/setup-go@v3
with:
go-version-file: go.mod
- name: Build kitty package
run: python3 .github/workflows/ci.py package
- name: Build kitty
run: python3 .github/workflows/ci.py build
- name: Test kitty
run: python3 .github/workflows/ci.py test
- name: Install deps for docs
run: python3 -m pip install -r docs/requirements.txt
- name: Builds docs
run: make FAIL_WARN=1 docs
- name: Build kitty package
run: python3 .github/workflows/ci.py package

View File

@@ -9,27 +9,41 @@ on:
schedule:
- cron: '0 22 * * 5'
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
CodeQL-Build:
permissions:
contents: read # to fetch code (actions/checkout)
security-events: write # to upload SARIF results (github/codeql-action/analyze)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
- name: Install Go
uses: actions/setup-go@v3
with:
go-version-file: go.mod
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: python, c
setup-python-dependencies: false
- name: Build kitty
run: python3 .github/workflows/ci.py build
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2

9
.gitignore vendored
View File

@@ -1,22 +1,25 @@
*.so
*.pyc
*.pyo
*.bin
*_stub.pyi
*_generated.go
*_generated.h
/.dmypy.json
/tags
/build/
/linux-package/
/kitty.app/
/compile_commands.json
/link_commands.json
/glad/out/
/kitty/launcher/
/kitty/launcher/kitt*
/*.dSYM/
__pycache__/
/glfw/wayland-*-client-protocol.[ch]
/docs/_build/
/docs/generated/
/.mypy_cache
/.ruff_cache
.DS_Store
.cache
bypy/b
bypy/virtual-machines.conf

View File

@@ -1,7 +1,8 @@
pkg-config
zlib
librsync
python
imagemagick
harfbuzz
sphinx-doc
brew "pkg-config"
brew "zlib"
brew "librsync"
brew "python"
brew "imagemagick"
brew "harfbuzz"
brew "sphinx-doc"
brew "go"

View File

@@ -7,6 +7,11 @@ When reporting a bug, provide full details of your environment, that means, at
a minimum, kitty version, OS and OS version, kitty config (ideally a minimal
config to reproduce the issue with).
Note that bugs and feature requests are often closed quickly as they are either
fixed or deemed wontfix/invalid. In my experience, this is the only scaleable way to
manage a bug tracker. Feel free to continue to post to a closed bug report
if you would like to discuss the issue further. Being closed does not mean you
will not get any more responses.
### Contributing code

View File

@@ -35,6 +35,12 @@ profile:
app:
python3 setup.py kitty.app $(VVAL)
linux-package: FORCE
rm -rf linux-package
python3 setup.py linux-package
FORCE:
man:
$(MAKE) -C docs man

View File

@@ -11,4 +11,4 @@ https://www.reddit.com/r/KittyTerminal[Reddit community]
Packaging status in various repositories:
image:https://repology.org/badge/vertical-allrepos/kitty.svg[https://repology.org/project/kitty/versions]
image:https://repology.org/badge/vertical-allrepos/kitty.svg["Packaging status", link="https://repology.org/project/kitty/versions"]

View File

@@ -1,169 +1,7 @@
#!/usr/bin/env python3
# License: GPL v3 Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
import os
import sys
from typing import List
def icat(args: List[str]) -> None:
from kittens.runner import run_kitten as rk
sys.argv = args
rk('icat')
def list_fonts(args: List[str]) -> None:
from kitty.fonts.list import main as list_main
list_main(args)
def remote_control(args: List[str]) -> None:
from kitty.remote_control import main as rc_main
rc_main(args)
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
ret = subprocess.Popen(args[1:]).wait()
from kitty.utils import hold_till_enter
hold_till_enter()
raise SystemExit(ret)
def complete(args: List[str]) -> None:
from kitty.complete import main as complete_main
complete_main(args[1:], entry_points, namespaced_entry_points)
def launch(args: List[str]) -> None:
import runpy
sys.argv = args[1:]
try:
exe = args[1]
except IndexError:
raise SystemExit(
'usage: kitty +launch script.py [arguments to be passed to script.py ...]\n\n'
'script.py will be run with full access to kitty code. If script.py is '
'prefixed with a : it will be searched for in PATH'
)
if exe.startswith(':'):
import shutil
q = shutil.which(exe[1:])
if not q:
raise SystemExit(f'{exe[1:]} not found in PATH')
exe = q
if not os.path.exists(exe):
raise SystemExit(f'{exe} does not exist')
runpy.run_path(exe, run_name='__main__')
def shebang(args: List[str]) -> None:
script_path = args[1]
cmd = args[2:]
if cmd == ['__ext__']:
cmd = [os.path.splitext(script_path)[1][1:].lower()]
try:
f = open(script_path)
except FileNotFoundError:
raise SystemExit(f'The file {script_path} does not exist')
with f:
if f.read(2) == '#!':
line = f.readline().strip()
_plat = sys.platform.lower()
is_macos: bool = 'darwin' in _plat
if is_macos:
cmd = line.split(' ')
else:
cmd = line.split(' ', maxsplit=1)
os.execvp(cmd[0], cmd + [script_path])
def run_kitten(args: List[str]) -> None:
try:
kitten = args[1]
except IndexError:
from kittens.runner import list_kittens
list_kittens()
raise SystemExit(1)
sys.argv = args[1:]
from kittens.runner import run_kitten as rk
rk(kitten)
def edit_config_file(args: List[str]) -> None:
from kitty.cli import create_default_opts
from kitty.fast_data_types import set_options
from kitty.utils import edit_config_file as f
set_options(create_default_opts())
f()
def namespaced(args: List[str]) -> None:
try:
func = namespaced_entry_points[args[1]]
except KeyError:
pass
else:
func(args[1:])
return
raise SystemExit(f'{args[1]} is not a known entry point. Choices are: ' + ', '.join(namespaced_entry_points))
entry_points = {
# These two are here for backwards compat
'icat': icat,
'list-fonts': list_fonts,
'@': remote_control,
'+': namespaced,
}
namespaced_entry_points = {k: v for k, v in entry_points.items() if k[0] not in '+@'}
namespaced_entry_points['hold'] = hold
namespaced_entry_points['complete'] = complete
namespaced_entry_points['runpy'] = runpy
namespaced_entry_points['launch'] = launch
namespaced_entry_points['kitten'] = run_kitten
namespaced_entry_points['edit-config'] = edit_config_file
namespaced_entry_points['shebang'] = shebang
def setup_openssl_environment() -> None:
# 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 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)
if func is None:
if first_arg.startswith('@'):
remote_control(['@', first_arg[1:]] + sys.argv[2:])
elif first_arg.startswith('+'):
namespaced(['+', first_arg[1:]] + sys.argv[2:])
else:
from kitty.main import main as kitty_main
kitty_main()
else:
func(sys.argv[1:])
if __name__ == '__main__':
from kitty.entry_points import main
main()

View File

@@ -4,7 +4,6 @@
import glob
import os
import re
import shutil
import subprocess
import sys
@@ -13,11 +12,10 @@ import tempfile
def compile_terminfo(base):
with tempfile.TemporaryDirectory() as tdir:
proc = subprocess.run(['tic', '-x', f'-o{tdir}', 'terminfo/kitty.terminfo'], check=True, stderr=subprocess.PIPE)
regex = '^"terminfo/kitty.terminfo", line [0-9]+, col [0-9]+, terminal \'xterm-kitty\': older tic versions may treat the description field as an alias$'
for error in proc.stderr.decode('utf-8').splitlines():
if not re.match(regex, error):
print(error, file=sys.stderr)
proc = subprocess.run(['tic', '-x', f'-o{tdir}', 'terminfo/kitty.terminfo'], capture_output=True)
if proc.returncode != 0:
sys.stderr.buffer.write(proc.stderr)
raise SystemExit(proc.returncode)
tfiles = glob.glob(os.path.join(tdir, '*', 'xterm-kitty'))
if not tfiles:
raise SystemExit('tic failed to output the compiled kitty terminfo file')
@@ -40,6 +38,13 @@ def generate_terminfo():
with open('terminfo/kitty.terminfo', 'w') as f:
f.write(generate_terminfo())
proc = subprocess.run(['tic', '-CrT0', 'terminfo/kitty.terminfo'], capture_output=True)
if proc.returncode != 0:
sys.stderr.buffer.write(proc.stderr)
raise SystemExit(proc.returncode)
tcap = proc.stdout.decode('utf-8').splitlines()[-1]
with open('terminfo/kitty.termcap', 'w') as f:
f.write(tcap)
compile_terminfo(os.path.join(base, 'terminfo'))

View File

@@ -11,9 +11,8 @@ import sys
import tempfile
from contextlib import suppress
from bypy.constants import (
LIBDIR, PREFIX, PYTHON, SRC as KITTY_DIR, ismacos, worker_env
)
from bypy.constants import LIBDIR, PREFIX, PYTHON, ismacos, worker_env
from bypy.constants import SRC as KITTY_DIR
from bypy.utils import run_shell, walk
@@ -63,20 +62,31 @@ def build_frozen_launcher(extra_include_dirs):
def run_tests(kitty_exe):
with tempfile.TemporaryDirectory() as tdir:
env = {
uenv = {
'KITTY_CONFIG_DIRECTORY': os.path.join(tdir, 'conf'),
'KITTY_CACHE_DIRECTORY': os.path.join(tdir, 'cache')
}
[os.mkdir(x) for x in env.values()]
cmd = [kitty_exe, '+runpy', 'from kitty_tests.main import run_tests; run_tests()']
[os.mkdir(x) for x in uenv.values()]
env = os.environ.copy()
env.update(uenv)
cmd = [kitty_exe, '+runpy', 'from kitty_tests.main import run_tests; run_tests(report_env=True)']
print(*map(shlex.quote, cmd), flush=True)
if subprocess.call(cmd, env=env) != 0:
print('Checking of kitty build failed', file=sys.stderr)
if subprocess.call(cmd, env=env, cwd=build_frozen_launcher.writeable_src_dir) != 0:
print('Checking of kitty build failed, in directory:', build_frozen_launcher.writeable_src_dir, file=sys.stderr)
os.chdir(os.path.dirname(kitty_exe))
run_shell()
raise SystemExit('Checking of kitty build failed')
def build_frozen_tools(kitty_exe):
cmd = SETUP_CMD + ['--prefix', os.path.dirname(kitty_exe)] + ['build-frozen-tools']
if run(*cmd, cwd=build_frozen_launcher.writeable_src_dir) != 0:
print('Building of frozen kitten failed', file=sys.stderr)
os.chdir(KITTY_DIR)
run_shell()
raise SystemExit('Building of kitten launcher failed')
def sanitize_source_folder(path: str) -> None:
for q in walk(path):
if os.path.splitext(q)[1] not in ('.py', '.glsl', '.ttf', '.otf'):
@@ -96,6 +106,8 @@ def build_c_extensions(ext_dir, args):
cmd = SETUP_CMD + ['macos-freeze' if ismacos else 'linux-freeze']
if args.dont_strip:
cmd.append('--debug')
if args.extra_program_data:
cmd.append(f'--vcs-rev={args.extra_program_data}')
dest = kitty_constants['appname'] + ('.app' if ismacos else '')
dest = build_frozen_launcher.prefix = os.path.join(ext_dir, dest)
cmd += ['--prefix', dest, '--full']

View File

@@ -1,3 +1,3 @@
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'
deps 'bison flex libxcursor-dev libxrandr-dev libxi-dev libxinerama-dev libgl1-mesa-dev libx11-xcb-dev libxcb-xkb-dev libfontconfig1-dev libdbus-1-dev'

View File

@@ -10,12 +10,8 @@ import subprocess
import tarfile
import time
from bypy.constants import (
OUTPUT_DIR, PREFIX, is64bit, python_major_minor_version
)
from bypy.freeze import (
extract_extension_modules, freeze_python, path_to_freeze_dir
)
from bypy.constants import OUTPUT_DIR, PREFIX, is64bit, python_major_minor_version
from bypy.freeze import extract_extension_modules, freeze_python, path_to_freeze_dir
from bypy.utils import get_dll_path, mkdtemp, py_compile, walk
j = os.path.join
@@ -35,7 +31,11 @@ def binary_includes():
'expat', 'sqlite3', 'ffi', 'z', 'lzma', 'png16', 'lcms2', 'crypt',
'iconv', 'pcre', 'graphite2', 'glib-2.0', 'freetype', 'rsync',
'harfbuzz', 'xkbcommon', 'xkbcommon-x11',
'ncursesw', 'readline', 'brotlicommon', 'brotlienc', 'brotlidec'
# fontconfig is not bundled because in typical brain dead Linux
# distro fashion, different distros use different default config
# paths for fontconfig.
'ncursesw', 'readline', 'brotlicommon', 'brotlienc', 'brotlidec',
'wayland-client', 'wayland-cursor',
))) + (
get_dll_path('bz2', 2), get_dll_path('ssl', 2), get_dll_path('crypto', 2),
get_dll_path(f'python{py_ver}', 2),
@@ -139,6 +139,7 @@ def copy_python(env):
iv['sanitize_source_folder'](os.path.join(env.py_dir, x))
py_compile(env.py_dir)
freeze_python(env.py_dir, pdir, env.obj_dir, ext_map, develop_mode_env_var='KITTY_DEVELOP_FROM', remove_pyc_files=True)
shutil.rmtree(env.py_dir)
def build_launcher(env):
@@ -215,7 +216,7 @@ def create_tarfile(env, compression_level='9'):
print('Compressing archive...')
ans = f'{dist.rpartition(".")[0]}.txz'
start_time = time.time()
subprocess.check_call(['xz', '--threads=0', '-f', f'-{compression_level}', dist])
subprocess.check_call(['xz', '--verbose', '--threads=0', '-f', f'-{compression_level}', dist])
secs = time.time() - start_time
print('Compressed in {} minutes {} seconds'.format(secs // 60, secs % 60))
os.rename(f'{dist}.xz', ans)
@@ -233,10 +234,12 @@ def main():
files = find_binaries(env)
fix_permissions(files)
add_ca_certs(env)
kitty_exe = os.path.join(env.base, 'bin', 'kitty')
iv['build_frozen_tools'](kitty_exe)
if not args.dont_strip:
strip_binaries(files)
if not args.skip_tests:
iv['run_tests'](os.path.join(env.base, 'bin', 'kitty'))
iv['run_tests'](kitty_exe)
create_tarfile(env, args.compression_level)

View File

@@ -1,4 +1,4 @@
# Requires installation of XCode 10.3 and Python 3 and
# Requires installation of XCode 10.3 and go 1.19 and Python 3 and
# python3 -m pip install certifi
vm_name 'macos-kitty'

View File

@@ -13,16 +13,9 @@ import tempfile
import zipfile
from bypy.constants import PREFIX, PYTHON, SW, python_major_minor_version
from bypy.freeze import (
extract_extension_modules, freeze_python, path_to_freeze_dir
)
from bypy.macos_sign import (
codesign, create_entitlements_file, make_certificate_useable, notarize_app,
verify_signature
)
from bypy.utils import (
current_dir, mkdtemp, py_compile, run_shell, timeit, walk
)
from bypy.freeze import extract_extension_modules, freeze_python, path_to_freeze_dir
from bypy.macos_sign import codesign, create_entitlements_file, make_certificate_useable, notarize_app, verify_signature
from bypy.utils import current_dir, mkdtemp, py_compile, run_shell, timeit, walk
iv = globals()['init_env']
kitty_constants = iv['kitty_constants']
@@ -113,6 +106,9 @@ def do_sign(app_dir):
codesign(fw)
items = set(os.listdir('.')) - fw
codesign(expand_dirs(items))
# Sign kitten
with current_dir('MacOS'):
codesign('kitten')
# Now sign the main app
codesign(app_dir)
@@ -171,6 +167,7 @@ class Freeze(object):
self.add_misc_libraries()
self.freeze_python()
self.add_ca_certs()
self.build_frozen_tools()
if not self.dont_strip:
self.strip_files()
if not self.skip_tests:
@@ -185,7 +182,16 @@ class Freeze(object):
def add_ca_certs(self):
print('\nDownloading CA certs...')
from urllib.request import urlopen
cdata = urlopen(kitty_constants['cacerts_url']).read()
cdata = None
for i in range(5):
try:
cdata = urlopen(kitty_constants['cacerts_url']).read()
break
except Exception as e:
print(f'Downloading CA certs failed with error: {e}, retrying...')
if cdata is None:
raise SystemExit('Downloading C certs failed, giving up')
dest = join(self.contents_dir, 'Resources', 'cacert.pem')
with open(dest, 'wb') as f:
f.write(cdata)
@@ -360,6 +366,7 @@ class Freeze(object):
iv['sanitize_source_folder'](join(self.python_stdlib, x))
self.compile_py_modules()
freeze_python(self.python_stdlib, pdir, self.obj_dir, ext_map, develop_mode_env_var='KITTY_DEVELOP_FROM', remove_pyc_files=True)
shutil.rmtree(self.python_stdlib)
iv['build_frozen_launcher']([path_to_freeze_dir(), self.obj_dir])
os.rename(join(dirname(self.contents_dir), 'bin', 'kitty'), join(self.contents_dir, 'MacOS', 'kitty'))
shutil.rmtree(join(dirname(self.contents_dir), 'bin'))
@@ -368,6 +375,10 @@ class Freeze(object):
if f.endswith('.so') or f.endswith('.dylib'):
self.fix_dependencies_in_lib(f)
@flush
def build_frozen_tools(self):
iv['build_frozen_tools'](join(self.contents_dir, 'MacOS', 'kitty'))
@flush
def add_site_packages(self):
print('\nAdding site-packages')

View File

@@ -1 +1 @@
to_vm_excludes '/build /dist /kitty/launcher/kitty /.build-cache /tags __pycache__ /*_commands.json *.so *.pyd *.pyc'
to_vm_excludes '/build /dist /kitty/launcher/kitty* /.build-cache /tags __pycache__ /*_commands.json *.so *.pyd *.pyc *_generated.go'

View File

@@ -2,8 +2,8 @@
{
"name": "zlib",
"unix": {
"filename": "zlib-1.2.11.tar.xz",
"hash": "sha256:4ff941449631ace0d4d203e3483be9dbc9da454084111f97ea0a2114e19bf066",
"filename": "zlib-1.2.13.tar.xz",
"hash": "sha256:d14c38e313afc35a9a8760dadf26042f51ea0f5d154b0630a31da0540107fb98",
"urls": ["https://zlib.net/{filename}"]
}
},
@@ -163,15 +163,6 @@
}
},
{
"name": "pygments",
"unix": {
"filename": "Pygments-2.7.4.tar.gz",
"hash": "sha256:df49d09b498e83c1a73128295860250b0b7edd4c723a32e9bc0d295c7c2ec337",
"urls": ["pypi"]
}
},
{
"name": "libpng",
"unix": {
@@ -273,8 +264,8 @@
"name": "wayland",
"os": "linux",
"unix": {
"filename": "wayland-1.19.0.tar.xz",
"hash": "sha256:baccd902300d354581cd5ad3cc49daa4921d55fb416a5883e218750fef166d15",
"filename": "wayland-1.20.0.tar.xz",
"hash": "sha256:b8a034154c7059772e0fdbd27dbfcda6c732df29cae56a82274f6ec5d7cd8725",
"urls": ["https://wayland.freedesktop.org/releases/{filename}"]
}
},
@@ -283,8 +274,8 @@
"name": "wayland-protocols",
"os": "linux",
"unix": {
"filename": "wayland-protocols-1.20.tar.xz",
"hash": "sha256:9782b7a1a863d82d7c92478497d13c758f52e7da4f197aa16443f73de77e4de7",
"filename": "wayland-protocols-1.25.tar.xz",
"hash": "sha256:f1ff0f7199d0a0da337217dd8c99979967808dc37731a1e759e822b75b571460",
"urls": ["https://wayland.freedesktop.org/releases/{filename}"]
}
}

View File

@@ -2,29 +2,20 @@
import subprocess
files_to_exclude = '''\
kitty/wcwidth-std.h
kitty/charsets.c
kitty/unicode-data.c
kitty/key_encoding.py
kitty/rgb.py
kitty/gl.h
kitty/gl-wrapper.h
kitty/gl-wrapper.c
kitty/glfw-wrapper.h
kitty/glfw-wrapper.c
kitty/emoji.h
kittens/unicode_input/names.h
kitty/parse-graphics-command.h
kitty/options/types.py
kitty/options/parse.py
kitty/options/to-c-generated.h
kittens/diff/options/types.py
kittens/diff/options/parse.py
'''
ignored = []
for line in subprocess.check_output(['git', 'status', '--ignored', '--porcelain']).decode().splitlines():
if line.startswith('!! '):
ignored.append(line[3:])
files_to_exclude = '\n'.join(ignored)
cp = subprocess.run(['git', 'check-attr', 'linguist-generated', '--stdin'],
check=True, stdout=subprocess.PIPE, input=subprocess.check_output([ 'git', 'ls-files']))
for line in cp.stdout.decode().splitlines():
if line.endswith(' true'):
files_to_exclude += '\n' + line.split(':')[0]
p = subprocess.Popen([
'cloc', '--exclude-list-file', '/dev/stdin', 'kitty', 'kittens'
'cloc', '--exclude-list-file', '/dev/stdin', 'kitty', 'kittens', 'tools', 'kitty_tests', 'docs',
], stdin=subprocess.PIPE)
p.communicate(files_to_exclude.encode('utf-8'))
raise SystemExit(p.wait())

View File

@@ -10,7 +10,7 @@
}
.sidebar-logo {
max-height: 128px;
height: 128px;
}
.major-features li {

View File

@@ -4,18 +4,14 @@
{{ super() }}
{%- if analytics_id %}
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{{ analytics_id }}']);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_trackPageview']);
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id={{ analytics_id }}"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
gtag('config', '{{ analytics_id }}');
</script>
{% endif -%}

View File

@@ -1,12 +1,13 @@
Tabs and Windows
-------------------
|kitty| is capable of running multiple programs organized into tabs and
windows. The top level of organization is the *Tab*. Each tab consists
of one or more *windows*. The windows can be arranged in multiple
different layouts, like windows are organized in a tiling window
manager. The keyboard controls (which are all customizable) for tabs and
windows are:
|kitty| is capable of running multiple programs organized into tabs and windows.
The top level of organization is the :term:`OS window <os_window>`. Each OS
window consists of one or more :term:`tabs <tab>`. Each tab consists of one or more
:term:`kitty windows <window>`. The kitty windows can be arranged in multiple
different :term:`layouts <layout>`, like windows are organized in a tiling
window manager. The keyboard controls (which are :ref:`all customizable
<conf-kitty-shortcuts>`) for tabs and windows are:
Scrolling
~~~~~~~~~~~~~~
@@ -26,6 +27,11 @@ Browse scrollback in less :sc:`show_scrollback`
Browse last cmd output :sc:`show_last_command_output` (see :ref:`shell_integration`)
========================= =======================
The scroll actions only take effect when the terminal is in the main screen.
When the alternate screen is active (for example when using a full screen
program like an editor) the key events are instead passed to program running in the
terminal.
Tabs
~~~~~~~~~~~
@@ -52,6 +58,7 @@ Action Shortcut
New window :sc:`new_window` (also :kbd:`⌘+↩` on macOS)
New OS window :sc:`new_os_window` (also :kbd:`⌘+n` on macOS)
Close window :sc:`close_window` (also :kbd:`⇧+⌘+d` on macOS)
Resize window :sc:`start_resizing_window` (also :kbd:`⌘+r` on macOS)
Next window :sc:`next_window`
Previous window :sc:`previous_window`
Move window forward :sc:`move_window_forward`
@@ -64,8 +71,9 @@ Focus specific window :sc:`first_window`, :sc:`second_window` ... :sc:`ten
(clockwise from the top-left)
======================== =======================
Additionally, you can define shortcuts in :file:`kitty.conf` to focus neighboring
windows and move windows around (similar to window movement in vim)::
Additionally, you can define shortcuts in :file:`kitty.conf` to focus
neighboring windows and move windows around (similar to window movement in
:program:`vim`)::
map ctrl+left neighboring_window left
map shift+left move_window right
@@ -77,20 +85,20 @@ You can also define a shortcut to switch to the previously active window::
map ctrl+p nth_window -1
``nth_window`` will focus the nth window for positive numbers (starting from
:ac:`nth_window` will focus the nth window for positive numbers (starting from
zero) and the previously active windows for negative numbers.
To switch to the nth OS window, you can define ``nth_os_window``. Only positive
numbers are accepted, starting from one.
To switch to the nth OS window, you can define :ac:`nth_os_window`. Only
positive numbers are accepted, starting from one.
.. _detach_window:
You can define shortcuts to detach the current window and
move it to another tab or another OS window::
You can define shortcuts to detach the current window and move it to another tab
or another OS window::
# moves the window into a new OS window
map ctrl+f2 detach_window
# moves the window into a new Tab
# moves the window into a new tab
map ctrl+f3 detach_window new-tab
# moves the window into the previously active tab
map ctrl+f3 detach_window tab-prev
@@ -106,8 +114,8 @@ Similarly, you can detach the current tab, with::
# asks which OS Window to move the tab into
map ctrl+f4 detach_tab ask
Finally, you can define a shortcut to close all windows in a tab other than
the currently active window::
Finally, you can define a shortcut to close all windows in a tab other than the
currently active window::
map f9 close_other_windows_in_tab
@@ -121,21 +129,22 @@ The full list of actions that can be mapped to key presses is available
================================== =======================
Action Shortcut
================================== =======================
Show this help :sc:`show_kitty_doc`
Copy to clipboard :sc:`copy_to_clipboard` (also :kbd:`⌘+c` on macOS)
Paste from clipboard :sc:`paste_from_clipboard` (also :kbd:`⌘+v` on macOS)
Paste from selection :sc:`paste_from_selection`
Pass selection to program :sc:`pass_selection_to_program`
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 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)
Open URL in web browser :sc:`open_url`
Reset the terminal :sc:`reset_terminal` (also :kbd:`⌥+⌘+r` on macOS)
Edit :file:`kitty.conf` :sc:`edit_config_file` (also :kbd:`⌘+,` on macOS)
Reload :file:`kitty.conf` :sc:`reload_config_file` (also :kbd:`⌃+⌘+,` on macOS)
Debug :file:`kitty.conf` :sc:`debug_config` (also :kbd:`⌥+⌘+,` on macOS)
Pass current selection to program :sc:`pass_selection_to_program`
Edit |kitty| config file :sc:`edit_config_file` (also :kbd:`⌘+,` on macOS)
Open a |kitty| shell :sc:`kitty_shell`
Increase background opacity :sc:`increase_background_opacity`
Decrease background opacity :sc:`decrease_background_opacity`

View File

@@ -4,17 +4,14 @@ Install kitty
Binary install
----------------
.. |ins| replace:: curl -L :literal:`https://sw.kovidgoyal.net/kitty/installer.sh` | sh /dev/stdin
.. highlight:: sh
You can install pre-built binaries of |kitty| if you are on macOS or Linux using
the following simple command:
.. parsed-literal::
:class: pre
.. code-block:: sh
|ins|
_kitty_install_cmd
The binaries will be installed in the standard location for your OS,
@@ -24,8 +21,9 @@ 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.
to add it to your :envvar:`PATH`, create a symlink in :file:`~/.local/bin` or
:file:`/usr/bin` or wherever. You should create a symlink for the :file:`kitten`
binary as well.
Manually installing
@@ -33,11 +31,12 @@ Manually installing
If something goes wrong or you simply do not want to run the installer, you can
manually download and install |kitty| from the `GitHub releases page
<https://github.com/kovidgoyal/kitty/releases>`_. If you are on macOS, download
the :file:`.dmg` and install as normal. If you are on Linux, download the tarball
and extract it into a directory. The |kitty| executable will be in the
<https://gitea.rexy712.xyz/KittyPatch/kitty/releases>`__. If you are on macOS, download
the :file:`.dmg` and install as normal. If you are on Linux, download the
tarball and extract it into a directory. The |kitty| executable will be in the
:file:`bin` sub-directory.
Desktop integration on Linux
--------------------------------
@@ -48,18 +47,31 @@ particular desktop, but it should work for most major desktop environments.
.. code-block:: sh
# Create a symbolic link to add kitty to PATH (assuming ~/.local/bin is in
# your PATH)
ln -s ~/.local/kitty.app/bin/kitty ~/.local/bin/
# Create symbolic links to add kitty and kitten to PATH (assuming ~/.local/bin is in
# your system-wide PATH)
ln -sf ~/.local/kitty.app/bin/kitty ~/.local/kitty.app/bin/kitten ~/.local/bin/
# Place the kitty.desktop file somewhere it can be found by the OS
cp ~/.local/kitty.app/share/applications/kitty.desktop ~/.local/share/applications/
# Update the path to the kitty icon in the kitty.desktop file
sed -i "s|Icon=kitty|Icon=/home/$USER/.local/kitty.app/share/icons/hicolor/256x256/apps/kitty.png|g" ~/.local/share/applications/kitty.desktop
# If you want to open text files and images in kitty via your file manager also add the kitty-open.desktop file
cp ~/.local/kitty.app/share/applications/kitty-open.desktop ~/.local/share/applications/
# Update the paths to the kitty and its icon in the kitty.desktop file(s)
sed -i "s|Icon=kitty|Icon=/home/$USER/.local/kitty.app/share/icons/hicolor/256x256/apps/kitty.png|g" ~/.local/share/applications/kitty*.desktop
sed -i "s|Exec=kitty|Exec=/home/$USER/.local/kitty.app/bin/kitty|g" ~/.local/share/applications/kitty*.desktop
.. note::
If you use the venerable `stow <https://www.gnu.org/software/stow/>`_
In :file:`kitty-open.desktop`, kitty is registered to handle some supported
MIME types. This will cause kitty to take precedence on some systems where
the default apps are not explicitly set. For example, you expect to use
other GUI file managers to open dir paths when using commands such as
:program:`xdg-open`, you should configure the default opener for the MIME
type ``inode/directory``::
xdg-mime default org.kde.dolphin.desktop inode/directory
.. note::
If you use the venerable `stow <https://www.gnu.org/software/stow/>`__
command to manage your manual installations, the following takes care of the
above for you (use with :file:`dest=~/.local/stow`)::
above for you (use with :code:`dest=~/.local/stow`)::
cd ~/.local/stow
stow -v kitty.app
@@ -72,44 +84,39 @@ Customizing the installation
* You can install the latest nightly kitty build with ``installer``:
.. parsed-literal::
:class: pre
.. code-block:: sh
|ins| \\
_kitty_install_cmd \
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
.. code-block:: sh
|ins| \\
_kitty_install_cmd \
installer=nightly dest=/some/other/location
* You can specify a different install location, with ``dest``:
.. parsed-literal::
:class: pre
.. code-block:: sh
|ins| \\
_kitty_install_cmd \
dest=/some/other/location
* You can tell the installer not to launch |kitty| after installing it with
``launch=n``:
.. parsed-literal::
:class: pre
.. code-block:: sh
|ins| \\
_kitty_install_cmd \
launch=n
* You can use a previously downloaded dmg/tarball, with ``installer``:
.. parsed-literal::
:class: pre
.. code-block:: sh
|ins| \\
_kitty_install_cmd \
installer=/path/to/dmg or tarball

View File

@@ -1,27 +1,27 @@
Build from source
==================
.. image:: https://github.com/kovidgoyal/kitty/workflows/CI/badge.svg
.. image:: https://gitea.rexy712.xyz/KittyPatch/kitty/workflows/CI/badge.svg
:alt: Build status
:target: https://github.com/kovidgoyal/kitty/actions?query=workflow%3ACI
:target: https://gitea.rexy712.xyz/KittyPatch/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.
|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
If you just want to test the latest changes to kitty, you don't 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
build kitty at all, instead, assuming you have installed the official kitty
binaries, you can simply set the KITTY_DEVELOP_FROM enviroment variable to
point to the directory into which you have checked out the kitty source
code. kitty will then load its python code from there. You should use a
version of the source that matches the binary version as closely as
possible, since the two are tightly coupled.
If you are making small changes only to the Python parts of kitty, there is
no need to build kitty at all, instead, assuming you have installed the
official kitty binaries, you can simply set the :envvar:`KITTY_DEVELOP_FROM`
enviroment variable to point to the directory into which you have checked out
the kitty source code. kitty will then load its Python code from there. You
should use a version of the source that matches the binary version as closely
as possible, since the two are tightly coupled.
Dependencies
@@ -29,24 +29,27 @@ Dependencies
Run-time dependencies:
* ``python`` >= 3.6
* ``python`` >= 3.8
* ``harfbuzz`` >= 2.2.0
* ``zlib``
* ``libpng``
* ``liblcms2``
* ``librsync``
* ``openssl``
* ``freetype`` (not needed on macOS)
* ``fontconfig`` (not needed on macOS)
* ``libcanberra`` (not needed on macOS)
* ``ImageMagick`` (optional, needed to use the ``kitty +kitten icat`` tool to display images in the terminal)
* ``pygments`` (optional, needed for syntax highlighting in ``kitty +kitten diff``)
* ``ImageMagick`` (optional, needed to display uncommon image formats in the terminal)
Build-time dependencies:
* ``gcc`` or ``clang``
* ``go`` >= _build_go_version (see :file:`go.mod` for go packages used during building)
* ``pkg-config``
* 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:
* 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``
@@ -58,6 +61,7 @@ Build-time dependencies:
- ``libfontconfig-dev``
- ``libx11-xcb-dev``
- ``liblcms2-dev``
- ``libssl-dev``
- ``libpython3-dev``
- ``librsync-dev``
@@ -67,7 +71,7 @@ Install and run from source
.. code-block:: sh
git clone https://github.com/kovidgoyal/kitty && cd kitty
git clone https://gitea.rexy712.xyz/KittyPatch/kitty && cd kitty
Now build the native code parts of |kitty| with the following command::
@@ -77,9 +81,12 @@ You can run |kitty|, as::
./kitty/launcher/kitty
If that works, you can create a symlink to the launcher in :file:`~/bin` or
some other directory on your PATH so that you can run |kitty| using
just ``kitty``.
If that works, you can create a symlink to the launcher in :file:`~/bin` or some
other directory on your PATH so that you can run |kitty| using just ``kitty``.
To have the kitty documentation available locally, run::
python3 -m pip install -r docs/requirements.txt && make docs
Building kitty.app on macOS from source
@@ -87,28 +94,30 @@ Building kitty.app on macOS from source
Run::
python3 -m pip install -r docs/requirements.txt && make docs
make app
Building the docs needs to be done only once.
This :file:`kitty.app` unlike the released one does not include its own copy of
python and the other dependencies. So if you ever un-install/upgrade those dependencies
you might have to rebuild the app.
Python and the other dependencies. So if you ever un-install/upgrade those
dependencies you might have to rebuild the app.
.. note::
The released :file:`kitty.dmg` includes all dependencies, unlike the
:file:`kitty.app` built above and is built automatically by using the
`bypy framework <https://github.com/kovidgoyal/bypy>`_ however, that is
`bypy framework <https://gitea.rexy712.xyz/KittyPatch/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>`_.
Apple disallows certain functionality, such as notifications for unsigned
applications. If you need this functionality, you can try signing the built
:file:`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.
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
@@ -116,89 +125,78 @@ Build and run from source with Nix
On NixOS or any other Linux or macOS system with the Nix package manager
installed, execute `nix-shell
<https://nixos.org/guides/nix-pills/developing-with-nix-shell.html>`_ to create
<https://nixos.org/guides/nix-pills/developing-with-nix-shell.html>`__ to create
the correct environment to build kitty or use ``nix-shell --pure`` instead to
eliminate most of the influence of the outside system, e.g. globally installed
packages. ``nix-shell`` will automatically fetch all required dependencies and
make them available in the newly spawned shell.
Then proceed with ``make`` or ``make app`` according to the platform specific instructions above.
Then proceed with ``make`` or ``make app`` according to the platform specific
instructions above.
Debug builds
--------------
A basic debug build can be done with::
make debug
This includes debug info in the binary for better traces. To build with address
sanitizer, use::
make asan
Which will result in a debug binary that uses the address sanitizer as well.
.. _packagers:
Notes for Linux/macOS packagers
----------------------------------
The released |kitty| source code is available as a `tarball`_ from
`the GitHub releases page <https://github.com/kovidgoyal/kitty/releases>`_.
`the GitHub releases page <https://gitea.rexy712.xyz/KittyPatch/kitty/releases>`__.
While |kitty| does use python, it is not a traditional python package, so please
While |kitty| does use Python, it is not a traditional Python package, so please
do not install it in site-packages.
Instead run::
python3 setup.py linux-package
make linux-package
This will install |kitty| into the directory :file:`linux-package`. You can run |kitty|
with :file:`linux-package/bin/kitty`. All the files needed to run kitty will be in
:file:`linux-package/lib/kitty`. The terminfo file will be installed into
:file:`linux-package/share/terminfo`. Simply copy these files into :file:`/usr` to install
|kitty|. In other words, :file:`linux-package` is the staging area into which |kitty| is
installed. You can choose a different staging area, by passing the ``--prefix``
argument to :file:`setup.py`.
This will install |kitty| into the directory :file:`linux-package`. You can run
|kitty| with :file:`linux-package/bin/kitty`. All the files needed to run kitty
will be in :file:`linux-package/lib/kitty`. The terminfo file will be installed
into :file:`linux-package/share/terminfo`. Simply copy these files into
:file:`/usr` to install |kitty|. In other words, :file:`linux-package` is the
staging area into which |kitty| is installed. You can choose a different staging
area, by passing the ``--prefix`` argument to :file:`setup.py`.
You should probably split |kitty| into three packages:
:code:`kitty-terminfo`
installs the terminfo file
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
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
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|.
servers into which they ssh, without needing to install all of |kitty|. The
shell integration files **must** still be present in
:file:`lib/kitty/shell-integration` when installing the kitty main package as
the kitty program expects to find them there.
.. note::
You need a couple of extra dependencies to build linux-package.
:file:`tic` to compile terminfo files, usually found in the
development package of :file:`ncurses`. Also, if you are building from
a git checkout instead of the released source code tarball, you will
need to install the dependencies from ``docs/requirements.txt`` to
build the kitty documentation. They can be installed most easily with
``python -m pip -r docs/requirements.txt``.
You need a couple of extra dependencies to build linux-package. :file:`tic`
to compile terminfo files, usually found in the development package of
:file:`ncurses`. Also, if you are building from a git checkout instead of the
released source code tarball, you will need to install the dependencies from
:file:`docs/requirements.txt` to build the kitty documentation. They can be
installed most easily with ``python -m pip -r docs/requirements.txt``.
This applies to creating packages for |kitty| for macOS package managers such as
brew or MacPorts as well.
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::
./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.
Homebrew or MacPorts as well.

View File

@@ -9,23 +9,15 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
Recent major new features
---------------------------
.. only:: dirhtml
Truly convenient SSH
~~~~~~~~~~~~~~~~~~~~~~~~
A demo video
~~~~~~~~~~~~~~~~
The :doc:`ssh kitten <kittens/ssh>` is redesigned with powerful new features:
A new video showcasing some of kitty's many productivity enhancing features.
.. raw:: html
<video controls width="640" height="360" poster="../_static/poster.png">
<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!
* Automatic :ref:`shell_integration` on remote machines
* Easily :ref:`clone local shell/editor config <real_world_ssh_kitten_config>` on remote machines
* Easily :ref:`edit files in your local editor <edit_file>` on remote machines
* Automatic :opt:`re-use of existing connections <kitten-ssh.share_connections>` to avoid connection setup latency
Shell integration
@@ -38,43 +30,613 @@ 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.28.2 [future]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- A new escape code ``<ESC>[22J`` that moves the current contents of the screen into the scrollback before clearing it
- unicode_input kitten: Fix a regression in 0.28.0 that caused the order of recent and favorites entries to not be respected (:iss:`6214`)
- unicode_input kitten: Fix a regression in 0.28.0 that caused editing of favorites to sometimes hang
- clipboard kitten: Fix a bug causing the last MIME type available on the clipboard not being recognized when pasting
- Fix regression in 0.28.0 causing color fringing when rendering in transparent windows on light backgrounds (:iss:`6209`)
- show_key kitten: In kitty mode show the actual bytes sent by the terminal rather than a re-encoding of the parsed key event
- hints kitten: Fix a regression in 0.28.0 that broke using sub-groups in regexp captures (:iss:`6228`)
- hints kitten: Fix a regression in 0.28.0 that broke using lookahead/lookbehind in regexp captures (:iss:`6265`)
- diff kitten: Fix a regression in 0.28.0 that broke using relative paths as arguments to the kitten (:iss:`6325`)
- Fix re-using the image id of an animated image for a still image causing a crash (:iss:`6244`)
- kitty +open: Ask for permission before executing script files that are not marked as executable. This prevents accidental execution
of script files via MIME type association from programs that unconditionally "open" attachments/downloaded files
- edit-in-kitty: Fix running edit-in-kitty with elevated privileges to edit a restricted file not working (:disc:`6245`)
- ssh kitten: Fix a regression in 0.28.0 that caused interrupt during setup to not be handled gracefully (:iss:`6254`)
0.28.1 [2023-04-21]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Fix a regression in the previous release that broke the remote file kitten (:iss:`6186`)
- Fix a regression in the previous release that broke handling of some keyboard shortcuts in some kittens on some keyboard layouts (:iss:`6189`)
- Fix a regression in the previous release that broke usage of custom themes (:iss:`6191`)
0.28.0 [2023-04-15]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- **Text rendering change**: Use sRGB correct linear gamma blending for nicer font
rendering and better color accuracy with transparent windows.
See the option :opt:`text_composition_strategy` for details.
The obsolete :opt:`macos_thicken_font` will make the font too thick and needs to be removed manually
if it is configured. (:pull:`5969`)
- icat kitten: Support display of images inside tmux >= 3.3 (:pull:`5664`)
- Graphics protocol: Add support for displaying images inside programs that do not support the protocol such as vim and tmux (:pull:`5664`)
- diff kitten: Add support for selecting multi-line text with the mouse
- Fix a regression in 0.27.0 that broke ``kitty @ set-font-size 0`` (:iss:`5992`)
- launch: When using ``--cwd=current`` for a remote system support running non shell commands as well (:disc:`5987`)
- When changing the cursor color via escape codes or remote control to a fixed color, do not reset cursor_text_color (:iss:`5994`)
- Input Method Extensions: Fix incorrect rendering of IME in-progress and committed text in some situations (:pull:`6049`, :pull:`6087`)
- Linux: Reduce minimum required OpenGL version from 3.3 to 3.1 + extensions (:iss:`2790`)
- Fix a regression that broke drawing of images below cell backgrounds (:iss:`6061`)
- macOS: Fix the window buttons not being hidden after exiting the traditional full screen (:iss:`6009`)
- When reloading configuration, also reload custom MIME types from :file:`mime.types` config file (:pull:`6012`)
- launch: Allow specifying the state (full screen/maximized/minimized) for newly created OS Windows (:iss:`6026`)
- Sessions: Allow specifying the OS window state via the ``os_window_state`` directive (:iss:`5863`)
- macOS: Display the newly created OS window in specified state to avoid or reduce the window transition animations (:pull:`6035`)
- macOS: Fix the maximized window not taking up full space when the title bar is hidden or when :opt:`resize_in_steps` is configured (:iss:`6021`)
- Linux: A new option :opt:`linux_bell_theme` to control which sound theme is used for the bell sound (:pull:`4858`)
- ssh kitten: Change the syntax of glob patterns slightly to match common usage
elsewhere. Now the syntax is the same as "extendedglob" in most shells.
- hints kitten: Allow copying matches to named buffers (:disc:`6073`)
- Fix overlay windows not inheriting the per-window padding and margin settings
of their parents (:iss:`6063`)
- Wayland KDE: Fix selecting in un-focused OS window not working correctly (:iss:`6095`)
- Linux X11: Fix a crash if the X server requests clipboard data after we have relinquished the clipboard (:iss:`5650`)
- Allow stopping of URL detection at newlines via :opt:`url_excluded_characters` (:iss:`6122`)
- Linux Wayland: Fix animated images not being animated continuously (:iss:`6126`)
- Keyboard input: Fix text not being reported as unicode codepoints for multi-byte characters in the kitty keyboard protocol (:iss:`6167`)
0.27.1 [2023-02-07]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Fix :opt:`modify_font` not working for strikethrough position (:iss:`5946`)
- Fix a regression causing the ``edit-in-kitty`` command not working if :file:`kitten` is not added
to PATH (:iss:`5956`)
- icat kitten: Fix a regression that broke display of animated GIFs over SSH (:iss:`5958`)
- Wayland GNOME: Fix for ibus not working when using XWayland (:iss:`5967`)
- Fix regression in previous release that caused incorrect entries in terminfo for modifier+F3 key combinations (:pull:`5970`)
- Bring back the deprecated and removed ``kitty +complete`` and delegate it to :program:`kitten` for backward compatibility (:pull:`5977`)
- Bump the version of Go needed to build kitty to ``1.20`` so we can use the Go stdlib ecdh package for crypto.
0.27.0 [2023-01-31]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- A new statically compiled, standalone executable, ``kitten`` (written in Go)
that can be used on all UNIX-like servers for remote control (``kitten @``),
viewing images (``kitten icat``), manipulating the clipboard (``kitten clipboard``), etc.
- :doc:`clipboard kitten </kittens/clipboard>`: Allow copying arbitrary data types to/from the clipboard, not just plain text
- Speed up the ``kitty @`` executable by ~10x reducing the time for typical
remote control commands from ~50ms to ~5ms
- icat kitten: Speed up by using POSIX shared memory when possible to transfer
image data to the terminal. Also support common image formats
GIF/PNG/JPEG/WEBP/TIFF/BMP out of the box without needing ImageMagick.
- Option :opt:`show_hyperlink_targets` to show the target of terminal hyperlinks when hovering over them with the mouse (:pull:`5830`)
- Keyboard protocol: Remove ``CSI R`` from the allowed encodings of the :kbd:`F3` key as it conflicts with the *Cursor Position Report* escape code (:disc:`5813`)
- Allow using the cwd of the original process for :option:`launch --cwd` (:iss:`5672`)
- Session files: Expand environment variables (:disc:`5917`)
- Pass key events mapped to scroll actions to the program running in the terminal when the terminal is in alternate screen mode (:iss:`5839`)
- Implement :ref:`edit-in-kitty <edit_file>` using the new ``kitten`` static executable (:iss:`5546`, :iss:`5630`)
- Add an option :opt:`background_tint_gaps` to control background image tinting for window gaps (:iss:`5596`)
- A new option :opt:`undercurl_style` to control the rendering of undercurls (:pull:`5883`)
- Bash integration: Fix ``clone-in-kitty`` not working on bash >= 5.2 if environment variable values contain newlines or other special characters (:iss:`5629`)
- A new :ac:`sleep` action useful in combine based mappings to make kitty sleep before executing the next action
- Wayland GNOME: Workaround for latest mutter release breaking full screen for semi-transparent kitty windows (:iss:`5677`)
- A new option :opt:`tab_title_max_length` to limit the length of tab (:iss:`5718`)
- When drawing the tab bar have the default left and right margins drawn in a color matching the neighboring tab (:iss:`5719`)
- When using the :code:`include` directive in :file:`kitty.conf` make the environment variable :envvar:`KITTY_OS` available for OS specific config
- Wayland: Fix signal handling not working with some GPU drivers (:iss:`4636`)
- Remote control: When matching windows allow using negative id numbers to match recently created windows (:iss:`5753`)
- ZSH Integration: Bind :kbd:`alt+left` and :kbd:`alt+right` to move by word if not already bound. This mimics the default bindings in Terminal.app (:iss:`5793`)
- macOS: Allow to customize :sc:`Hide <hide_macos_app>`, :sc:`Hide Others <hide_macos_other_apps>`, :sc:`Minimize <minimize_macos_window>`, and :sc:`Quit <quit>` global menu shortcuts. Note that :opt:`clear_all_shortcuts` will remove these shortcuts now (:iss:`948`)
- When a multi-key sequence does not match any action, send all key events to the child program (:pull:`5841`)
- broadcast kitten: Allow pressing a key to stop echoing of input into the broadcast window itself (:disc:`5868`)
- When reporting unused activity in a window, ignore activity that occurs soon after a window resize (:iss:`5881`)
- Fix using :opt:`cursor` = ``none`` not working on text that has reverse video (:iss:`5897`)
- Fix ssh kitten not working on FreeBSD (:iss:`5928`)
- macOS: Export kitty selected text to the system for use with services that accept it (patch by Sertaç Ö. Yıldız)
0.26.5 [2022-11-07]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Splits layout: Add a new mappable action to move the active window to the screen edge (:iss:`5643`)
- ssh kitten: Allow using absolute paths for the location of transferred data (:iss:`5607`)
- Fix a regression in the previous release that caused a :opt:`resize_draw_strategy` of ``static`` to not work (:iss:`5601`)
- Wayland KDE: Fix abort when pasting into Firefox (:iss:`5603`)
- Wayland GNOME: Fix ghosting when using :opt:`background_tint` (:iss:`5605`)
- Fix cursor position at x=0 changing to x=1 on resize (:iss:`5635`)
- Wayland GNOME: Fix incorrect window size in some circumstances when switching between windows with window decorations disabled (:iss:`4802`)
- Wayland: Fix high CPU usage when using some input methods (:pull:`5369`)
- Remote control: When matching window by `state:focused` and no window currently has keyboard focus, match the window belonging to the OS window that was last focused (:iss:`5602`)
0.26.4 [2022-10-17]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- macOS: Allow changing the kitty icon by placing a custom icon in the kitty config folder (:pull:`5464`)
- Allow centering the :opt:`background_image` (:iss:`5525`)
- X11: Fix a regression in the previous release that caused pasting from GTK based applications to have extra newlines (:iss:`5528`)
- Tab bar: Improve empty space management when some tabs have short titles, allocate the saved space to the active tab (:iss:`5548`)
- Fix :opt:`background_tint` not applying to window margins and padding (:iss:`3933`)
- Wayland: Fix background image scaling using tiled mode on high DPI screens
- Wayland: Fix an abort when changing background colors with :opt:`wayland_titlebar_color` set to ``background`` (:iss:`5562`)
- Update to Unicode 15.0 (:pull:`5542`)
- GNOME Wayland: Fix a memory leak in gnome-shell when using client side decorations
0.26.3 [2022-09-22]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Wayland: Mark windows in which a bell occurs as urgent on compositors that support the xdg-activation protocol
- Allow passing null bytes through the system clipboard (:iss:`5483`)
- ssh kitten: Fix :envvar:`KITTY_PUBLIC_KEY` not being encoded properly when transmitting (:iss:`5496`)
- Sessions: Allow controlling which OS Window is active via the ``focus_os_window`` directive
- Wayland: Fix for bug in NVIDIA drivers that prevents transparency working (:iss:`5479`)
- Wayland: Fix for a bug that could cause kitty to become non-responsive when
using multiple OS windows in a single instance on some compositors (:iss:`5495`)
- Wayland: Fix for a bug preventing kitty from starting on Hyprland when using a non-unit scale (:iss:`5467`)
- Wayland: Generate a XDG_ACTIVATION_TOKEN when opening URLs or running programs in the background via the launch action
- Fix a regression that caused kitty not to restore SIGPIPE after python nukes it when launching children. Affects bash which does not sanitize its signal mask. (:iss:`5500`)
- Fix a use-after-free when handling fake mouse clicks and the action causes windows to be removed/re-allocated (:iss:`5506`)
0.26.2 [2022-09-05]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Allow creating :code:`overlay-main` windows, which are treated as the active window unlike normal overlays (:iss:`5392`)
- hints kitten: Allow using :doc:`launch` as the program to run, to open the result in a new kitty tab/window/etc. (:iss:`5462`)
- hyperlinked_grep kitten: Allow control over which parts of ``rg`` output are hyperlinked (:pull:`5428`)
- Fix regression in 0.26.0 that caused launching kitty without working STDIO handles to result in high CPU usage and prewarming failing (:iss:`5444`)
- :doc:`/launch`: Allow setting the margin and padding for newly created windows (:iss:`5463`)
- macOS: Fix regression in 0.26.0 that caused asking the user for a line of input such as for :ac:`set_tab_title` to not work (:iss:`5447`)
- hints kitten: hyperlink matching: Fix hints occasionally matching text on subsequent line as part of hyperlink (:pull:`5450`)
- Fix a regression in 0.26.0 that broke mapping of native keys whose key codes did not fit in 21 bits (:iss:`5452`)
- Wayland: Fix remembering window size not accurate when client side decorations are present
- Fix an issue where notification identifiers were not sanitized leading to
code execution if the user clicked on a notification popup from a malicious
source. Thanks to Carter Sande for discovering this vulnerability.
0.26.1 [2022-08-30]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ssh kitten: Fix executable permission missing from kitty bootstrap script (:iss:`5438`)
- Fix a regression in 0.26.0 that caused kitty to no longer set the ``LANG`` environment variable on macOS (:iss:`5439`)
- Allow specifying a title when using the :ac:`set_tab_title` action (:iss:`5441`)
0.26.0 [2022-08-29]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- A new option :opt:`remote_control_password` to use fine grained permissions for what can be remote controlled (:disc:`5320`)
- Reduce startup latency by ~30 milliseconds when running kittens via key bindings inside kitty (:iss:`5159`)
- A new option :opt:`modify_font` to adjust various font metrics like underlines, cell sizes etc. (:pull:`5265`)
- A new shortcut :sc:`show_kitty_doc` to display the kitty docs in a browser
- Graphics protocol: Only delete temp files if they have the string
:code:`tty-graphics-protocol` in their file paths. This prevents deletion of arbitrary files in :file:`/tmp`.
- Deprecate the ``adjust_baseline``, ``adjust_line_height`` and ``adjust_column_width`` options in favor of :opt:`modify_font`
- Wayland: Fix a regression in the previous release that caused mouse cursor
animation and keyboard repeat to stop working when switching seats (:iss:`5188`)
- Allow resizing windows created in session files (:pull:`5196`)
- Fix horizontal wheel events not being reported to client programs when they grab the mouse (:iss:`2819`)
- macOS: Remote control: Fix unable to launch a new OS window or background process when there is no OS window (:iss:`5210`)
- macOS: Fix unable to open new tab or new window when there is no OS window (:iss:`5276`)
- kitty @ set-colors: Fix changing inactive_tab_foreground not working (:iss:`5214`)
- macOS: Fix a regression that caused switching keyboard input using Eisu and
Kana keys not working (:iss:`5232`)
- Add a mappable action to toggle the mirrored setting for the tall and fat
layouts (:pull:`5344`)
- Add a mappable action to switch between predefined bias values for the tall and fat
layouts (:pull:`5352`)
- Wayland: Reduce flicker at startup by not using render frames immediately after a resize (:iss:`5235`)
- Linux: Update cursor position after all key presses not just pre-edit text
changes (:iss:`5241`)
- ssh kitten: Allow ssh kitten to work from inside tmux, provided the tmux
session inherits the correct KITTY env vars (:iss:`5227`)
- ssh kitten: A new option :code:`--symlink-strategy` to control how symlinks
are copied to the remote machine (:iss:`5249`)
- ssh kitten: Allow pressing :kbd:`Ctrl+C` to abort ssh before the connection is
completed (:iss:`5271`)
- Bash integration: Fix declare not creating global variables in .bashrc (:iss:`5254`)
- Bash integration: Fix the inherit_errexit option being set by shell integration (:iss:`5349`)
- :command:`kitty @ scroll-window` allow scrolling by fractions of a screen
(:iss:`5294`)
- remote files kitten: Fix working with files whose names have characters that
need to be quoted in shell scripts (:iss:`5313`)
- Expand ~ in paths configured in :opt:`editor` and :opt:`exe_search_path` (:disc:`5298`)
- Allow showing the working directory of the active window in tab titles
(:pull:`5314`)
- ssh kitten: Allow completion of ssh options between the destination and command (:iss:`5322`)
- macOS: Fix speaking selected text not working (:iss:`5357`)
- Allow ignoring failure to close windows/tabs via rc commands (:disc:`5406`)
- Fix hyperlinks not present when fetching text from the history buffer
(:iss:`5427`)
0.25.2 [2022-06-07]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- A new command :command:`edit-in-kitty` to :ref:`edit_file`
- Allow getting the last non-empty command output easily via an action or
remote control (:pull:`4973`)
- Fix a bug that caused :opt:`macos_colorspace` to always be ``default`` regardless of its actual value (:iss:`5129`)
- diff kitten: A new option :opt:`kitten-diff.ignore_name` to exclude files and directories from being scanned (:pull:`5171`)
- ssh kitten: Fix bash not being executed as a login shell since kitty 0.25.0 (:iss:`5130`)
- macOS: When pasting text and the clipboard has a filesystem path, paste the
full path instead of the text, which is sometimes just the file name (:pull:`5142`)
- macOS: Allow opening executables without a file extension with kitty as well
(:iss:`5160`)
- Themes kitten: Add a tab to show user defined custom color themes separately
(:pull:`5150`)
- Iosevka: Fix incorrect rendering when there is a combining char that does not
group with its neighbors (:iss:`5153`)
- Weston: Fix client side decorations flickering on slow computers during
window resize (:iss:`5162`)
- Remote control: Fix commands with large or asynchronous payloads like
:command:`kitty @ set-backround-image`, :command:`kitty @ set-window-logo`
and :command:`kitty @ select-window` not working correctly
when using a socket (:iss:`5165`)
- hints kitten: Fix surrounding quotes/brackets and embedded carriage returns
not being removed when using line number processing (:iss:`5170`)
0.25.1 [2022-05-26]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Shell integration: Add a command to :ref:`clone_shell`
- Remote control: Allow using :ref:`Boolean operators <search_syntax>` when constructing queries to match windows or tabs
- Sessions: Fix :code:`os_window_size` and :code:`os_window_class` not applying to the first OS Window (:iss:`4957`)
- Allow using the cwd of the oldest as well as the newest foreground process for :option:`launch --cwd` (:disc:`4869`)
- Bash integration: Fix the value of :opt:`shell_integration` not taking effect if the integration script is sourced in bashrc (:pull:`4964`)
- Fix a regression in the previous release that caused mouse move events to be incorrectly reported as drag events even when a button is not pressed (:iss:`4992`)
- remote file kitten: Integrate with the ssh kitten for improved performance
and robustness. Re-uses the control master connection of the ssh kitten to
avoid round-trip latency.
- Fix tab selection when closing a new tab not correct in some scenarios (:iss:`4987`)
- A new action :ac:`open_url` to open the specified URL (:pull:`5004`)
- A new option :opt:`select_by_word_characters_forward` that allows changing
which characters are considered part of a word to the right when double clicking to select
words (:pull:`5103`)
- macOS: Make the global menu shortcut to open kitty website configurable (:pull:`5004`)
- macOS: Add the :opt:`macos_colorspace` option to control what color space colors are rendered in (:iss:`4686`)
- Fix reloading of config not working when :file:`kitty.conf` does not exist when kitty is launched (:iss:`5071`)
- Fix deleting images by row not calculating image bounds correctly (:iss:`5081`)
- Increase the max number of combining chars per cell from two to three, without increasing memory usage.
- Linux: Load libfontconfig at runtime to allow the binaries to work for
running kittens on servers without FontConfig
- GNOME: Fix for high CPU usage caused by GNOME's text input subsystem going
into an infinite loop when IME cursor position is updated after a done event
(:iss:`5105`)
0.25.0 [2022-04-11]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- :doc:`kittens/ssh`: automatic shell integration when using SSH. Easily
clone local shell and editor configuration on remote machines, and automatic
re-use of existing connections to avoid connection setup latency.
- When pasting URLs at shell prompts automatically quote them. Also allow filtering pasted text and confirm pastes. See :opt:`paste_actions` for details. (:iss:`4873`)
- Change the default value of :opt:`confirm_os_window_close` to ask for confirmation when closing windows that are not sitting at shell prompts
- A new value :code:`last_reported` for :option:`launch --cwd` to use the current working directory last reported by the program running in the terminal
- macOS: When using Apple's less as the pager for viewing scrollback strip out OSC codes as it cant parse them (:iss:`4788`)
- diff kitten: Fix incorrect rendering in rare circumstances when scrolling after changing the context size (:iss:`4831`)
- icat kitten: Fix a regression that broke :option:`kitty +kitten icat --print-window-size` (:pull:`4818`)
- Wayland: Fix :opt:`hide_window_decorations` causing docked windows to be resized on blur (:iss:`4797`)
- Bash integration: Prevent shell integration code from running twice if user enables both automatic and manual integration
- Bash integration: Handle existing PROMPT_COMMAND ending with a literal newline
- Fix continued lines not having their continued status reset on line feed (:iss:`4837`)
- macOS: Allow the New kitty Tab/Window Here services to open multiple selected folders. (:pull:`4848`)
- Wayland: Fix a regression that broke IME when changing windows/tabs (:iss:`4853`)
- macOS: Fix Unicode paths not decoded correctly when dropping files (:pull:`4879`)
- Avoid flicker when starting kittens such as the hints kitten (:iss:`4674`)
- A new action :ac:`scroll_prompt_to_top` to move the current prompt to the top (:pull:`4891`)
- :ac:`select_tab`: Use stable numbers when selecting the tab (:iss:`4792`)
- Only check for updates in the official binary builds. Distro packages or source builds will no longer check for updates, regardless of the
value of :opt:`update_check_interval`.
- Fix :opt:`inactive_text_alpha` still being applied to the cursor hidden window after focus (:iss:`4928`)
- Fix resizing window that is extra tall/wide because of left-over cells not
working reliably (:iss:`4913`)
- A new action :ac:`close_other_tabs_in_os_window` to close other tabs in the active OS window (:pull:`4944`)
0.24.4 [2022-03-03]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Shell integration: Fix the default Bash :code:`$HISTFILE` changing to :file:`~/.sh_history` instead of :file:`~/.bash_history` (:iss:`4765`)
- Linux binaries: Fix binaries not working on systems with older Wayland client libraries (:iss:`4760`)
- Fix a regression in the previous release that broke kittens launched with :code:`STDIN` not connected to a terminal (:iss:`4763`)
- Wayland: Fix surface configure events not being acknowledged before commit
the resized buffer (:pull:`4768`)
0.24.3 [2022-02-28]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Bash integration: No longer modify :file:`~/.bashrc` to load :ref:`shell integration <shell_integration>`.
It is recommended to remove the lines used to load the shell integration from :file:`~/.bashrc` as they are no-ops.
- macOS: Allow kitty to handle various URL types. Can be configured via
:ref:`launch_actions` (:pull:`4618`)
- macOS: Add a new service ``Open with kitty`` to open file types that are not
recognized by the system (:pull:`4641`)
- Splits layout: A new value for :option:`launch --location` to auto-select the split axis when splitting existing windows.
Wide windows are split side-by-side and tall windows are split one-above-the-other
- hints kitten: Fix a regression that broke recognition of path:linenumber:colnumber (:iss:`4675`)
- Fix a regression in the previous release that broke :opt:`active_tab_foreground` (:iss:`4620`)
- Fix :ac:`show_last_command_output` not working when the output is stored
partially in the scrollback pager history buffer (:iss:`4435`)
- When dropping URLs/files onto kitty at a shell prompt insert them appropriately quoted and space
separated (:iss:`4734`)
- Improve CWD detection when there are multiple foreground processes in the TTY process group
- A new option :opt:`narrow_symbols` to turn off opportunistic wide rendering of private use codepoints
- ssh kitten: Fix location of generated terminfo files on NetBSD (:iss:`4622`)
- A new action to clear the screen up to the line containing the cursor, see
:ac:`clear_terminal`
- A new action :ac:`copy_ansi_to_clipboard` to copy the current selection with ANSI formatting codes
(:iss:`4665`)
- Linux: Do not rescale fallback fonts to match the main font cell height, instead just
set the font size and let FreeType take care of it. This matches
rendering on macOS (:iss:`4707`)
- macOS: Fix a regression in the previous release that broke switching input
sources by keyboard (:iss:`4621`)
- macOS: Add the default shortcut :kbd:`cmd+k` to clear the terminal screen and
scrollback up to the cursor (:iss:`4625`)
- Fix a regression in the previous release that broke strikethrough (:disc:`4632`)
- A new action :ac:`scroll_prompt_to_bottom` to move the current prompt
to the bottom, filling in the window from the scrollback (:pull:`4634`)
- Add two special arguments ``@first-line-on-screen`` and ``@last-line-on-screen``
for the :doc:`launch <launch>` command to be used for pager positioning.
(:iss:`4462`)
- Linux: Fix rendering of emoji when using scalable fonts such as Segoe UI Emoji
- Shell integration: bash: Dont fail if an existing PROMPT_COMMAND ends with a semi-colon (:iss:`4645`)
- Shell integration: bash: Fix rendering of multiline prompts with more than two lines (:iss:`4681`)
- Shell integration: fish: Check fish version 3.3.0+ and exit on outdated versions (:pull:`4745`)
- Shell integration: fish: Fix pipestatus being overwritten (:pull:`4756`)
- Linux: Fix fontconfig alias not being used if the aliased font is dual spaced instead of monospaced (:iss:`4649`)
- macOS: Add an option :opt:`macos_menubar_title_max_length` to control the max length of the window title displayed in the global menubar (:iss:`2132`)
- Fix :opt:`touch_scroll_multiplier` also taking effect in terminal programs such as vim that handle mouse events themselves (:iss:`4680`)
- Fix symbol/PUA glyphs loaded via :opt:`symbol_map` instead of as fallbacks not using following spaces to render larger versions (:iss:`4670`)
- macOS: Fix regression in previous release that caused Apple's global shortcuts to not work if they had never been configured on a particular machine (:iss:`4657`)
- Fix a fast *click, move mouse, click* sequence causing the first click event to be discarded (:iss:`4603`)
- Wayland: Fix wheel mice with line based scrolling being incorrectly handled as high precision devices (:iss:`4694`)
- Wayland: Fix touchpads and high resolution wheels not scrolling at the same speed on monitors with different scales (:iss:`4703`)
- Add an option :opt:`wheel_scroll_min_lines` to set the minimum number of lines for mouse wheel scrolling when using a mouse with a wheel that generates very small offsets when slow scrolling (:pull:`4710`)
- macOS: Make the shortcut to toggle full screen configurable (:pull:`4714`)
- macOS: Fix the mouse cursor being set to arrow after switching desktops or toggling full screen (:pull:`4716`)
- Fix copying of selection after selection has been scrolled off history buffer raising an error (:iss:`4713`)
0.24.2 [2022-02-03]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -420,7 +982,7 @@ Detailed list of changes
0.22.0 [2021-07-26]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Add a new :ref:`action-toggle_layout` action to easily zoom/unzoom a window
- Add a new :ac:`toggle_layout` action to easily zoom/unzoom a window
- When right clicking to extend a selection, move the nearest selection
boundary rather than the end of the selection. To restore previous behavior
@@ -490,7 +1052,7 @@ Detailed list of changes
0.21.2 [2021-06-28]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- A new :opt:`adjust_baseline` option to adjust the vertical alignment of text
- A new ``adjust_baseline`` option to adjust the vertical alignment of text
inside a line (:pull:`3734`)
- A new :opt:`url_excluded_characters` option to exclude additional characters
@@ -664,7 +1226,7 @@ Detailed list of changes
scrollback buffer onto the screen. Useful, for example, to restore
the screen after showing completions below the shell prompt.
- A new remote control command :ref:`at_env` to change the default
- A new remote control command :ref:`at-env` to change the default
environment passed to newly created windows (:iss:`3529`)
- Linux: Fix binary kitty builds not able to load fonts in WOFF2 format
@@ -689,7 +1251,7 @@ Detailed list of changes
kitty window title bar
- Fix reading :option:`kitty --session` from ``STDIN`` not working when the
:option:`kitty --detach` option is used (:iss:`3523`)
:code:`kitty --detach` option is used (:iss:`3523`)
- Special case rendering of the few remaining Powerline box drawing chars
(:iss:`3535`)
@@ -1247,6 +1809,7 @@ Detailed list of changes
- Fix :option:`--title` not being applied at window creation time (:iss:`2570`)
0.17.2 [2020-03-29]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1431,6 +1994,7 @@ Detailed list of changes
- When windows are semi-transparent and all contain graphics, correctly render
them. (:iss:`2310`)
0.15.1 [2019-12-21]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1539,6 +2103,7 @@ Detailed list of changes
- Use selection foreground color for underlines as well (:iss:`1982`)
0.14.4 [2019-08-31]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1832,7 +2397,7 @@ Detailed list of changes
- Allow the user to control the resize debounce time via
:opt:`resize_debounce_time`.
- Remote control: Make the :ref:`at_set-font-size` command more capable.
- Remote control: Make the :ref:`at-set-font-size` command more capable.
It can now increment font size and reset it. It also only acts on the
active top-level window, by default (:iss:`1581`)
@@ -1845,6 +2410,7 @@ Detailed list of changes
- Mouse selection: When extending by word, fix extending selection to non-word
characters not working well (:iss:`1616`)
0.13.3 [2019-01-19]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1938,6 +2504,7 @@ Detailed list of changes
- Fix resizing window smaller and then restoring causing some wrapped lines to not
be properly unwrapped (:iss:`1206`)
0.13.0 [2018-12-05]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2035,6 +2602,7 @@ Detailed list of changes
- Fix hover detection of URLs not working when hovering over the first colon
and slash characters in short URLs (:iss:`1201`)
0.12.3 [2018-09-29]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2111,6 +2679,7 @@ Detailed list of changes
- Fix using :opt:`focus_follows_mouse` causing text selection with the
mouse to malfunction when using multiple kitty windows (:iss:`1002`)
0.12.1 [2018-09-08]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2141,7 +2710,7 @@ Detailed list of changes
- Fix a regression in 0.12.0 that broke dynamic resizing of layouts (:iss:`860`)
- Wayland: Allow using the :option:`kitty --class` command line flag
- Wayland: Allow using the :code:`kitty --class` command line flag
to set the app id (:iss:`862`)
- Add completion of the kitty command for the fish shell (:pull:`829`)
@@ -2154,6 +2723,7 @@ Detailed list of changes
- macOS: Diff kitten: Fix syntax highlighting not working because of
a bug in the 0.12.0 macOS package
0.12.0 [2018-09-01]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2184,7 +2754,7 @@ Detailed list of changes
window is not the active window (:iss:`729`)
- Remote control: Allow changing the current window layout with a new
:ref:`at_goto-layout` command (:iss:`845`)
:ref:`at-goto-layout` command (:iss:`845`)
- Remote control: Allow matching windows by the environment variables of their
child process as well
@@ -2664,6 +3234,7 @@ Detailed list of changes
- Fix a crash when getting the contents of the scrollback buffer as text
0.8.1 [2018-03-09]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -2741,6 +3312,7 @@ Detailed list of changes
- Browsing the scrollback buffer now happens in an overlay window instead of a
new window/tab.
0.7.1 [2018-01-31]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

160
docs/clipboard.rst Normal file
View File

@@ -0,0 +1,160 @@
Copying all data types to the clipboard
==============================================
There already exists an escape code to allow terminal programs to
read/write plain text data from the system clipboard, *OSC 52*.
kitty introduces a more advanced protocol that supports:
* Copy arbitrary data including images, rich text documents, etc.
* Allow terminals to ask the user for permission to access the clipboard and
report permission denied
The escape code is *OSC 5522*, an extension of *OSC 52*. The basic format
of the escape code is::
<OSC>5522;metadata;payload<ST>
Here, *metadata* is a colon separated list of key-value pairs and payload is
base64 encoded data. :code:`OSC` is :code:`<ESC>[`.
:code:`ST` is the string terminator, :code:`<ESC>\\`.
Reading data from the system clipboard
----------------------------------------
To read data from the system clipboard, the escape code is::
<OSC>5522;type=read;<base 64 encoded space separated list of mime types to read><ST>
For example, to read plain text and PNG data, the payload would be::
text/plain image/png
encoded as base64. To read from the primary selection instead of the
clipboard, add the key ``loc=primary`` to the metadata section.
To get the list of MIME types available on the clipboard the payload must be
just a period (``.``), encoded as base64.
The terminal emulator will reply with a sequence of escape codes of the form::
<OSC>5522;type=read:status=OK<ST>
<OSC>5522;type=read:status=DATA:mime=<base 64 encoded mime type>;<base64 encoded data><ST>
<OSC>5522;type=read:status=DATA:mime=<base 64 encoded mime type>;<base64 encoded data><ST>
.
.
.
<OSC>5522;type=read:status=DONE<ST>
Here, the ``status=DATA`` packets deliver the data (as base64 encoded bytes)
associated with each MIME type. The terminal emulator should chunk up the data
for an individual type. A recommended size for each chunk is 4096 bytes. All
the chunks for a given type must be transmitted sequentially and only once they
are done the chunks for the next type, if any, should be sent. The end of data
is indicated by a ``status=DONE`` packet.
If an error occurs, instead of the opening ``status=OK`` packet the terminal
must send a ``status=ERRORCODE`` packet. The error code must be one of:
``status=ENOSYS``
Sent if the requested clipboard type is not available. For example, primary
selection is not available on all systems and ``loc=primary`` was used.
``status=EPERM``
Sent if permission to read from the clipboard was denied by the system or
the user.
``status=EBUSY``
Sent if there is some temporary problem, such as multiple clients in a
multiplexer trying to access the clipboard simultaneously.
Terminals should ask the user for permission before allowing a read request.
However, if a read request only wishes to list the available data types on the
clipboard, it should be allowed without a permission prompt. This is so that
the user is not presented with a double permission prompt for reading the
available MIME types and then reading the actual data.
Writing data to the system clipboard
----------------------------------------
To write data to the system clipboard, the terminal programs sends the
following sequence of packets::
<OSC>5522;type=write<ST>
<OSC>5522;type=wdata:mime=<base64 encoded mime type>;<base 64 encoded chunk of data for this type><ST>
<OSC>5522;type=wdata:mime=<base64 encoded mime type>;<base 64 encoded chunk of data for this type><ST>
.
.
.
<OSC>5522;type=wdata<ST>
The final packet with no mime and no data indicates end of transmission. The
data for every MIME type should be split into chunks of no more than 4096
bytes. All the chunks for a given MIME type must be sent sequentially, before
sending chunks for the next MIME type. After the transmission is complete, the
terminal replies with a single packet indicating success::
<OSC>5522;type=write:status=DONE<ST>
If an error occurs the terminal can, at any time, send an error packet of the
form::
<OSC>5522;type=write:status=ERRORCODE<ST>
Here ``ERRORCODE`` must be one of:
``status=EIO``
An I/O error occurred while processing the data
``status=EINVAL``
One of the packets was invalid, usually because of invalid base64 encoding.
``status=ENOSYS``
The client asked to write to the primary selection with (``loc=primary``) and that is not
available on the system
``status=EPERM``
Sent if permission to write to the clipboard was denied by the system or
the user.
``status=EBUSY``
Sent if there is some temporary problem, such as multiple clients in a
multiplexer trying to access the clipboard simultaneously.
Once an error occurs, the terminal must ignore all further OSC 5522 write related packets until it
sees the start of a new write with a ``type=write`` packet.
The client can send to the primary selection instead of the clipboard by adding
``loc=primary`` to the initial ``type=write`` packet.
Finally, clients have the ability to *alias* MIME types when sending data to
the clipboard. To do that, the client must send a ``type=walias`` packet of the
form::
<OSC>5522;type=walias;mime=<base64 encoded target MIME type>;<base64 encoded, space separated list of aliases><ST>
The effect of an alias is that the system clipboard will make available all the
aliased MIME types, with the same data as was transmitted for the target MIME
type. This saves bandwidth, allowing the client to only transmit one copy of
the data, but create multiple references to it in the system clipboard. Alias
packets can be sent anytime after the initial write packet and before the end
of data packet.
Support for terminal multiplexers
------------------------------------
Since this protocol involves two way communication between the terminal
emulator and the client program, multiplexers need a way to know which window
to send responses from the terminal to. In order to make this possible, the
metadata portion of this escape code includes an optional ``id`` field. If
present the terminal emulator must send it back unchanged with every response.
Valid ids must include only characters from the set: ``[a-zA-Z0-9-_+.]``. Any
other characters must be stripped out from the id by the terminal emulator
before retransmitting it.
Note that when using a terminal multiplexer it is possible for two different
programs to tread on each others clipboard requests. This is fundamentally
unavoidable since the system clipboard is a single global shared resource.
However, there is an additional complication where responses form this protocol
could get lost if, for instance, multiple write requests are received
simultaneously. It is up to well designed multiplexers to ensure that only a
single request is in flight at a time. The multiplexer can abort requests by
sending back the ``EBUSY`` error code indicating some other window is trying
to access the clipboard.

View File

@@ -2,25 +2,25 @@ Saving and restoring colors
==============================
It is often useful for a full screen application with its own color themes to
set the default foreground, background, selection and cursor colors and the
ANSI color table. This allows for various performance optimizations when
drawing the screen. The problem is that if the user previously used the escape
codes to change these colors herself, then running the full screen application
will lose her changes even after it exits. To avoid this, kitty introduces a
new pair of *OSC* escape codes to push and pop the current color values from a
set the default foreground, background, selection and cursor colors and the ANSI
color table. This allows for various performance optimizations when drawing the
screen. The problem is that if the user previously used the escape codes to
change these colors themselves, then running the full screen application will
lose those changes even after it exits. To avoid this, kitty introduces a new
pair of *OSC* escape codes to push and pop the current color values from a
stack::
<ESC>]30001<ESC>\ # push onto stack
<ESC>]30101<ESC>\ # pop from stack
These escape codes save/restore the colors, default
background, default foreground, selection background, selection foreground and
cursor color and the 256 colors of the ANSI color table.
These escape codes save/restore the colors, default background, default
foreground, selection background, selection foreground and cursor color and the
256 colors of the ANSI color table.
.. note:: In July 2020, after several years, XTerm copied this protocol
.. note:: In July 2020, after several years, xterm copied this protocol
extension, without acknowledgement, and using incompatible escape codes
(XTPUSHCOLORS, XTPOPCOLORS, XTREPORTCOLORS). And they decided to save not
just the dynamic colors but the entire ANSI color table. In the interests of
promoting interoperability, kitty added support for XTerm's escape codes as
promoting interoperability, kitty added support for xterm's escape codes as
well, and changed this extension to also save/restore the entire ANSI color
table.

View File

@@ -13,14 +13,12 @@ import subprocess
import sys
import time
from functools import partial
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple
from typing import Any, Callable, Dict, Iterable, List, Tuple
from docutils import nodes
from docutils.parsers.rst.roles import set_classes
from pygments.lexer import RegexLexer, bygroups # type: ignore
from pygments.token import ( # type: ignore
Comment, Keyword, Literal, Name, Number, String, Whitespace
)
from pygments.token import Comment, Keyword, Literal, Name, Number, String, Whitespace # type: ignore
from sphinx import addnodes, version_info
from sphinx.util.logging import getLogger
@@ -35,8 +33,8 @@ from kitty.constants import str_version, website_url # noqa
# -- Project information -----------------------------------------------------
project = 'kitty'
copyright = time.strftime('%Y, Kovid Goyal')
author = 'Kovid Goyal'
copyright = time.strftime('%Y, Kovid Goyal, KittyPatch')
author = 'Kovid Goyal, KittyPatch'
building_man_pages = 'man' in sys.argv
# The short X.Y version
@@ -67,6 +65,10 @@ extensions = [
# URL for OpenGraph tags
ogp_site_url = website_url()
# OGP needs a PNG image because of: https://github.com/wpilibsuite/sphinxext-opengraph/issues/96
ogp_social_cards = {
'image': '../logo/kitty.png'
}
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
@@ -85,7 +87,7 @@ master_doc = 'index'
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language: Optional[str] = None
language: str = 'en'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
@@ -98,12 +100,25 @@ exclude_patterns = [
rst_prolog = '''
.. |kitty| replace:: *kitty*
.. |version| replace:: VERSION
.. _tarball: https://github.com/kovidgoyal/kitty/releases/download/vVERSION/kitty-VERSION.tar.xz
.. _tarball: https://gitea.rexy712.xyz/KittyPatch/kitty/releases/download/vVERSION/kitty-VERSION.tar.xz
.. role:: italic
'''.replace('VERSION', str_version)
smartquotes_action = 'qe' # educate quotes and ellipses but not dashes
def go_version(go_mod_path: str) -> str: # {{{
with open(go_mod_path) as f:
for line in f:
if line.startswith('go '):
return line.strip().split()[1]
raise SystemExit(f'No Go version in {go_mod_path}')
# }}}
string_replacements = {
'_kitty_install_cmd': 'curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin',
'_build_go_version': go_version('../go.mod'),
}
# -- Options for HTML output -------------------------------------------------
@@ -116,10 +131,23 @@ html_title = 'kitty'
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
github_icon_path = 'M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z' # noqa
html_theme_options: Dict[str, Any] = {
'sidebar_hide_name': True,
'navigation_with_keys': True,
'footer_icons': [
{
"name": "GitHub",
"url": "https://github.com/kovidgoyal/kitty",
"html": f"""
<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="{github_icon_path}"></path>
</svg>
""",
"class": "",
},
],
}
@@ -187,7 +215,7 @@ def commit_role(
f'GitHub commit id "{text}" not recognized.', line=lineno)
prb = inliner.problematic(rawtext, rawtext, msg)
return [prb], [msg]
url = f'https://github.com/kovidgoyal/kitty/commit/{commit_id}'
url = f'https://gitea.rexy712.xyz/KittyPatch/kitty/commit/{commit_id}'
set_classes(options)
short_id = subprocess.check_output(
f'git rev-list --max-count=1 --abbrev-commit --skip=# {commit_id}'.split()).decode('utf-8').strip()
@@ -198,7 +226,15 @@ def commit_role(
# CLI docs {{{
def write_cli_docs(all_kitten_names: Iterable[str]) -> None:
from kittens.ssh.main import copy_message, option_text
from kitty.cli import option_spec_as_rst
with open('generated/ssh-copy.rst', 'w') as f:
f.write(option_spec_as_rst(
appname='copy', ospec=option_text, heading_char='^',
usage='file-or-dir-to-copy ...', message=copy_message
))
del sys.modules['kittens.ssh.main']
from kitty.launch import options_spec as launch_options_spec
with open('generated/launch.rst', 'w') as f:
f.write(option_spec_as_rst(
@@ -225,12 +261,13 @@ if you specify a program-to-run you can use the special placeholder
from kitty.rc.base import cli_params_for
for cmd_name in sorted(all_command_names()):
func = command_for_name(cmd_name)
p(f'.. _at_{func.name}:\n')
p(f'.. _at-{func.name}:\n')
p('kitty @', func.name)
p('-' * 120)
p('.. program::', 'kitty @', func.name)
p('\n\n' + as_rst(*cli_params_for(func)))
from kittens.runner import get_kitten_cli_docs
for kitten in all_kitten_names:
data = get_kitten_cli_docs(kitten)
if data:
@@ -239,7 +276,8 @@ if you specify a program-to-run you can use the special placeholder
p('.. program::', 'kitty +kitten', kitten)
p('\nSource code for', kitten)
p('-' * 72)
p(f'\nThe source code for this kitten is `available on GitHub <https://github.com/kovidgoyal/kitty/tree/master/kittens/{kitten}>`_.')
scurl = f'https://github.com/kovidgoyal/kitty/tree/master/kittens/{kitten}'
p(f'\nThe source code for this kitten is `available on GitHub <{scurl}>`_.')
p('\nCommand Line Interface')
p('-' * 72)
p('\n\n' + option_spec_as_rst(
@@ -250,10 +288,8 @@ if you specify a program-to-run you can use the special placeholder
def write_remote_control_protocol_docs() -> None: # {{{
from kitty.rc.base import (
RemoteCommand, all_command_names, command_for_name
)
field_pat = re.compile(r'\s*([a-zA-Z0-9_+]+)\s*:\s*(.+)')
from kitty.rc.base import RemoteCommand, all_command_names, command_for_name
field_pat = re.compile(r'\s*([^:]+?)\s*:\s*(.+)')
def format_cmd(p: Callable[..., None], name: str, cmd: RemoteCommand) -> None:
p(name)
@@ -265,7 +301,7 @@ def write_remote_control_protocol_docs() -> None: # {{{
if m is None:
p(line)
else:
fields.append((m.group(1), m.group(2)))
fields.append((m.group(1).split('/')[0], m.group(2)))
if fields:
p('\nFields are:\n')
for (name, desc) in fields:
@@ -293,8 +329,16 @@ def write_remote_control_protocol_docs() -> None: # {{{
# }}}
def replace_string(app: Any, docname: str, source: List[str]) -> None: # {{{
src = source[0]
for k, v in app.config.string_replacements.items():
src = src.replace(k, v)
source[0] = src
# }}}
# config file docs {{{
class ConfLexer(RegexLexer): # type: ignore
name = 'Conf'
aliases = ['conf']
@@ -399,6 +443,12 @@ def parse_shortcut_node(env: Any, sig: str, signode: Any) -> str:
return sig
def parse_action_node(env: Any, sig: str, signode: Any) -> str:
"""Transform an action description into RST nodes."""
signode += addnodes.desc_name(sig, sig)
return sig
def process_opt_link(env: Any, refnode: Any, has_explicit_title: bool, title: str, target: str) -> Tuple[str, str]:
conf_name, opt = target.partition('.')[::2]
if not opt:
@@ -407,6 +457,10 @@ def process_opt_link(env: Any, refnode: Any, has_explicit_title: bool, title: st
return title, opt_aliases.get(full_name, full_name)
def process_action_link(env: Any, refnode: Any, has_explicit_title: bool, title: str, target: str) -> Tuple[str, str]:
return title, target
def process_shortcut_link(env: Any, refnode: Any, has_explicit_title: bool, title: str, target: str) -> Tuple[str, str]:
conf_name, slug = target.partition('.')[::2]
if not slug:
@@ -444,6 +498,15 @@ def write_conf_docs(app: Any, all_kitten_names: Iterable[str]) -> None:
sc_role.process_link = process_shortcut_link
shortcut_slugs.clear()
app.add_object_type(
'action', 'ac',
indextemplate="pair: %s; Action",
parse_node=parse_action_node,
)
ac_role = app.registry.domain_roles['std']['ac']
ac_role.warn_dangling = True
ac_role.process_link = process_action_link
def generate_default_config(definition: Definition, name: str) -> None:
with open(f'generated/conf-{name}.rst', 'w', encoding='utf-8') as f:
print('.. highlight:: conf\n', file=f)
@@ -451,7 +514,7 @@ def write_conf_docs(app: Any, all_kitten_names: Iterable[str]) -> None:
conf_name = re.sub(r'^kitten-', '', name) + '.conf'
with open(f'generated/conf/{conf_name}', 'w', encoding='utf-8') as f:
text = '\n'.join(definition.as_conf())
text = '\n'.join(definition.as_conf(commented=True))
print(text, file=f)
from kitty.options.definition import definition
@@ -459,9 +522,9 @@ def write_conf_docs(app: Any, all_kitten_names: Iterable[str]) -> None:
from kittens.runner import get_kitten_conf_docs
for kitten in all_kitten_names:
definition = get_kitten_conf_docs(kitten)
if definition:
generate_default_config(definition, f'kitten-{kitten}')
defn = get_kitten_conf_docs(kitten)
if defn is not None:
generate_default_config(defn, f'kitten-{kitten}')
from kitty.actions import as_rst
with open('generated/actions.rst', 'w', encoding='utf-8') as f:
@@ -490,6 +553,8 @@ def setup(app: Any) -> None:
write_cli_docs(kn)
write_remote_control_protocol_docs()
write_conf_docs(app, kn)
app.add_config_value('string_replacements', {}, True)
app.connect('source-read', replace_string)
app.add_config_value('analytics_id', '', 'env')
app.connect('html-page-context', add_html_context)
app.add_lexer('session', SessionLexer() if version_info[0] < 3 else SessionLexer)

View File

@@ -3,13 +3,14 @@ kitty.conf
.. highlight:: conf
|kitty| is highly customizable, everything from keyboard shortcuts, to
rendering frames-per-second. See below for an overview of all customization
possibilities.
|kitty| is highly customizable, everything from keyboard shortcuts, to rendering
frames-per-second. See below for an overview of all customization possibilities.
You can open the config file within kitty by pressing :sc:`edit_config_file` (:kbd:`⌘+,` on macOS).
You can reload the config file within kitty by pressing
:sc:`reload_config_file` (:kbd:`⌃+⌘+,` on macOS) or sending kitty the ``SIGUSR1`` signal.
You can open the config file within kitty by pressing :sc:`edit_config_file`
(:kbd:`⌘+,` on macOS). A :file:`kitty.conf` with commented default
configurations and descriptions will be created if the file does not exist.
You can reload the config file within kitty by pressing :sc:`reload_config_file`
(:kbd:`⌃+⌘+,` on macOS) or sending kitty the ``SIGUSR1`` signal.
You can also display the current configuration by pressing :sc:`debug_config`
(:kbd:`⌥+⌘+,` on macOS).
@@ -17,26 +18,34 @@ You can also display the current configuration by pressing :sc:`debug_config`
|kitty| looks for a config file in the OS config directories (usually
:file:`~/.config/kitty/kitty.conf`) but you can pass a specific path via the
:option:`kitty --config` option or use the ``KITTY_CONFIG_DIRECTORY``
environment variable. See the :option:`kitty --config` option for full details.
:option:`kitty --config` option or use the :envvar:`KITTY_CONFIG_DIRECTORY`
environment variable. See :option:`kitty --config` for full details.
Comments can be added to the config file as lines starting with the ``#``
character. This works only if the ``#`` character is the first character
in the line.
character. This works only if the ``#`` character is the first character in the
line.
You can include secondary config files via the :code:`include` directive. If
.. _include:
You can include secondary config files via the :code:`include` directive. If
you use a relative path for :code:`include`, it is resolved with respect to the
location of the current config file. Note that environment variables are
expanded, so :code:`${USER}.conf` becomes :file:`name.conf` if
:code:`USER=name`. Also, you can use :code:`globinclude` to include files
matching a shell glob pattern. For example::
:code:`USER=name`. A special environment variable :envvar:`KITTY_OS` is available,
to detect the operating system. It is ``linux``, ``macos`` or ``bsd``.
Also, you can use :code:`globinclude` to include files
matching a shell glob pattern and :code:`envinclude` to include configuration
from environment variables. For example::
include other.conf
# Include *.conf files from all subdirs of kitty.d inside the kitty config dir
globinclude kitty.d/**/*.conf
# Include the *contents* of all env vars starting with KITTY_CONF_
envinclude KITTY_CONF_*
.. note:: Syntax highlighting for :file:`kitty.conf` in vim is available via
`vim-kitty <https://github.com/fladson/vim-kitty>`_.
`vim-kitty <https://github.com/fladson/vim-kitty>`__.
.. include:: /generated/conf-kitty.rst
@@ -47,18 +56,23 @@ Sample kitty.conf
.. only:: html
You can download a sample :file:`kitty.conf` file with all default settings and
comments describing each setting by clicking: :download:`sample kitty.conf
</generated/conf/kitty.conf>`.
You can download a sample :file:`kitty.conf` file with all default settings
and comments describing each setting by clicking: :download:`sample
kitty.conf </generated/conf/kitty.conf>`.
.. only:: man
You can edit a fully commented sample kitty.conf by pressing the
:sc:`edit_config_file` shortcut in kitty. This will generate a config
file with full documentation and all settings commented out. If you
have a pre-existing kitty.conf, then that will be used instead, delete
it to see the sample file.
:sc:`edit_config_file` shortcut in kitty. This will generate a config file
with full documentation and all settings commented out. If you have a
pre-existing :file:`kitty.conf`, then that will be used instead, delete it to
see the sample file.
A default configuration file can also be generated by running::
kitty +runpy 'from kitty.config import *; print(commented_out_default_config())'
This will print the commented out default config file to :file:`STDOUT`.
All mappable actions
------------------------

View File

@@ -3,19 +3,18 @@ Setting text styles/colors in arbitrary regions of the screen
There already exists an escape code to set *some* text attributes in arbitrary
regions of the screen, `DECCARA
<https://vt100.net/docs/vt510-rm/DECCARA.html>`_. However, it is limited to
<https://vt100.net/docs/vt510-rm/DECCARA.html>`__. However, it is limited to
only a few attributes. |kitty| extends this to work with *all* SGR attributes.
So, for example, this can be used to set the background color in an arbitrary
region of the screen.
The motivation for this extension is the various problems with the existing
solution for erasing to background color, namely the *background color erase
(bce)* capability. See
:iss:`this discussion <160#issuecomment-346470545>`
and `this FAQ <https://invisible-island.net/ncurses/ncurses.faq.html#bce_mismatches>`_
(bce)* capability. See :iss:`this discussion <160#issuecomment-346470545>`
and `this FAQ <https://invisible-island.net/ncurses/ncurses.faq.html#bce_mismatches>`__
for a summary of problems with *bce*.
For example, to set the background color to blue in a
rectangular region of the screen from (3, 4) to (10, 11), you use::
For example, to set the background color to blue in a rectangular region of the
screen from (3, 4) to (10, 11), you use::
<ESC>[2*x<ESC>[4;3;11;10;44$r<ESC>[*x

View File

@@ -5,21 +5,20 @@ Desktop notifications
=======================
|kitty| implements an extensible escape code (OSC 99) to show desktop
notifications. It is easy to use from shell scripts and fully extensible to
show title and body. Clicking on the notification can optionally focus the
window it came from, and/or send an escape code back to the application running
in that window.
notifications. It is easy to use from shell scripts and fully extensible to show
title and body. Clicking on the notification can optionally focus the window it
came from, and/or send an escape code back to the application running in that
window.
The design of the escape code is partially based on the discussion in
the defunct
`terminal-wg <https://gitlab.freedesktop.org/terminal-wg/specifications/-/issues/13>`_
The design of the escape code is partially based on the discussion in the
defunct `terminal-wg <https://gitlab.freedesktop.org/terminal-wg/specifications/-/issues/13>`__
The escape code has the form::
<OSC> 99 ; metadata ; payload <terminator>
Here ``<OSC>`` is :code:`<ESC>]` and ``<terminator>`` is
:code:`<ESC><backslash>`. The metadata is a section of colon separated
:code:`<ESC><backslash>`. The ``metadata`` is a section of colon separated
:code:`key=value` pairs. Every key must be a single character from the set
:code:`a-zA-Z` and every value must be a word consisting of characters from
the set :code:`a-zA-Z0-9-_/\+.,(){}[]*&^%$#@!`~`. The payload must be
@@ -45,28 +44,28 @@ The design of the escape code is fundamentally chunked, this is because
different terminal emulators have different limits on how large a single escape
code can be. Chunking is accomplished by the ``i`` and ``d`` keys. The ``i``
key is the *notification id* which can be any string containing the characters
``[a-zA-Z0-9_-+.]``. The ``d`` key stands for *done* and
can only take the values ``0`` and ``1``. A value of ``0`` means the
notification is not yet done and the terminal emulator should hold off
displaying it. A value of ``1`` means the notification is done, and should be
displayed. You can specify the title or body multiple times and the terminal
emulator will concatenate them, thereby allowing arbitrarily long text
(terminal emulators are free to impose a sensible limit to avoid
Denial-of-Service attacks).
``[a-zA-Z0-9_-+.]``. The ``d`` key stands for *done* and can only take the
values ``0`` and ``1``. A value of ``0`` means the notification is not yet done
and the terminal emulator should hold off displaying it. A value of ``1`` means
the notification is done, and should be displayed. You can specify the title or
body multiple times and the terminal emulator will concatenate them, thereby
allowing arbitrarily long text (terminal emulators are free to impose a sensible
limit to avoid Denial-of-Service attacks). The size of the payload must be no
longer than ``2048`` bytes, *before being encoded*.
Both the ``title`` and ``body`` payloads must be either UTF-8 encoded plain
text with no embedded escape codes, or UTF-8 text that is base64 encoded, in
text with no embedded escape codes, or UTF-8 text that is Base64 encoded, in
which case there must be an ``e=1`` key in the metadata to indicate the payload
is base64 encoded.
is Base64 encoded.
When the user clicks the notification, a couple of things can happen, the
terminal emulator can focus the window from which the notification came, and/or
it can send back an escape code to the application indicating the notification
was activated. This is controlled by the ``a`` key which takes a comma
separated set of values, ``report`` and ``focus``. The value ``focus`` means
focus the window from which the notification was issued and is the default.
``report`` means send an escape code back to the application. The format of the
returned escape code is::
was activated. This is controlled by the ``a`` key which takes a comma separated
set of values, ``report`` and ``focus``. The value ``focus`` means focus the
window from which the notification was issued and is the default. ``report``
means send an escape code back to the application. The format of the returned
escape code is::
<OSC> 99 ; i=identifier ; <terminator>
@@ -87,9 +86,9 @@ to display it based on what it does understand.
.. note::
It is possible to extend this escape code to allow specifying an icon for
the notification, however, given that some platforms, such as macOS, dont
allow displaying custom icons on a notification, at all, it was decided to
leave it out of the spec for the time being.
the notification, however, given that some platforms, such as legacy versions
of macOS, don't allow displaying custom images on a notification, it was
decided to leave it out of the spec for the time being.
Similarly, features such as scheduled notifications could be added in future
revisions.
@@ -107,7 +106,7 @@ Key Value Default Description
``d`` ``0`` or ``1`` ``1`` Indicates if the notification is
complete or not.
``e`` ``0`` or ``1`` ``0`` If set to ``1`` means the payload is base64 encoded UTF-8,
``e`` ``0`` or ``1`` ``0`` If set to ``1`` means the payload is Base64 encoded UTF-8,
otherwise it is plain UTF-8 text with no C0 control codes in it
``i`` ``[a-zA-Z0-9-_+.]`` ``0`` Identifier for the notification
@@ -118,5 +117,6 @@ Key Value Default Description
.. note::
|kitty| also supports the legacy OSC 9 protocol developed by iTerm2 for
desktop notifications.
|kitty| also supports the `legacy OSC 9 protocol developed by iTerm2
<https://iterm2.com/documentation-escape-codes.html>`__ for desktop
notifications.

54
docs/extract-rst-targets.py Executable file
View File

@@ -0,0 +1,54 @@
#!/usr/bin/env python
# License: GPLv3 Copyright: 2022, Kovid Goyal <kovid at kovidgoyal.net>
import os
import re
from typing import Dict, Iterator
tgt_pat = re.compile(r'^.. _(\S+?):$', re.MULTILINE)
title_pat = re.compile('^(.+)\n[-=^#*]{5,}$', re.MULTILINE)
def find_explicit_targets(text: str) -> Iterator[str]:
for m in tgt_pat.finditer(text):
yield m.group(1)
def find_page_title(text: str) -> str:
for m in title_pat.finditer(text):
return m.group(1)
return ''
def main() -> Dict[str, Dict[str, str]]:
refs = {}
docs = {}
base = os.path.dirname(os.path.abspath(__file__))
for dirpath, dirnames, filenames in os.walk(base):
if 'generated' in dirnames:
dirnames.remove('generated')
for f in filenames:
if f.endswith('.rst'):
with open(os.path.join(dirpath, f)) as stream:
raw = stream.read()
href = os.path.relpath(stream.name, base).replace(os.sep, '/')
href = href.rpartition('.')[0] + '/'
docs[href.rstrip('/')] = find_page_title(raw)
first_line = raw.lstrip('\n').partition('\n')[0]
first_target_added = False
for explicit_target in find_explicit_targets(raw):
# Shorten the reference link to the top of the page.
# Note that anchor links should still be used in HTML docs
# to allow jumping within the same page.
if not first_target_added:
first_target_added = True
if first_line.startswith(f'.. _{explicit_target}:'):
refs[explicit_target] = href
continue
refs[explicit_target] = href + f'#{explicit_target.replace("_", "-")}'
return {'ref': refs, 'doc': docs}
if __name__ == '__main__':
import json
print(json.dumps(main(), indent=2))

View File

@@ -6,117 +6,166 @@ Frequently Asked Questions
Some special symbols are rendered small/truncated in kitty?
-----------------------------------------------------------
The number of cells a unicode character takes up are controlled by the unicode
standard. All characters are rendered in a single cell unless the unicode
The number of cells a Unicode character takes up are controlled by the Unicode
standard. All characters are rendered in a single cell unless the Unicode
standard says they should be rendered in two cells. When a symbol does not fit,
it will either be rescaled to be smaller or truncated (depending on how much
extra space it needs). This is often different from other terminals which just
let the character overflow into neighboring cells, which is fine if the
neighboring cell is empty, but looks terrible if it is not.
Some programs, like powerline, vim with fancy gutter symbols/status-bar, etc.
misuse unicode characters from the private use area to represent symbols. Often
these symbols are square and should be rendered in two cells. However, since
private use area symbols all have their width set to one in the unicode
Some programs, like Powerline, vim with fancy gutter symbols/status-bar, etc.
use Unicode characters from the private use area to represent symbols. Often
these symbols are wide and should be rendered in two cells. However, since
private use area symbols all have their width set to one in the Unicode
standard, |kitty| renders them either smaller or truncated. The exception is if
these characters are followed by a space or empty cell in which case kitty
makes use of the extra cell to render them in two cells.
makes use of the extra cell to render them in two cells. This behavior can be
turned off for specific symbols using :opt:`narrow_symbols`.
Using a color theme with a background color does not work well in vim?
-----------------------------------------------------------------------
First make sure you have not changed the TERM environment variable, it should
be ``xterm-kitty``. vim uses *background color erase* even if the terminfo file
does not contain the ``bce`` capability. This is a bug in vim. You can work around
it by adding the following to your vimrc::
Sadly, vim has very poor out-of-the-box detection for modern terminal features.
Furthermore, it `recently broke detection even more <https://github.com/vim/vim/issues/11729>`__.
It kind of, but not really, supports terminfo, except it overrides it with its own hard-coded
values when it feels like it. Worst of all, it has no ability to detect modern
features not present in terminfo, at all, even security sensitive ones like
bracketed paste.
Thankfully, probably as a consequence of this lack of detection, vim allows users to
configure these low level details. So, to make vim work well with any modern
terminal, including kitty, add the following to your :file:`~/.vimrc`.
.. code-block:: vim
" Mouse support
set mouse=a
set ttymouse=sgr
set balloonevalterm
" Styled and colored underline support
let &t_AU = "\e[58:5:%dm"
let &t_8u = "\e[58:2:%lu:%lu:%lum"
let &t_Us = "\e[4:2m"
let &t_Cs = "\e[4:3m"
let &t_ds = "\e[4:4m"
let &t_Ds = "\e[4:5m"
let &t_Ce = "\e[4:0m"
" Strikethrough
let &t_Ts = "\e[9m"
let &t_Te = "\e[29m"
" Truecolor support
let &t_8f = "\e[38:2:%lu:%lu:%lum"
let &t_8b = "\e[48:2:%lu:%lu:%lum"
let &t_RF = "\e]10;?\e\\"
let &t_RB = "\e]11;?\e\\"
" Bracketed paste
let &t_BE = "\e[?2004h"
let &t_BD = "\e[?2004l"
let &t_PS = "\e[200~"
let &t_PE = "\e[201~"
" Cursor control
let &t_RC = "\e[?12$p"
let &t_SH = "\e[%d q"
let &t_RS = "\eP$q q\e\\"
let &t_SI = "\e[5 q"
let &t_SR = "\e[3 q"
let &t_EI = "\e[1 q"
let &t_VS = "\e[?12l"
" Focus tracking
let &t_fe = "\e[?1004h"
let &t_fd = "\e[?1004l"
execute "set <FocusGained>=\<Esc>[I"
execute "set <FocusLost>=\<Esc>[O"
" Window title
let &t_ST = "\e[22;2t"
let &t_RT = "\e[23;2t"
" vim hardcodes background color erase even if the terminfo file does
" not contain bce. This causes incorrect background rendering when
" using a color theme with a background color in terminals such as
" kitty that do not support background color erase.
let &t_ut=''
See :doc:`here <deccara>` for why |kitty| does not support background color erase.
These settings must be placed **before** setting the ``colorscheme``. It is
also important that the value of the vim ``term`` variable is not changed
after these settings.
I get errors about the terminal being unknown or opening the terminal failing or functional keys like arrow keys don't work?
-------------------------------------------------------------------------------------------------------------------------------
I get errors about the terminal being unknown or opening the terminal failing when SSHing into a different computer?
-----------------------------------------------------------------------------------------------------------------------
This happens because the |kitty| terminfo files are not available on the server.
You can ssh in using the following command which will automatically copy the
terminfo files to the server::
These issues all have the same root cause: the kitty terminfo files not being
available. The most common way this happens is SSHing into a computer that does
not have the kitty terminfo files. The simplest fix for that is running::
kitty +kitten ssh myserver
This ssh kitten takes all the same command line arguments
as ssh, you can alias it to ssh in your shell's rc files to avoid having to
type it each time::
It will automatically copy over the terminfo files and also magically enable
:doc:`shell integration </shell-integration>` on the remote machine.
alias ssh="kitty +kitten ssh"
This :doc:`ssh kitten <kittens/ssh>` takes all the same command line arguments
as :program:`ssh`, you can alias it to something small in your shell's rc files
to avoid having to type it each time::
Remember to also setup :ref:`shell_integration` for completion and other
niceties.
alias s="kitty +kitten ssh"
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::
If this does not work, see :ref:`manual_terminfo_copy` for alternative ways to
get the kitty terminfo files onto a remote computer.
kitty +kitten ssh use-python myserver
The next most common reason for this is if you are running commands as root
using :program:`sudo` or :program:`su`. These programs often filter the
:envvar:`TERMINFO` environment variable which is what points to the kitty
terminfo files.
If that also fails, perhaps because python is not installed on the remote
server, use the following one-liner instead (it
is slower as it needs to ssh into the server twice, but will work with most
servers)::
First, make sure the :envvar:`TERM` is set to ``xterm-kitty`` in the sudo
environment. By default, it should be automatically copied over.
infocmp -a xterm-kitty | ssh myserver tic -x -o \~/.terminfo /dev/stdin
If you are using a well maintained Linux distribution, it will have a
``kitty-terminfo`` package that you can simply install to make the kitty
terminfo files available system-wide. Then the problem will no longer occur.
If you are behind a proxy (like Balabit) that prevents this, you must redirect the
1st command to a file, copy that to the server and run ``tic`` manually. If you
connect to a server, embedded or Android system that doesn't have ``tic``, copy over
your local file terminfo to the other system as :file:`~/.terminfo/x/xterm-kitty`.
Really, the correct solution for this is to convince the OpenSSH maintainers to
have ssh do this automatically, if possible, when connecting to a server, so that
all terminals work transparently.
If the server is running FreeBSD, or another system that relies on termcap
rather than terminfo, you will need to convert the terminfo file on your local
machine by running (on local machine with |kitty|)::
infocmp -C xterm-kitty
The output of this command is the termcap description, which should be appended
to :file:`/usr/share/misc/termcap` on the remote server. Then run the following
command to apply your change (on the server)::
cap_mkdb /usr/share/misc/termcap
Keys such as arrow keys, backspace, delete, home/end, etc. do not work when using su or sudo?
-------------------------------------------------------------------------------------------------
Make sure the TERM environment variable, is ``xterm-kitty``. And either the
TERMINFO environment variable points to a directory containing :file:`x/xterm-kitty`
or that file is under :file:`~/.terminfo/x/`.
Note that ``sudo`` might remove TERMINFO. Then setting it at the shell prompt can
be too late, because command line editing may not be reinitialized. In that case
you can either ask ``sudo`` to set it or if that is not supported, insert an ``env``
command before starting the shell, or, if not possible, after sudo start another
Shell providing the right terminfo path::
sudo … TERMINFO=$HOME/.terminfo bash -i
sudo … env TERMINFO=$HOME/.terminfo bash -i
TERMINFO=/home/ORIGINALUSER/.terminfo exec bash -i
You can configure sudo to preserve TERMINFO by running ``sudo
visudo`` and adding the following line::
Alternately, you can configure :program:`sudo` to preserve :envvar:`TERMINFO`
by running ``sudo visudo`` and adding the following line::
Defaults env_keep += "TERM TERMINFO"
If none of these are suitable for you, you can run sudo as follows::
sudo TERMINFO="$TERMINFO" -s -H
This will start a new root shell with the correct :envvar:`TERMINFO` value from your
current environment copied over.
If you have double width characters in your prompt, you may also need to
explicitly set a UTF-8 locale, like::
export LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8
I cannot use the key combination X in program Y?
-------------------------------------------------------
First, run::
kitty +kitten show_key -m kitty
Press the key combination X. If the kitten reports the key press
that means kitty is correctly sending the key press to terminal programs.
You need to report the issue to the developer of the terminal program. Most
likely they have not added support for :doc:`/keyboard-protocol`.
If the kitten does not report it, it means that the key is bound to some action
in kitty. You can unbind it in :file:`kitty.conf` with:
.. code-block:: conf
map X no_op
Here X is the keys you press on the keyboard. So for example
:kbd:`ctrl+shift+1`.
How do I change the colors in a running kitty instance?
------------------------------------------------------------
@@ -131,12 +180,15 @@ You can also define keyboard shortcuts to set colors, for example::
map f1 set_colors --configured /path/to/some/config/file/colors.conf
Or you can enable :doc:`remote control <remote-control>` for |kitty| and use :ref:`at_set-colors`.
The shortcut mapping technique has the same syntax as the remote control
command, for details, see :ref:`at_set-colors`.
Or you can enable :doc:`remote control <remote-control>` for |kitty| and use
:ref:`at-set-colors`. The shortcut mapping technique has the same syntax as the
remote control command, for details, see :ref:`at-set-colors`.
To change colors when SSHing into a remote host, use the :opt:`color_scheme
<kitten-ssh.color_scheme>` setting for the :doc:`ssh kitten <kittens/ssh>`.
Additionally, You can use the
`OSC terminal escape codes <https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands>`_
`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:
@@ -153,7 +205,7 @@ to set colors. Examples of using OSC escape codes to set colors::
printf '\x1b]4;n;green\x1b\\'
You can use various syntaxes/names for color specifications in the above
examples. See `XParseColor <https://linux.die.net/man/3/xparsecolor>`_
examples. See `XParseColor <https://linux.die.net/man/3/xparsecolor>`__
for full details.
If a ``?`` is given rather than a color specification, kitty will respond
@@ -166,14 +218,15 @@ How do I specify command line options for kitty on macOS?
Apple does not want you to use command line options with GUI applications. To
workaround that limitation, |kitty| will read command line options from the file
:file:`<kitty config dir>/macos-launch-services-cmdline` when it is launched
from the GUI, i.e. by clicking the |kitty| application icon or using ``open -a kitty``.
Note that this file is *only read* when running via the GUI.
from the GUI, i.e. by clicking the |kitty| application icon or using
``open -a kitty``. Note that this file is *only read* when running via the GUI.
You can, of course, also run |kitty| from a terminal with command line options, using:
:file:`/Applications/kitty.app/Contents/MacOS/kitty`.
You can, of course, also run |kitty| from a terminal with command line options,
using: :file:`/Applications/kitty.app/Contents/MacOS/kitty`.
And within |kitty| itself, you can always run |kitty| using just ``kitty`` as it
cleverly adds itself to the :envvar:`PATH`.
And within |kitty| itself, you can always run |kitty| using just `kitty` as it
cleverly adds itself to the ``PATH``.
I catted a binary file and now kitty is hung?
-----------------------------------------------
@@ -181,10 +234,10 @@ I catted a binary file and now kitty is hung?
**Never** output unknown binary data directly into a terminal.
Terminals have a single channel for both data and control. Certain bytes
are control codes. Some of these control codes are of arbitrary length, so
if the binary data you output into the terminal happens to contain the starting
sequence for one of these control codes, the terminal will hang waiting for
the closing sequence. Press :kbd:`ctrl+shift+delete` to reset the terminal.
are control codes. Some of these control codes are of arbitrary length, so if
the binary data you output into the terminal happens to contain the starting
sequence for one of these control codes, the terminal will hang waiting for the
closing sequence. Press :sc:`reset_terminal` to reset the terminal.
If you do want to cat unknown data, use ``cat -v``.
@@ -192,29 +245,36 @@ 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, 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.
|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::
If you are trying to use a font patched with `Nerd Fonts
<https://nerdfonts.com/>`__ symbols, don't do that as patching destroys
fonts. There is no need, simply install the standalone ``Symbols Nerd Font Mono``
(the file :file:`NerdFontsSymbolsOnly.zip` from the `Nerd Fonts releases page
<https://github.com/ryanoasis/nerd-fonts/releases>`__). kitty should pick up
symbols from it automatically, and you can tell it to do so explicitly in
case it doesn't 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
# Nerd Fonts v2.3.3
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::
symbol_map U+23FB-U+23FE,U+2665,U+26A1,U+2B58,U+E000-U+E00A,U+E0A0-U+E0A3,U+E0B0-U+E0D4,U+E200-U+E2A9,U+E300-U+E3E3,U+E5FA-U+E6AA,U+E700-U+E7C5,U+EA60-U+EBEB,U+F000-U+F2E0,U+F300-U+F32F,U+F400-U+F4A9,U+F500-U+F8FF,U+F0001-U+F1AF0 Symbols Nerd Font Mono
Those Unicode symbols beyond the ``E000-F8FF`` Unicode private use area are
not included.
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::
fc-list : family spacing outline scalable | grep -e spacing=100 -e spacing=90 | grep -e outline=True | grep -e scalable=True
Note that the spacing property is calculated by fontconfig based on actual
glyph widths in the font. If for some reason fontconfig concludes your favorite
Note that the spacing property is calculated by fontconfig based on actual glyph
widths in the font. If for some reason fontconfig concludes your favorite
monospace font does not have ``spacing=100`` you can override it by using the
following :file:`~/.config/fontconfig/fonts.conf`::
@@ -236,7 +296,7 @@ command to rebuild your fontconfig cache::
fc-cache -r
Then, the font will be available in ``kitty list-fonts``.
Then, the font will be available in ``kitty +list-fonts``.
How can I assign a single global shortcut to bring up the kitty terminal?
@@ -254,7 +314,7 @@ 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
.. image:: https://github.com/k0nserv/kitty-icon/raw/main/kitty.iconset/icon_256x256.png
:target: https://github.com/k0nserv/kitty-icon
:width: 256
@@ -270,13 +330,52 @@ homepage:
:target: https://github.com/hristost/kitty-alternative-icon
:width: 256
On macOS you can change the icon by following the steps:
.. image:: https://github.com/igrmk/whiskers/raw/main/whiskers.svg
:target: https://github.com/igrmk/whiskers
:width: 256
#. Find :file:`kitty.app` in the Applications folder, select it and press :kbd:`⌘+i`
.. image:: https://github.com/samholmes/whiskers/raw/main/whiskers.png
:target: https://github.com/samholmes/whiskers
:width: 256
.. image:: https://github.com/eccentric-j/eccentric-icons/raw/main/icons/kitty-terminal/2d/kitty-preview.png
:target: https://github.com/eccentric-j/eccentric-icons
:width: 256
.. image:: https://github.com/eccentric-j/eccentric-icons/raw/main/icons/kitty-terminal/3d/kitty-preview.png
:target: https://github.com/eccentric-j/eccentric-icons
:width: 256
On macOS you can put :file:`kitty.app.icns` or :file:`kitty.app.png` in the
:ref:`kitty configuration directory <confloc>`, and this icon will be applied
automatically at startup. Unfortunately, Apple's Dock does not change its
cached icon so the custom icon will revert when kitty is quit. Run the
following to force the Dock to update its cached icons:
.. code-block:: sh
rm /var/folders/*/*/*/com.apple.dock.iconcache; killall Dock
If you prefer not to keep a custom icon in the kitty config folder, you can
also set it with the following command:
.. code-block:: sh
# Set kitty.icns as the icon for currently running kitty
kitty +runpy 'from kitty.fast_data_types import cocoa_set_app_icon; import sys; cocoa_set_app_icon(*sys.argv[1:]); print("OK")' kitty.icns
# Set the icon for app bundle specified by the path
kitty +runpy 'from kitty.fast_data_types import cocoa_set_app_icon; import sys; cocoa_set_app_icon(*sys.argv[1:]); print("OK")' /path/to/icon.png /Applications/kitty.app
You can also change the icon manually 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::
#. Delete the icon cache and restart Dock:
$ rm /var/folders/*/*/*/com.apple.dock.iconcache; killall Dock
.. code-block:: sh
rm /var/folders/*/*/*/com.apple.dock.iconcache; killall Dock
How do I map key presses in kitty to different keys in the terminal program?
@@ -292,7 +391,14 @@ the :sc:`send_text <send_text>` you can use the ``show_key`` kitten. Run::
kitty +kitten show_key
Then press the key you want to emulate.
Then press the key you want to emulate. Note that this kitten will only show
keys that actually reach the terminal program, in particular, keys mapped to
actions in kitty will not be shown. To check those first map them to
:ac:`no_op`. You can also start a kitty instance without any shortcuts to
interfere::
kitty -o clear_all_shortcuts=yes kitty +kitten show_key
How do I open a new window or tab with the same working directory as the current window?
--------------------------------------------------------------------------------------------
@@ -319,8 +425,8 @@ variables which kitty will now inherit.
You need to make sure that the environment variables you define in your shell's
rc files are either also defined system wide or via the :opt:`env` directive in
:file:`kitty.conf`. Common environment variables that cause issues are those
related to localization, such as ``LANG, LC_*`` and loading of configuration
files such as ``XDG_*, KITTY_CONFIG_DIRECTORY``.
related to localization, such as :envvar:`LANG`, ``LC_*`` and loading of
configuration files such as ``XDG_*``, :envvar:`KITTY_CONFIG_DIRECTORY`.
To see the environment variables that kitty sees, you can add the following
mapping to :file:`kitty.conf`::
@@ -337,40 +443,42 @@ sorts of places where they may or may not work.
I am using tmux and have a problem
--------------------------------------
First, terminal multiplexers are :iss:`a bad idea <391#issuecomment-638320745>`, do
not use them, if at all possible. kitty contains features that do all of what
First, terminal multiplexers are :iss:`a bad idea <391#issuecomment-638320745>`,
do not use them, if at all possible. kitty contains features that do all of what
tmux does, but better, with the exception of remote persistence (:iss:`391`).
If you still want to use tmux, read on.
Image display will not work, see `tmux issue
<https://github.com/tmux/tmux/issues/1391>`_.
<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`).
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
support multiple terminfo definitions.
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 :envvar:`TERM`
variables, tmux will break. You will need to restart it as tmux does not support
multiple terminfo definitions.
If you use any of the advanced features that kitty has innovated, such as
styled underlines, desktop notifications, extended keyboard support, etc.
they may or may not work, depending on the whims of tmux's maintainer, your
version of tmux, etc.
:doc:`styled underlines </underlines>`, :doc:`desktop notifications
</desktop-notifications>`, :doc:`extended keyboard support
</keyboard-protocol>`, etc. they may or may not work, depending on the whims of
tmux's maintainer, your version of tmux, etc.
I opened and closed a lot of windows/tabs and top shows kitty's memory usage is very high?
-------------------------------------------------------------------------------------------
``top`` is not a good way to measure process memory usage. That is because on
modern systems, when allocating memory to a process, the C library functions
will typically allocate memory in large blocks, and give the process chunks of
these blocks. When the process frees a chunk, the C library will not
:program:`top` is not a good way to measure process memory usage. That is
because on modern systems, when allocating memory to a process, the C library
functions will typically allocate memory in large blocks, and give the process
chunks of these blocks. When the process frees a chunk, the C library will not
necessarily release the underlying block back to the OS. So even though the
application has released the memory, ``top`` will still claim the process is
using it.
application has released the memory, :program:`top` will still claim the process
is using it.
To check for memory leaks, instead use a tool like ``valgrind``. Run::
To check for memory leaks, instead use a tool like `Valgrind
<https://valgrind.org/>`__. Run::
PYTHONMALLOC=malloc valgrind --tool=massif kitty
@@ -383,18 +491,19 @@ that window, maybe run yes or find again. Then quit kitty and run::
You will see the allocations graph goes up when you opened the windows, then
goes back down when you closed them, indicating there were no memory leaks.
For those interested, you can get a similar profile out of ``valgrind`` as you get
with ``top`` by adding ``--pages-as-heap=yes`` then you will see that memory
allocated in malloc is not freed in free. This can be further refined if you
use `glibc`` as your C library by setting the environment variable
``MALLOC_MMAP_THRESHOLD_=64``. This will cause free to actually free memory
allocated in sizes of more than 64 bytes. With this set, memory usage will
climb high, then fall when closing windows, but not fall all the way back. The
remaining used memory can be investigated using valgrind again, and it will
For those interested, you can get a similar profile out of :program:`valgrind`
as you get with :program:`top` by adding ``--pages-as-heap=yes`` then you will
see that memory allocated in malloc is not freed in free. This can be further
refined if you use ``glibc`` as your C library by setting the environment
variable ``MALLOC_MMAP_THRESHOLD_=64``. This will cause free to actually free
memory allocated in sizes of more than 64 bytes. With this set, memory usage
will climb high, then fall when closing windows, but not fall all the way back.
The 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
maintains. These too allocate memory in large blocks and don't release it back
to the OS immediately.
Why does kitty sometimes start slowly on my Linux system?
-------------------------------------------------------------------------------------------
@@ -418,4 +527,4 @@ The correct command will depend on your situation and hardware.
: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`.
card during enumeration, and will instead just use :file:`radeonsi_dri.so`.

View File

@@ -30,14 +30,26 @@ Glossary
overlay
An *overlay window* is a :term:`kitty window <window>` that is placed on
top of an existing kitty window, entirely covering it. Overlays are used
throught kitty, for example, to display the :ref:`the scrollback buffer <scrollback>`,
throughout 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. Normal overlays are meant for short
duration popups and so are not considered the :italic:`active window`
when determining the current working directory or getting input text for
kittens, launch commands, etc. To create an overlay considered as a
:italic:`main window` use the :code:`overlay-main` argument to
:doc:`launch`.
hyperlinks
Terminals can have hyperlinks, just like the internet. In kitty you can
:doc:`control exactly what happens <open_actions>` when clicking on a
hyperlink, based on the type of link and its URL.
hyperlink, based on the type of link and its URL. See also `Hyperlinks in terminal
emulators <https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda>`__.
kittens
Small, independent statically compiled command line programs that are designed to run
inside kitty windows and provide it with lots of powerful and flexible
features such as viewing images, connecting conveniently to remote
computers, transferring files, inputting unicode characters, etc.
.. _env_vars:
@@ -45,6 +57,7 @@ Environment variables
------------------------
Variables that influence kitty behavior
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. envvar:: KITTY_CONFIG_DIRECTORY
@@ -57,11 +70,17 @@ Variables that influence kitty behavior
Controls where kitty stores cache files. Defaults to :file:`~/.cache/kitty`
or :file:`~/Library/Caches/kitty` on macOS.
.. envvar:: KITTY_RUNTIME_DIRECTORY
Controls where kitty stores runtime files like sockets. Defaults to
the :code:`XDG_RUNTIME_DIR` environment variable if that is defined
otherwise the run directory inside the kitty cache directory is used.
.. envvar:: VISUAL
The terminal editor (such as ``vi`` or ``nano``) kitty uses, when, for
instance, opening :file:`kitty.conf` in response to :sc:`edit_config_file`.
The terminal based text editor (such as :program:`vi` or :program:`nano`)
kitty uses, when, for instance, opening :file:`kitty.conf` in response to
:sc:`edit_config_file`.
.. envvar:: EDITOR
@@ -78,84 +97,129 @@ Variables that influence kitty behavior
is possible for the autodiscovery to fail; the default Wayland XKB mappings
are used in this case. See :pull:`3943` for details.
.. envvar:: SSH_ASKPASS
Specify the program for SSH to ask for passwords. When this is set, :doc:`ssh
kitten </kittens/ssh>` will use this environment variable by default. See
:opt:`askpass <kitten-ssh.askpass>` for details.
.. envvar:: KITTY_CLONE_SOURCE_CODE
Set this to some shell code that will be executed in the cloned window with
:code:`eval` when :ref:`clone-in-kitty <clone_shell>` is used.
.. envvar:: KITTY_CLONE_SOURCE_PATH
Set this to the path of a file that will be sourced in the cloned window when
:ref:`clone-in-kitty <clone_shell>` is used.
.. envvar:: KITTY_DEVELOP_FROM
Set this to the directory path of the kitty source code and its Python code
will be loaded from there. Only works with official binary builds.
.. envvar:: KITTY_RC_PASSWORD
Set this to a pass phrase to use the ``kitty @`` remote control command with
:opt:`remote_control_password`.
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.
This is only set on macOS. If the country and language from the macOS user
settings form an invalid locale, it will be set to :code:`en_US.UTF-8`.
.. envvar:: PATH
kitty prepends itself to the PATH of its own environment to ensure the
functions calling :program:`kitty` will work properly.
.. 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:: KITTY_PUBLIC_KEY
A public key that programs can use to communicate securely with kitty using
the remote control protocol. The format is: :code:`protocol:key data`.
.. envvar:: WINDOWID
The id for the :term:`OS Window <os_window>` the program is running in. Only available
on platforms that have ids for their windows, such as X11 and macOS.
.. envvar:: TERM
The name of the terminal, defaults to ``xterm-kitty``. See :opt:`term`.
.. envvar:: TERMINFO
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
colors.
.. envvar:: KITTY_LISTEN_ON
Set when the :doc:`remote control <remote-control>` facility is enabled and
the a socket is used for control via :option:`kitty --listen-on` or :opt:`listen_on`.
Contains the path to the socket. Avoids needs to use :option:`kitty @ --to` when
Contains the path to the socket. Avoid the need to use :option:`kitty @ --to` when
issuing remote control commands.
.. envvar:: KITTY_PIPE_DATA
Set to data describing the layout of the screen when running child
programs using :option:`launch --stdin-source` with the contents of the
screen/scrollback piped to them.
.. envvar:: KITTY_CHILD_CMDLINE
Set to the command line of the child process running in the kitty
window when calling the notification callback program on terminal bell, see
:opt:`command_on_bell`.
.. envvar:: KITTY_COMMON_OPTS
Set with the values of some common kitty options when running
kittens, so kittens can use them without needing to load kitty.conf.
kittens, so kittens can use them without needing to load :file:`kitty.conf`.
.. envvar:: KITTY_SHELL_INTEGRATION
Set when enabling :ref:`shell_integration`. It is automatically removed by
the shell integration scripts.
.. envvar:: ZDOTDIR
Set when enabling :ref:`shell_integration` with :program:`zsh`, allowing
:program:`zsh` to automatically load the integration script.
.. envvar:: XDG_DATA_DIRS
Set when enabling :ref:`shell_integration` with :program:`fish`, allowing
:program:`fish` to automatically load the integration script.
.. envvar:: ENV
Set when enabling :ref:`shell_integration` with :program:`bash`, allowing
:program:`bash` to automatically load the integration script.
.. envvar:: KITTY_OS
Set when using the include directive in kitty.conf. Can take values:
``linux``, ``macos``, ``bsd``.

View File

@@ -28,24 +28,29 @@ alpha-blending and text over graphics.
Some programs and libraries that use the kitty graphics protocol:
* `termpdf.py <https://github.com/dsanson/termpdf.py>`_ - a terminal PDF/DJVU/CBR viewer
* `ranger <https://github.com/ranger/ranger>`_ - a terminal file manager, with
image previews, see this `PR <https://github.com/ranger/ranger/pull/1077>`_
* `ranger <https://github.com/ranger/ranger>`_ - a terminal file manager, with image previews
* :doc:`kitty-diff <kittens/diff>` - a side-by-side terminal diff program with support for images
* `tpix <https://github.com/jesvedberg/tpix>`_ - a statically compiled binary that can be used to display images and easily installed on remote servers without root access
* `mpv <https://github.com/mpv-player/mpv/commit/874e28f4a41a916bb567a882063dd2589e9234e1>`_ - A video player that can play videos in the terminal
* `pixcat <https://github.com/mirukana/pixcat>`_ - a third party CLI and python library that wraps the graphics protocol
* `neofetch <https://github.com/dylanaraps/neofetch>`_ - A command line system
information tool
* `viu <https://github.com/atanunq/viu>`_ - a terminal image viewer
* `glkitty <https://github.com/michaeljclark/glkitty>`_ - C library to draw OpenGL shaders in the terminal with a glgears demo
* `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 terminal
* `chafa <https://github.com/hpjansson/chafa>`_ - a terminal image viewer
* `hologram.nvim <https://github.com/edluffy/hologram.nvim>`_ - view images inside nvim
* `term-image <https://github.com/AnonymouX47/term-image>`_ - A Python library, CLI and TUI to display and browse images in the terminal
* `glkitty <https://github.com/michaeljclark/glkitty>`_ - C library to draw OpenGL shaders in the terminal with a glgears demo
* `twitch-tui <https://github.com/Xithrius/twitch-tui>`_ - Twitch chat in the terminal
Other terminals that have implemented the graphics protocol:
* `WezTerm <https://github.com/wez/wezterm/issues/986>`_
* `Konsole <https://invent.kde.org/utilities/konsole/-/merge_requests/594>`_
* `wayst <https://github.com/91861/wayst>`_
Getting the window size
@@ -53,7 +58,8 @@ Getting the window size
In order to know what size of images to display and how to position them, the
client must be able to get the window size in pixels and the number of cells
per row and column. This can be done by using the ``TIOCGWINSZ`` ioctl. Some
per row and column. The cell width is then simply the window size divided by the
number of rows. This can be done by using the ``TIOCGWINSZ`` ioctl. Some
code to demonstrate its use
.. tab:: C
@@ -84,6 +90,31 @@ code to demonstrate its use
'number of rows: {} number of columns: {}'
'screen width: {} screen height: {}').format(*buf))
.. tab:: Go
.. code-block:: go
import "golang.org/x/sys/unix"
fd, err := unix.Open(fd, unix.O_NOCTTY|unix.O_CLOEXEC|unix.O_NDELAY|unix.O_RDWR, 0666)
sz, err := unix.IoctlGetWinsize(fd, unix.TIOCGWINSZ)
fmt.Println("rows: %v columns: %v width: %v height %v", sz.Row, sz.Col, sz.Xpixel, sz.Ypixel)
.. tab:: Bash
.. code-block:: sh
#!/bin/bash
# This uses the kitten standalone binary from kitty to get the pixel sizes
# since we cant do IOCTLs directly. Fortunately, kitten is a static exe
# pre-built for every Unix like OS under the sun.
builtin read -r rows cols < <(command stty size)
IFS=x builtin read -r width height < <(command kitten icat --print-window-size); builtin unset IFS
builtin echo "number of rows: $rows number of columns: $cols screen width: $width screen height: $height"
Note that some terminals return ``0`` for the width and height values. Such
terminals should be modified to return the correct values. Examples of
terminals that return correct values: ``kitty, xterm``
@@ -97,47 +128,71 @@ kitty.
A minimal example
------------------
Some minimal python code to display PNG images in kitty, using the most basic
Some minimal code to display PNG images in kitty, using the most basic
features of the graphics protocol:
.. code-block:: python
.. tab:: Bash
import sys
from base64 import standard_b64encode
.. code-block:: sh
#!/bin/bash
transmit_png() {
data=$(base64 "$1")
data="${data//[[:space:]]}"
builtin local pos=0
builtin local chunk_size=4096
while [ $pos -lt ${#data} ]; do
builtin printf "\e_G"
[ $pos = "0" ] && printf "a=T,f=100,"
builtin local chunk="${data:$pos:$chunk_size}"
pos=$(($pos+$chunk_size))
[ $pos -lt ${#data} ] && builtin printf "m=1"
[ ${#chunk} -gt 0 ] && builtin printf ";%s" "${chunk}"
builtin printf "\e\\"
done
}
transmit_png "$1"
.. tab:: Python
.. code-block:: python
#!/usr/bin/python
import sys
from base64 import standard_b64encode
def serialize_gr_command(**cmd):
payload = cmd.pop('payload', None)
cmd = ','.join(f'{k}={v}' for k, v in cmd.items())
ans = []
w = ans.append
w(b'\033_G'), w(cmd.encode('ascii'))
if payload:
w(b';')
w(payload)
w(b'\033\\')
return b''.join(ans)
def write_chunked(**cmd):
data = standard_b64encode(cmd.pop('data'))
while data:
chunk, data = data[:4096], data[4096:]
m = 1 if data else 0
sys.stdout.buffer.write(serialize_gr_command(payload=chunk, m=m,
**cmd))
sys.stdout.flush()
cmd.clear()
with open(sys.argv[-1], 'rb') as f:
write_chunked(a='T', f=100, data=f.read())
def serialize_gr_command(**cmd):
payload = cmd.pop('payload', None)
cmd = ','.join(f'{k}={v}' for k, v in cmd.items())
ans = []
w = ans.append
w(b'\033_G'), w(cmd.encode('ascii'))
if payload:
w(b';')
w(payload)
w(b'\033\\')
return b''.join(ans)
def write_chunked(**cmd):
data = standard_b64encode(cmd.pop('data'))
while data:
chunk, data = data[:4096], data[4096:]
m = 1 if data else 0
sys.stdout.buffer.write(serialize_gr_command(payload=chunk, m=m,
**cmd))
sys.stdout.flush()
cmd.clear()
with open(sys.argv[-1], 'rb') as f:
write_chunked(a='T', f=100, data=f.read())
Save this script as :file:`png.py`, then you can use it to display any PNG
Save this script as :file:`send-png`, then you can use it to display any PNG
file in kitty as::
python png.py file.png
chmod +x send-png
./send-png file.png
The graphics escape code
@@ -233,7 +288,8 @@ Value of `t` Meaning
the terminal emulator should only delete the file if it
is in a known temporary directory, such as :file:`/tmp`,
:file:`/dev/shm`, :file:`TMPDIR env var if present` and any platform
specific temporary directories.
specific temporary directories and the file has the
string :code:`tty-graphics-protocol` in its full file path.
``s`` A *shared memory object*, which on POSIX systems is a
`POSIX shared memory object <https://pubs.opengroup.org/onlinepubs/9699919799/functions/shm_open.html>`_
and on Windows is a
@@ -290,12 +346,13 @@ sequence of escape codes to the terminal emulator::
<ESC>_Gm=0;<encoded pixel data last chunk><ESC>\
Note that only the first escape code needs to have the full set of control
codes such as width, height, format etc. Subsequent chunks **must** have
only the ``m`` key. The client **must** finish sending all chunks for a single image
before sending any other graphics related escape codes. Note that the cursor
position used to display the image **must** be the position when the final chunk is
received. Finally, terminals must not display anything, until the entire sequence is
received and validated.
codes such as width, height, format, etc. Subsequent chunks **must** have only
the ``m`` and optionally ``q`` keys. When sending animation frame data, subsequent
chunks **must** also specify the ``a=f`` key. The client **must** finish sending
all chunks for a single image before sending any other graphics related escape
codes. Note that the cursor position used to display the image **must** be the
position when the final chunk is received. Finally, terminals must not display
anything, until the entire sequence is received and validated.
Querying support and available transmission mediums
@@ -325,14 +382,14 @@ 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.
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
the *query action* the terminal emulator does not support the graphics
protocol.
As of April 2022, kitty and WezTerm are the only terminal emulators to
support this graphics protocol completely, with Konsole and wayst having partial support.
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 the *query
action* the terminal emulator does not support the graphics protocol.
This means that terminal emulators that support the graphics protocol, **must**
reply to *query actions* immediately without processing other input. Most
@@ -375,7 +432,9 @@ id. To do so add the ``p`` key with a number between ``1`` and ``4294967295``.
When you specify a placement id, it will be added to the acknowledgement code
above. Every placement is uniquely identified by the pair of the ``image id``
and the ``placement id``. If you specify a placement id for an image that does
not have an id, it will be ignored. An example response::
not have an id (i.e. has id=0), it will be ignored. In particular this means
there can exist multiple images with ``image id=0, placement id=0``.
An example response::
<ESC>_Gi=<image id>,p=<placement id>;OK<ESC>\
@@ -412,7 +471,9 @@ they are semi-transparent. You can specify z-index values using the ``z`` key.
Negative z-index values mean that the images will be drawn under the text. This
allows rendering of text on top of images. Negative z-index values below
INT32_MIN/2 (-1,073,741,824) will be drawn under cells with non-default background
colors.
colors. If two images with the same z-index overlap then the image with the
lower id is considered to have the lower z-index. If the images have the same
z-index and the same id, then the behavior is undefined.
.. note:: After placing an image on the screen the cursor must be moved to the
right by the number of cols in the image placement rectangle and down by the
@@ -427,6 +488,132 @@ colors.
Support for the C=1 cursor movement policy
.. _graphics_unicode_placeholders:
Unicode placeholders
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. versionadded:: 0.28.0
Support for image display via Unicode placeholders
You can also use a special Unicode character ``U+10EEEE`` as a placeholder for
an image. This approach is less flexible, but it allows using images inside
any host application that supports Unicode and foreground colors (tmux, vim, weechat, etc.)
and has a way to pass escape codes through to the underlying terminal.
The central idea is that we use a single *Private Use* Unicode character as a
*placeholder* to indicate to the terminal that an image is supposed to be
displayed at that cell. Since this character is just normal text, Unicode aware
application will move it around as needed when they redraw their screens,
thereby automatically moving the displayed image as well, even though they know
nothing about the graphics protocol. So an image is first created using the
normal graphics protocol escape codes (albeit in quiet mode (``q=2``) so that there are
no responses from the terminal that could confuse the host application). Then,
the actual image is displayed by getting the host application to emit normal
text consisting of ``U+10EEEE`` and various diacritics (Unicode combining
characters) and colors.
To use it, first create an image as you would normally with the graphics
protocol with (``q=2``), but do not create a placement for it, that is, do not
display it. Then, create a *virtual image placement* by specifying ``U=1`` and
the desired number of lines and columns::
<ESC>_Ga=p,U=1,i=<image_id>,c=<columns>,r=<rows><ESC>\
The creation of the placement need not be a separate escape code, it can be
combined with ``a=T`` to both transmit and create the virtual placement with a
single code.
The image will eventually be fit to the specified rectangle, its aspect ratio
preserved. Finally, the image can be actually displayed by using the
placeholder character, encoding the image ID in its foreground color. The row
and column values are specified with diacritics listed in
:download:`rowcolumn-diacritics.txt <../rowcolumn-diacritics.txt>`. For
example, here is how you can print a ``2x2`` placeholder for image ID ``42``:
.. code-block:: sh
printf "\e[38;5;42m\U10EEEE\U0305\U0305\U10EEEE\U0305\U030D\e[39m\n"
printf "\e[38;5;42m\U10EEEE\U030D\U0305\U10EEEE\U030D\U030D\e[39m\n"
Here, ``U+305`` is the diacritic corresponding to the number ``0``
and ``U+30D`` corresponds to ``1``. So these two commands create the following
``2x2`` placeholder:
========== ==========
(0, 0) (1, 0)
(1, 0) (1, 1)
========== ==========
This will cause the image with ID ``42`` to be displayed in a ``2x2`` grid.
Ideally, you would print out as many cells as the number of rows and columns
specified when creating the virtual placement, but in case of a mismatch only
part of the image will be displayed.
By using only the foreground color for image ID you are limited to either 8-bit IDs in 256 color
mode or 24-bit IDs in true color mode. Since IDs are in a global namespace
there can easily be collisions. If you need more bits for the image
ID, you can specify the most significant byte via a third diacritic. For
example, this is the placeholder for the image ID ``33554474 = 42 + (2 << 24)``:
.. code-block:: sh
printf "\e[38;5;42m\U10EEEE\U0305\U0305\U030E\U10EEEE\U0305\U030D\U030E\n"
printf "\e[38;5;42m\U10EEEE\U030D\U0305\U030E\U10EEEE\U030D\U030D\U030E\n"
Here, ``U+30E`` is the diacritic corresponding to the number ``2``.
You can also specify a placement ID using the underline color (if it's omitted
or zero, the terminal may choose any virtual placement of the given image). The
background color is interpreted as the background color, visible if the image is
transparent. Other text attributes are reserved for future use.
Row, column and most significant byte diacritics may also be omitted, in which
case the placeholder cell will inherit the missing values from the placeholder
cell to the left, following the algorithm:
- If no diacritics are present, and the previous placeholder cell has the same
foreground and underline colors, then the row of the current cell will be the
row of the cell to the left, the column will be the column of the cell to the
left plus one, and the most significant image ID byte will be the most
significant image ID byte of the cell to the left.
- If only the row diacritic is present, and the previous placeholder cell has
the same row and the same foreground and underline colors, then the column of
the current cell will be the column of the cell to the left plus one, and the
most significant image ID byte will be the most significant image ID byte of
the cell to the left.
- If only the row and column diacritics are present, and the previous
placeholder cell has the same row, the same foreground and underline colors,
and its column is one less than the current column, then the most significant
image ID byte of the current cell will be the most significant image ID byte
of the cell to the left.
These rules are applied left-to-right, which allows specifying only row
diacritics of the first column, i.e. here is a 2 rows by 3 columns placeholder:
.. code-block:: sh
printf "\e[38;5;42m\U10EEEE\U0305\U10EEEE\U10EEEE\n"
printf "\e[38;5;42m\U10EEEE\U030D\U10EEEE\U10EEEE\n"
This will not work for horizontal scrolling and overlapping images since the two
given rules will fail to guess the missing information. In such cases, the
terminal may apply other heuristics (but it doesn't have to).
It is important to distinguish between virtual image placements and real images
displayed on top of Unicode placeholders. Virtual placements are invisible and only play
the role of prototypes for real images. Virtual placements can be deleted by a
deletion command only when the `d` key is equal to ``i``, ``I``, ``n`` or ``N``.
The key values ``a``, ``c``, ``p``, ``q``, ``x``, ``y``, ``z`` and their capital
variants never affect virtual placements because they do not have a physical
location on the screen.
Real images displayed on top of Unicode placeholders are not considered
placements from the protocol perspective. They cannot be manipulated using
graphics commands, instead they should be moved, deleted, or modified by
manipulating the underlying Unicode placeholder as normal text.
Deleting images
---------------------
@@ -745,6 +932,8 @@ Key Value Default Description
``r`` Positive integer ``0`` The number of rows to display the image over
``C`` Positive integer ``0`` Cursor movement policy. ``0`` is the default, to move the cursor to after the image.
``1`` is to not move the cursor at all when placing the image.
``U`` Positive integer ``0`` Set to ``1`` to create a virtual placement for a Unicode placeholder.
``1`` is to not move the cursor at all when placing the image.
``z`` 32-bit integer ``0`` The *z-index* vertical stacking order of the image
**Keys for animation frame loading**

View File

@@ -1,261 +0,0 @@
#!/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()

View File

@@ -1,292 +1,176 @@
#!/bin/sh
#
# installer.sh
# Copyright (C) 2018 Kovid Goyal <kovid at kovidgoyal.net>
#
# Distributed under terms of the GPLv3 license.
#
python=$(command -v python3)
if [ -z "$python" ]; then
python=$(command -v python2)
fi
if [ -z "$python" ]; then
python=$(command -v python2.7)
fi
if [ -z "$python" ]; then
python=$(command -v python)
fi
if [ -z "$python" ]; then
python=python
fi
{ \unalias command; \unset -f command; } >/dev/null 2>&1
tdir=''
cleanup() {
[ -n "$tdir" ] && {
command rm -rf "$tdir"
tdir=''
}
}
echo Using python executable: $python
die() {
cleanup
printf "\033[31m%s\033[m\n\r" "$*" > /dev/stderr;
exit 1;
}
$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
detect_network_tool() {
if command -v curl 2> /dev/null > /dev/null; then
fetch() {
command curl -fL "$1"
}
fetch_quiet() {
command curl -fsSL "$1"
}
elif command -v wget 2> /dev/null > /dev/null; then
fetch() {
command wget -O- "$1"
}
fetch_quiet() {
command wget --quiet -O- "$1"
}
else
die "Neither curl nor wget available, cannot download kitty"
fi
}
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)
detect_os() {
arch=""
case "$(command uname)" in
'Darwin') OS="macos";;
'Linux')
OS="linux"
case "$(command uname -m)" in
amd64|x86_64) arch="x86_64";;
aarch64*) arch="arm64";;
armv8*) arch="arm64";;
i386) arch="i686";;
i686) arch="i686";;
*) die "Unknown CPU architecture $(command uname -m)";;
esac
;;
*) die "kitty binaries are not available for $(command uname)"
esac
}
expand_tilde() {
tilde_less="${1#\~/}"
[ "$1" != "$tilde_less" ] && tilde_less="$HOME/$tilde_less"
printf '%s' "$tilde_less"
}
parse_args() {
dest='~/.local'
[ "$OS" = "macos" ] && dest="/Applications"
launch='y'
installer=''
while :; do
case "$1" in
dest=*) dest="${1#*=}";;
launch=*) launch="${1#*=}";;
installer=*) installer="${1#*=}";;
"") break;;
*) die "Unrecognized command line option: $1";;
esac
shift
done
dest=$(expand_tilde "${dest}")
[ "$launch" != "y" -a "$launch" != "n" ] && die "Unrecognized command line option: launch=$launch"
dest="$dest/kitty.app"
}
class Reporter: # {{{
get_file_url() {
url="https://github.com/kovidgoyal/kitty/releases/download/$1/kitty-$2"
if [ "$OS" = "macos" ]; then
url="$url.dmg"
else
url="$url-$arch.txz"
fi
}
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()
# }}}
get_release_url() {
release_version=$(fetch_quiet "https://sw.kovidgoyal.net/kitty/current-version.txt")
[ $? -ne 0 -o -z "$release_version" ] && die "Could not get kitty latest release version"
get_file_url "v$release_version" "$release_version"
}
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')
get_nightly_url() {
get_file_url "nightly" "nightly"
}
get_download_url() {
installer_is_file="n"
case "$installer" in
"nightly") get_nightly_url ;;
"") get_release_url ;;
*) installer_is_file="y" ;;
esac
}
def do_download(url, size, dest):
print('Will download and install', os.path.basename(dest))
reporter = Reporter(os.path.basename(dest))
download_installer() {
tdir=$(command mktemp -d "/tmp/kitty-install-XXXXXXXXXXXX")
[ "$installer_is_file" != "y" ] && {
printf '%s\n\n' "Downloading from: $url"
if [ "$OS" = "macos" ]; then
installer="$tdir/kitty.dmg"
else
installer="$tdir/kitty.txz"
fi
fetch "$url" > "$installer" || die "Failed to download: $url"
installer_is_file="y"
}
}
# 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)))
linux_install() {
command mkdir "$tdir/mp"
command tar -C "$tdir/mp" "-xJof" "$installer" || die "Failed to extract kitty tarball"
printf "%s\n" "Installing to $dest"
command rm -rf "$dest" || die "Failed to delete $dest"
command mv "$tdir/mp" "$dest" || die "Failed to move kitty.app to $dest"
}
macos_install() {
command mkdir "$tdir/mp"
command hdiutil attach "$installer" "-mountpoint" "$tdir/mp" || die "Failed to mount kitty.dmg"
printf "%s\n" "Installing to $dest"
command rm -rf "$dest"
command mkdir -p "$dest" || die "Failed to create the directory: $dest"
command ditto -v "$tdir/mp/kitty.app" "$dest"
rc="$?"
command hdiutil detach "$tdir/mp"
[ "$rc" != "0" ] && die "Failed to copy kitty.app from mounted dmg"
}
def clean_cache(cache, fname):
for x in os.listdir(cache):
if fname not in x:
os.remove(os.path.join(cache, x))
exec_kitty() {
if [ "$OS" = "macos" ]; then
exec "open" "$dest"
else
exec "$dest/bin/kitty" "--detach"
fi
die "Failed to launch kitty"
}
main() {
detect_os
parse_args "$@"
detect_network_tool
get_download_url
download_installer
if [ "$OS" = "macos" ]; then
macos_install
else
linux_install
fi
cleanup
[ "$launch" = "y" ] && exec_kitty
exit 0
}
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
main "$@"

View File

@@ -4,8 +4,8 @@ Integrations with other tools
================================
kitty provides extremely powerful interfaces such as :doc:`remote-control` and
:doc:`kittens/custom` and :doc:`kittens/icat`
that allow it to be integrated with other tools seamlessly.
:doc:`kittens/custom` and :doc:`kittens/icat` that allow it to be integrated
with other tools seamlessly.
Image and document viewers
@@ -30,19 +30,28 @@ Display markdown files nicely formatted with images in the terminal
`ranger <https://github.com/ranger/ranger>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
A terminal file manager, with previews of file contents powered by kitty's graphics protocol.
A terminal file manager, with previews of file contents powered by kitty's
graphics protocol.
.. _tool_nnn:
`nnn <https://github.com/jarun/nnn/>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Another terminal file manager, with previews of file contents powered by kitty's graphics protocol.
Another terminal file manager, with previews of file contents powered by kitty's
graphics protocol.
.. _tool_hunter:
`hunter <https://github.com/rabite0/hunter>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Another terminal file manager, with previews of file contents powered by kitty's graphics protocol.
Another terminal file manager, with previews of file contents powered by kitty's
graphics protocol.
.. _tool_term_image:
`term-image <https://github.com/AnonymouX47/term-image>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Tool to browse images in a terminal using kitty's graphics protocol.
.. _tool_koneko:
@@ -61,8 +70,8 @@ View images in the terminal, similar to kitty's icat.
`nb <https://github.com/xwmx/nb>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
command line and local web note-taking, bookmarking, archiving, and
knowledge base application that uses kitty's graphics protocol for images.
Command line and local web note-taking, bookmarking, archiving, and knowledge
base application that uses kitty's graphics protocol for images.
.. _tool_w3m:
@@ -71,13 +80,24 @@ knowledge base application that uses kitty's graphics protocol for images.
A text mode WWW browser that supports kitty's graphics protocol to display
images.
`awrit <https://github.com/chase/awrit>`__
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
A full Chromium based web browser running in the terminal using kitty's
graphics protocol.
.. _tool_mpv:
`mpv <https://github.com/mpv-player/mpv/commit/874e28f4a41a916bb567a882063dd2589e9234e1>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
A video player that can play videos in the terminal.
.. _tool_timg:
`timg <https://github.com/hzeller/timg>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
A terminal image and video viewer, that displays static and animated
images or plays videos. Fast multi-threaded loading, JPEG exif rotation,
grid view and connecting to the webcam make it a versatile terminal utility.
A terminal image and video viewer, that displays static and animated images or
plays videos. Fast multi-threaded loading, JPEG exif rotation, grid view and
connecting to the webcam make it a versatile terminal utility.
System and data visualisation tools
@@ -87,7 +107,8 @@ System and data visualisation tools
`neofetch <https://github.com/dylanaraps/neofetch>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
A command line system information tool that shows images using kitty's graphics protocol
A command line system information tool that shows images using kitty's graphics
protocol
.. _tool_matplotlib:
@@ -105,16 +126,16 @@ Show images from Julia directly in kitty
`euporie <https://github.com/joouha/euporie>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
A text-based user interface for running and editing Jupyter notebooks,
powered by kitty's graphics protocol for displaying plots
A text-based user interface for running and editing Jupyter notebooks, powered
by kitty's graphics protocol for displaying plots
.. _tool_gnuplot:
`gnuplot <http://www.gnuplot.info/>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
A graphing and data visualization tool that can be made to display its
output in kitty with the following bash snippet:
A graphing and data visualization tool that can be made to display its output in
kitty with the following bash snippet:
.. code-block:: sh
@@ -127,7 +148,7 @@ output in kitty with the following bash snippet:
set object 1 rectangle from screen 0,0 to screen 1,1 fillcolor rgb"#fdf6e3" behind
plot $@
set output '/dev/null'
EOF
EOF
}
Add this to bashrc and then to plot a function, simply do:
@@ -171,26 +192,28 @@ Run applications on your system with fuzzy find inside a kitty window
Editor integration
-----------------------
|kitty| can be integrated into many different terminal editors to add features
such a split windows, previews, REPLs etc.
|kitty| can be integrated into many different terminal based text editors to add
features such a split windows, previews, REPLs etc.
.. tool_kakoune:
`kakoune <https://kakoune.org/>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
integrates with kitty to use native kitty windows for its windows/panels and REPLs.
Integrates with kitty to use native kitty windows for its windows/panels and
REPLs.
.. tool_vim_slime:
`vim-slime <https://github.com/jpalardy/vim-slime#kitty>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
uses kitty remote control for a Lisp REPL.
Uses kitty remote control for a Lisp REPL.
.. tool_vim_kitty_navigator:
`vim-kitty-navigator <https://github.com/knubie/vim-kitty-navigator>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
allows you to navigate seamlessly between vim and kitty splits using a consistent set of hotkeys.
Allows you to navigate seamlessly between vim and kitty splits using a
consistent set of hotkeys.
.. tool_vim_test:
@@ -202,7 +225,8 @@ Allows easily running tests in a terminal window
`hologram.nvim <https://github.com/edluffy/hologram.nvim>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Terminal image viewer for nvim
Terminal image viewer for Neovim. For a bit of fun, you can even have `cats
running around inside nvim <https://github.com/giusgad/pets.nvim>`__.
Scrollback manipulation
@@ -228,21 +252,21 @@ Miscellaneous
`kitty-smart-tab <https://github.com/yurikhan/kitty-smart-tab>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
use keys to either control tabs or pass them onto running applications if
no tabs are present
Use keys to either control tabs or pass them onto running applications if no
tabs are present
.. tool_kitty_smart_scroll:
`kitty-smart-scroll <https://github.com/yurikhan/kitty-smart-scroll>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
use keys to either scroll or pass them onto running applications if
no scrollback buffer is present
Use keys to either scroll or pass them onto running applications if no
scrollback buffer is present
.. tool_kitti3:
`kitti3 <https://github.com/LandingEllipse/kitti3>`_
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
allow using kitty as a drop-down terminal under the i3 window manager
Allow using kitty as a drop-down terminal under the i3 window manager
.. tool_weechat_hints:

View File

@@ -35,9 +35,18 @@ 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 `WezTerm terminal <https://wezfurlong.org/wezterm/config/lua/config/enable_kitty_keyboard.html>`__
* The `notcurses library
<https://github.com/dankamongmen/notcurses/issues/2131>`__
* The `crossterm library
<https://github.com/crossterm-rs/crossterm/pull/688>`__
* The `Vim text editor <https://github.com/vim/vim/commit/63a2e360cca2c70ab0a85d14771d3259d4b3aafa>`__
* The `Emacs text editor via the kkp package <https://github.com/benjaminor/kkp>`__
* The `Neovim text editor <https://github.com/neovim/neovim/pull/18181>`__
* The `kakoune text editor <https://github.com/mawww/kakoune/issues/4103>`__
* The `dte text editor <https://gitlab.com/craigbarnes/dte/-/issues/138>`__
* The `Helix text editor <https://github.com/helix-editor/helix/pull/4939>`__
* The `far2l file manager <https://github.com/elfmz/far2l/commit/e1f2ee0ef2b8332e5fa3ad7f2e4afefe7c96fc3b>`__
.. versionadded:: 0.20.0
@@ -55,14 +64,14 @@ without too many changes, do the following:
that are easy to parse unambiguously.
#. Emit the escape sequence ``CSI < u`` at application exit if using the main
screen or just before leaving alternate screen mode if using the alternate screen,
to restore the previously used keyboard mode.
to restore whatever the keyboard mode was before step 1.
Key events will all be delivered to your application either as plain UTF-8
text, or using the following escape codes, for those keys that do not produce
text (``CSI`` is the bytes ``0x1b 0x5b``)::
CSI number ; modifiers [u~]
CSI 1; modifiers [ABCDEFHPQRS]
CSI 1; modifiers [ABCDEFHPQS]
0x0d - for the Enter key
0x7f or 0x08 - for Backspace
0x09 - for Tab
@@ -77,7 +86,7 @@ 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]``.
[ABCDEFHPQS]``.
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
@@ -308,7 +317,7 @@ With this flag turned on, all key events that do not generate text are
represented in one of the following two forms::
CSI number; modifier u
CSI 1; modifier [~ABCDEFHPQRS]
CSI 1; modifier [~ABCDEFHPQS]
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
@@ -376,7 +385,7 @@ An application can query the terminal for support of this protocol by sending
the escape code querying for the :ref:`current progressive enhancement
<progressive_enhancement>` status
followed by request for the `primary device attributes
<https://vt100.net/docs/vt510-rm/DA1.html>`. If an answer for the device
<https://vt100.net/docs/vt510-rm/DA1.html>`__. If an answer for the device
attributes is received without getting back an answer for the progressive
enhancement the terminal does not support this protocol.
@@ -399,7 +408,7 @@ Legacy functional keys
These keys are encoded using three schemes::
CSI number ; modifier ~
CSI 1 ; modifier {ABCDEFHPQRS}
CSI 1 ; modifier {ABCDEFHPQS}
SS3 {ABCDEFHPQRS}
In the above, if there are no modifiers, the modifier parameter is omitted.
@@ -527,7 +536,7 @@ compatibility reasons.
"NUM_LOCK", "``57360 u``", "PRINT_SCREEN", "``57361 u``"
"PAUSE", "``57362 u``", "MENU", "``57363 u``"
"F1", "``1 P or 11 ~``", "F2", "``1 Q or 12 ~``"
"F3", "``1 R or 13 ~``", "F4", "``1 S or 14 ~``"
"F3", "``13 ~``", "F4", "``1 S or 14 ~``"
"F5", "``15 ~``", "F6", "``17 ~``"
"F7", "``18 ~``", "F8", "``19 ~``"
"F9", "``20 ~``", "F10", "``21 ~``"
@@ -576,8 +585,14 @@ compatibility reasons.
.. end functional key table
.. }}}
Note that the escape codes above of the form ``CSI 1 letter`` will omit the
``1`` if there are no modifiers, since ``1`` is the default value.
.. note::
The escape codes above of the form ``CSI 1 letter`` will omit the
``1`` if there are no modifiers, since ``1`` is the default value.
.. note::
The original version of this specification allowed F3 to be encoded as both
CSI R and CSI ~. However, CSI R conflicts with the Cursor Position Report,
so it was removed.
.. _ctrl_mapping:
@@ -670,3 +685,31 @@ specification.
* Handwaves that :kbd:`ctrl` *tends to* mask with ``0x1f``. In actual fact it
does this only for some keys. The action of :kbd:`ctrl` is not specified and
varies between terminals, historically because of different keyboard layouts.
Why xterm's modifyOtherKeys should not be used
---------------------------------------------------
* Does not support release events
* Does not fix the issue of :kbd:`Esc` key presses not being distinguishable from
escape codes.
* Does not fix the issue of some keypresses generating identical bytes and thus
being indistinguishable
* There is no robust way to query it or manage its state from a program running
in the terminal.
* No support for shifted keys.
* No support for alternate keyboard layouts.
* No support for modifiers beyond the basic four.
* No support for lock keys like Num lock and Caps lock.
* Is completely unspecified. The most discussion of it available anywhere is
`here <https://invisible-island.net/xterm/modified-keys.html>`__
And it contains no specification of what numbers to assign to what function
keys beyond running a Perl script on an X11 system!!

View File

@@ -3,18 +3,21 @@ broadcast
*Type text in all kitty windows simultaneously*
The ``broadcast`` kitten can be used to type text simultaneously in
all kitty windows (or a subset as desired).
The ``broadcast`` kitten can be used to type text simultaneously in all
:term:`kitty windows <window>` (or a subset as desired).
To use it, simply create a mapping in :file:`kitty.conf` such as::
map F1 launch --allow-remote-control kitty +kitten broadcast
map f1 launch --allow-remote-control kitty +kitten broadcast
Then press the :kbd:`F1` key and whatever you type in the newly created widow
Then press the :kbd:`F1` key and whatever you type in the newly created window
will be sent to all kitty windows.
You can use the options described below to control which windows
are selected.
You can use the options described below to control which windows are selected.
For example, only broadcast to other windows in the current tab::
map f1 launch --allow-remote-control kitty +kitten broadcast --match-tab state:focused
.. program:: kitty +kitten broadcast

View File

@@ -11,14 +11,46 @@ from the shell. It even works over SSH. Using it is as simple as::
echo hooray | kitty +kitten clipboard
All text received on :file:`stdin` is copied to the clipboard.
All text received on :file:`STDIN` is copied to the clipboard.
To get text from the clipboard you have to enable reading of the clipboard
in :opt:`clipboard_control` in :file:`kitty.conf`. Once you do that, you can
use::
To get text from the clipboard::
kitty +kitten clipboard --get-clipboard
The text will be written to :file:`STDOUT`. Note that by default kitty asks for
permission when a program attempts to read the clipboard. This can be
controlled via :opt:`clipboard_control`.
.. versionadded:: 0.27.0
Support for copying arbitrary data types
The clipboard kitten can be used to send/receive
more than just plain text from the system clipboard. You can transfer arbitrary
data types. Best illustrated with some examples::
# Copy an image to the clipboard:
kitty +kitten clipboard picture.png
# Copy an image and some text to the clipboard:
kitty +kitten clipboard picture.jpg text.txt
# Copy text from STDIN and an image to the clipboard:
echo hello | kitty +kitten clipboard picture.png /dev/stdin
# Copy any raster image available on the clipboard to a PNG file:
kitty +kitten clipboard -g picture.png
# Copy an image to a file and text to STDOUT:
kitty +kitten clipboard -g picture.png /dev/stdout
# List the formats available on the system clipboard
kitty +kitten clipboard -g -m . /dev/stdout
Normally, the kitten guesses MIME types based on the file names. To control the
MIME types precisely, use the :option:`--mime <kitty +kitten clipboard --mime>` option.
This kitten uses a new protocol developed by kitty to function, for details,
see :doc:`/clipboard`.
.. program:: kitty +kitten clipboard

View File

@@ -1,21 +1,20 @@
Custom kittens
=================
You can easily create your own kittens to extend kitty. They are just
terminal programs written in Python. When launching a kitten, kitty will
open an overlay window over the current window and optionally pass the
contents of the current window/scrollback to the kitten over its :file:`STDIN`.
The kitten can then perform whatever actions it likes, just as a normal
terminal program. After execution of the kitten is complete, it has access
to the running kitty instance so it can perform arbitrary actions
such as closing windows, pasting text, etc.
You can easily create your own kittens to extend kitty. They are just terminal
programs written in Python. When launching a kitten, kitty will open an overlay
window over the current window and optionally pass the contents of the current
window/scrollback to the kitten over its :file:`STDIN`. The kitten can then
perform whatever actions it likes, just as a normal terminal program. After
execution of the kitten is complete, it has access to the running kitty instance
so it can perform arbitrary actions such as closing windows, pasting text, etc.
Let's see a simple example of creating a kitten. It will ask the user for some
input and paste it into the terminal window.
Create a file in the kitty config folder, :file:`~/.config/kitty/mykitten.py`
(you might need to adjust the path to wherever the kitty config folder is on
your machine).
Create a file in the kitty config directory, :file:`~/.config/kitty/mykitten.py`
(you might need to adjust the path to wherever the :ref:`kitty config directory
<confloc>` is on your machine).
.. code-block:: python
@@ -35,7 +34,7 @@ your machine).
# get the kitty window into which to paste answer
w = boss.window_id_map.get(target_window_id)
if w is not None:
w.paste(answer)
w.paste_text(answer)
Now in :file:`kitty.conf` add the lines::
@@ -43,11 +42,30 @@ Now in :file:`kitty.conf` add the lines::
map ctrl+k kitten mykitten.py
Start kitty and press :kbd:`ctrl+k` and you should see the kitten running.
The best way to develop your own kittens is to modify one of the built in
kittens. Look in the kittens sub-directory of the kitty source code for those.
Or see below for a list of :ref:`third-party kittens <external_kittens>`,
that other kitty users have created.
Start kitty and press :kbd:`Ctrl+K` and you should see the kitten running.
The best way to develop your own kittens is to modify one of the built-in
kittens. Look in the `kittens sub-directory
<https://github.com/kovidgoyal/kitty/tree/master/kittens>`__ of the kitty source
code for those. Or see below for a list of :ref:`third-party kittens
<external_kittens>`, that other kitty users have created.
kitty API to use with kittens
-------------------------------
Kittens have full access to internal kitty APIs. However these are neither
entirely stable nor documented. You can instead use the kitty
:doc:`Remote control API </remote-control>`. Simply call
:code:`boss.call_remote_control()`, with the same arguments you
would pass to ``kitty @``. For example:
.. code-block:: python
def handle_result(args: List[str], answer: str, target_window_id: int, boss: Boss) -> None:
# get the kitty window to which to send text
w = boss.window_id_map.get(target_window_id)
if w is not None:
boss.call_remote_control(w, ('send-text', 'hello world'))
Passing arguments to kittens
@@ -60,36 +78,40 @@ You can pass arguments to kittens by defining them in the map directive in
These will be available as the ``args`` parameter in the ``main()`` and
``handle_result()`` functions. Note also that the current working directory
of the kitten is set to the working directory of whatever program is
running in the active kitty window. The special argument ``@selection``
is replaced by the currently selected text in the active kitty window.
of the kitten is set to the working directory of whatever program is running in
the active kitty window. The special argument ``@selection`` is replaced by the
currently selected text in the active kitty window.
Passing the contents of the screen to the kitten
---------------------------------------------------
If you would like your kitten to have access to the contents of the screen
and/or the scrollback buffer, you just need to add an annotation to the ``handle_result()``
function, telling kitty what kind of input your kitten would like. For example:
and/or the scrollback buffer, you just need to add an annotation to the
``handle_result()`` function, telling kitty what kind of input your kitten would
like. For example:
.. code-block:: py
from typing import List
from kitty.boss import Boss
# in main, STDIN is for the kitten process and will contain
# the contents of the screen
def main(args):
def main(args: List[str]) -> str:
return sys.stdin.read()
# in handle_result, STDIN is for the kitty process itself, rather
# than the kitten process and should not be read from.
from kittens.tui.handler import result_handler
@result_handler(type_of_input='text')
def handle_result(args, stdin_data, target_window_id, boss):
def handle_result(args: List[str], stdin_data: str, target_window_id: int, boss: Boss) -> None:
pass
This will send the plain text of the active window to the kitten's
:file:`STDIN`. There are many other types of input you can ask for,
described in the table below:
: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
@@ -121,31 +143,35 @@ 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.
For the types based on the output of a command, :ref:`shell_integration` is
required.
Using kittens to script kitty, without any terminal UI
-----------------------------------------------------------
If you would like your kitten to script kitty, without bothering to write a
terminal program, you can tell the kittens system to run the
``handle_result()`` function without first running the ``main()`` function.
terminal program, you can tell the kittens system to run the ``handle_result()``
function without first running the ``main()`` function.
For example, here is a kitten that "zooms/unzooms" the current terminal window
by switching to the stack layout or back to the previous layout. This is
equivalent to the builtin :ref:`action-toggle_layout` action.
For example, here is a kitten that "zooms in/zooms out" the current terminal
window by switching to the stack layout or back to the previous layout. This is
equivalent to the builtin :ac:`toggle_layout` action.
Create a file in the kitty config folder, :file:`~/.config/kitty/zoom_toggle.py`
Create a Python file in the :ref:`kitty config directory <confloc>`,
:file:`~/.config/kitty/zoom_toggle.py`
.. code-block:: py
def main(args):
from typing import List
from kitty.boss import Boss
def main(args: List[str]) -> str:
pass
from kittens.tui.handler import result_handler
@result_handler(no_ui=True)
def handle_result(args, answer, target_window_id, boss):
def handle_result(args: List[str], answer: str, target_window_id: int, boss: Boss) -> None:
tab = boss.active_tab
if tab is not None:
if tab.current_layout.name == 'stack':
@@ -154,7 +180,7 @@ Create a file in the kitty config folder, :file:`~/.config/kitty/zoom_toggle.py`
tab.goto_layout('stack')
Now in kitty.conf add::
Now in :file:`kitty.conf` add::
map f11 kitten zoom_toggle.py
@@ -165,7 +191,7 @@ layout, by simply adding the line::
boss.toggle_fullscreen()
To the ``handle_result()`` function, above.
to the ``handle_result()`` function, above.
.. _send_mouse_event:
@@ -173,7 +199,7 @@ To the ``handle_result()`` function, above.
Sending mouse events
--------------------
If the program running in a window is receiving mouse events you can simulate
If the program running in a window is receiving mouse events, you can simulate
those using::
from kitty.fast_data_types import send_mouse_event
@@ -200,15 +226,15 @@ that type, and will return ``True`` if it sent the event, and ``False`` if not.
Debugging kittens
--------------------
The part of the kitten that runs in ``main()`` is just a normal program and
the output of print statements will be visible in the kitten window. Or
alternately, you can use::
The part of the kitten that runs in ``main()`` is just a normal program and the
output of print statements will be visible in the kitten window. Or alternately,
you can use::
from kittens.tui.loop import debug
debug('whatever')
The ``debug()`` function is just like ``print()`` except that the output
will appear in the ``STDOUT`` of the kitty process inside which the kitten is
The ``debug()`` function is just like ``print()`` except that the output will
appear in the ``STDOUT`` of the kitty process inside which the kitten is
running.
The ``handle_result()`` part of the kitten runs inside the kitty process.
@@ -216,12 +242,13 @@ The output of print statements will go to the ``STDOUT`` of the kitty process.
So if you run kitty from another kitty instance, the output will be visible
in the first kitty instance.
Adding options to kittens
----------------------------
If you would like to use kitty's config framework to make your kittens
configurable, you will need some boilerplate. In the directory
of your kitten make the following files.
configurable, you will need some boilerplate. Put the following files in the
directory of your kitten.
:file:`kitten_options_definition.py`
@@ -311,8 +338,9 @@ You can parse and read the options in your kitten using the following code:
opts.config_overrides = overrides
return opts
See the code for the builtin diff kitten for examples of creating more options
and keyboard shortcuts.
See `the code <https://github.com/kovidgoyal/kitty/tree/master/kittens/diff>`__
for the builtin :doc:`diff kitten </kittens/diff>` for examples of creating more
options and keyboard shortcuts.
.. _external_kittens:
@@ -320,7 +348,8 @@ Kittens created by kitty users
---------------------------------------------
`vim-kitty-navigator <https://github.com/knubie/vim-kitty-navigator>`_
Allows you to navigate seamlessly between vim and kitty splits using a consistent set of hotkeys.
Allows you to navigate seamlessly between vim and kitty splits using a
consistent set of hotkeys.
`smart-scroll <https://github.com/yurikhan/kitty-smart-scroll>`_
Makes the kitty scroll bindings work in full screen applications

View File

@@ -12,8 +12,8 @@ Major Features
* Displays diffs side-by-side in the kitty terminal
* Does syntax highlighting of the displayed diffs, asynchronously, for maximum
speed
* Does syntax highlighting of the displayed diffs, asynchronously, for
maximum speed
* Displays images as well as text diffs, even over SSH
@@ -31,11 +31,7 @@ Major Features
Installation
---------------
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 official kitty binary builds).
Simply :ref:`install kitty <quickstart>`.
Usage
@@ -45,9 +41,10 @@ In the kitty terminal, run::
kitty +kitten diff file1 file2
to see the diff between file1 and file2.
to see the diff between :file:`file1` and :file:`file2`.
Create an alias in your shell's startup file to shorten the command, for example:
Create an alias in your shell's startup file to shorten the command, for
example:
.. code-block:: sh
@@ -64,36 +61,38 @@ directory contents.
Keyboard controls
----------------------
========================= ===========================
Action Shortcut
========================= ===========================
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`, :kbd:`PgDn`
Scroll to previous page :kbd:`PgUp`
Scroll to next change :kbd:`n`
Scroll to previous change :kbd:`p`
Increase lines of context :kbd:`+`
Decrease lines of context :kbd:`-`
All lines of context :kbd:`a`
Restore default context :kbd:`=`
Search forwards :kbd:`/`
Search backwards :kbd:`?`
Clear search :kbd:`Esc`
Scroll to next match :kbd:`>`, :kbd:`.`
Scroll to previous match :kbd:`<`, :kbd:`,`
========================= ===========================
=========================== ===========================
Action Shortcut
=========================== ===========================
Quit :kbd:`Q`, :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`, :kbd:`PgDn`
Scroll to previous page :kbd:`PgUp`
Scroll to next change :kbd:`N`
Scroll to previous change :kbd:`P`
Increase lines of context :kbd:`+`
Decrease lines of context :kbd:`-`
All lines of context :kbd:`A`
Restore default context :kbd:`=`
Search forwards :kbd:`/`
Search backwards :kbd:`?`
Clear search :kbd:`Esc`
Scroll to next match :kbd:`>`, :kbd:`.`
Scroll to previous match :kbd:`<`, :kbd:`,`
Copy selection to clipboard :kbd:`y`
Copy selection or exit :kbd:`Ctrl+C`
=========================== ===========================
Integrating with git
-----------------------
Add the following to `~/.gitconfig`:
Add the following to :file:`~/.gitconfig`:
.. code-block:: ini
@@ -119,24 +118,23 @@ Why does this work only in kitty?
----------------------------------------
The diff kitten makes use of various features that are :doc:`kitty only
</protocol-extensions>`, such as the :doc:`kitty graphics protocol
</protocol-extensions>`, such as the :doc:`kitty graphics protocol
</graphics-protocol>`, the :doc:`extended keyboard protocol
</keyboard-protocol>`, etc. It also leverages terminal program
infrastructure I created for all of kitty's other kittens to reduce the amount
of code needed (the entire implementation is under 2000 lines of code).
</keyboard-protocol>`, etc. It also leverages terminal program infrastructure
I created for all of kitty's other kittens to reduce the amount of code needed
(the entire implementation is under 3000 lines of code).
And fundamentally, it's kitty only because I wrote it for myself, and I am
highly unlikely to use any other terminals :)
Configuration
------------------------
You can configure the colors used, keyboard shortcuts, the diff implementation,
the default lines of context, etc. by creating a :file:`diff.conf` file in
your :ref:`kitty config folder <confloc>`. See below for the supported
configuration directives.
the default lines of context, etc. by creating a :file:`diff.conf` file in your
:ref:`kitty config folder <confloc>`. See below for the supported configuration
directives.
.. include:: /generated/conf-kitten-diff.rst
@@ -145,7 +143,6 @@ configuration directives.
.. include:: /generated/cli-kitten-diff.rst
Sample diff.conf
-----------------

View File

@@ -1,9 +1,9 @@
Hints
==========
|kitty| has a *hints mode* to select and act on arbitrary text snippets currently
visible on the screen. For example, you can press :sc:`open_url`
to choose any URL visible on the screen and then open it using your system
|kitty| has a *hints mode* to select and act on arbitrary text snippets
currently visible on the screen. For example, you can press :sc:`open_url`
to choose any URL visible on the screen and then open it using your default web
browser.
.. figure:: ../screenshots/hints_mode.png
@@ -13,25 +13,29 @@ browser.
URL hints mode
Similarly, you can press :sc:`insert_selected_path` to
select anything that looks like a path or filename and then insert it into the
terminal, very useful for picking files from the output of a ``git`` or ``ls`` command and
adding them to the command line for the next command.
Similarly, you can press :sc:`insert_selected_path` to select anything that
looks like a path or filename and then insert it into the terminal, very useful
for picking files from the output of a :program:`git` or :program:`ls` command
and adding them to the command line for the next command.
You can also press :sc:`goto_file_line` to select anything that looks
like a path or filename followed by a colon and a line number and open
the file in vim at the specified line number. The patterns and editor
to be used can be modified using options passed to the kitten. For example::
You can also press :sc:`goto_file_line` to select anything that looks like a
path or filename followed by a colon and a line number and open the file in
:program:`vim` at the specified line number. The patterns and editor to be used
can be modified using options passed to the kitten. For example::
map ctrl+g kitten hints --type=linenum --linenum-action=tab nvim +{line} {path}
will open the selected file in a new tab inside neovim when you press
:kbd:`ctrl+g`.
will open the selected file in a new tab inside `Neovim <https://neovim.io/>`__
when you press :kbd:`Ctrl+G`.
Pressing :sc:`open_selected_hyperlink` will open hyperlinks, i.e. a URL
Pressing :sc:`open_selected_hyperlink` will open :term:`hyperlinks`, i.e. a URL
that has been marked as such by the program running in the terminal,
for example, by ``ls --hyperlink=auto``. You can also :doc:`customize what actions are
taken for different types of URLs <../open_actions>`.
for example, by ``ls --hyperlink=auto``. If :program:`ls` comes with your OS
does not support hyperlink, you may need to install `GNU Coreutils
<https://www.gnu.org/software/coreutils/>`__.
You can also :doc:`customize what actions are taken for different types of URLs
<../open_actions>`.
.. note:: If there are more hints than letters, hints will use multiple
letters. In this case, when you press the first letter, only hints
@@ -48,13 +52,12 @@ snippets. See :sc:`insert_selected_path <insert_selected_path>` for examples.
Completely customizing the matching and actions of the kitten
---------------------------------------------------------------
The hints kitten supports writing simple python scripts that can be used to
The hints kitten supports writing simple Python scripts that can be used to
completely customize how it finds matches and what happens when a match is
selected. This allows the hints kitten to provide the user interface, while
you can provide the logic for finding matches and performing actions on them.
This is best illustrated with an example. Create the file
:file:`custom-hints.py` in the kitty config directory with the following
contents:
selected. This allows the hints kitten to provide the user interface, while you
can provide the logic for finding matches and performing actions on them. This
is best illustrated with an example. Create the file :file:`custom-hints.py` in
the :ref:`kitty config directory <confloc>` with the following contents:
.. code-block:: python
@@ -69,7 +72,8 @@ contents:
start, end = m.span()
mark_text = text[start:end].replace('\n', '').replace('\0', '')
# The empty dictionary below will be available as groupdicts
# in handle_result() and can contain arbitrary data.
# in handle_result() and can contain string keys and arbitrary JSON
# serializable values.
yield Mark(idx, start, end, mark_text, {})
@@ -98,9 +102,10 @@ look it up in the Google dictionary.
.. note::
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::
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::
action_alias myhints kitten hints --alphabet qfjdkslaureitywovmcxzpq1234567890
map f1 myhints --customize-processing custom-hints.py

View File

@@ -1,11 +1,10 @@
Hyperlinked grep
=================
This kitten allows you to search your files using `ripgrep
<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.
<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.
.. versionadded:: 0.19.0
@@ -18,68 +17,57 @@ following contents:
# by the hyperlink_grep kitten and nothing else so far.
protocol file
fragment_matches [0-9]+
action launch --type=overlay vim +${FRAGMENT} ${FILE_PATH}
action launch --type=overlay --cwd=current vim +${FRAGMENT} ${FILE_PATH}
# Open text files without fragments in the editor
protocol file
mime text/*
action launch --type=overlay ${EDITOR} ${FILE_PATH}
action launch --type=overlay --cwd=current ${EDITOR} ${FILE_PATH}
Now, run a search with::
kitty +kitten hyperlinked_grep something
Hold down the :kbd:`ctrl+shift` keys and click on any of the
result lines, to open the file in vim at the matching line. If
you use some editor other than vim, you should adjust the
:file:`open-actions.conf` file accordingly.
Hold down the :kbd:`Ctrl+Shift` keys and click on any of the result lines, to
open the file in :program:`vim` at the matching line. If you use some editor
other than :program:`vim`, you should adjust the :file:`open-actions.conf` file
accordingly.
Finally, add an alias to your shell's rc files to invoke the kitten as ``hg``::
Finally, add an alias to your shell's rc files to invoke the kitten as
:command:`hg`::
alias hg='kitty +kitten hyperlinked_grep'
alias hg="kitty +kitten hyperlinked_grep"
You can now run searches with::
hg some-search-term
If you want to enable completion, for the kitten, you can delegate completion
to rg. How to do that varies based on the shell:
.. tab:: zsh
Instead of using an alias create a simple wrapper script named
:file:`hg` somewhere in your ``PATH``:
.. code-block:: sh
#!/bin/sh
exec kitty +kitten hyperlinked_grep "$@"
Then, add the following to :file:`.zshrc`::
compdef _rg hg
.. tab:: fish
You can combine both the aliasing/wrapping and pointing fish
to rg's autocompletion with a fish "wrapper" function in your :file:`config.fish`:
.. code-block:: sh
function hg --wraps rg; kitty +kitten hyperlinked_grep $argv; end
To learn more about kitty's powerful framework for customizing URL click
actions, :doc:`see here </open_actions>`.
actions, see :doc:`here </open_actions>`.
By default, this kitten adds hyperlinks for several parts of ripgrep output:
the per-file header, match context lines, and match lines. You can control
which items are linked with a :code:`--kitten hyperlink` flag. For example,
:code:`--kitten hyperlink=matching_lines` will only add hyperlinks to the
match lines. :code:`--kitten hyperlink=file_headers,context_lines` will link
file headers and context lines but not match lines. :code:`--kitten
hyperlink=none` will cause the command line to be passed to directly to
:command:`rg` so no hyperlinking will be performed. :code:`--kitten hyperlink`
may be specified multiple times.
Hopefully, someday this functionality will make it into some `upstream grep
<https://github.com/BurntSushi/ripgrep/issues/665>`_
program directly removing the need for this kitten.
<https://github.com/BurntSushi/ripgrep/issues/665>`__ program directly removing
the need for this kitten.
.. note::
While you can pass any of ripgrep's comand line options to the kitten and
they will be forwarded to rg, do not use options that change the output
formatting as the kitten works by parsing the output from ripgrep.
they will be forwarded to :program:`rg`, do not use options that change the
output formatting as the kitten works by parsing the output from ripgrep.
The unsupported options are: :code:`--context-separator`,
:code:`--field-context-separator`, :code:`--field-match-separator`,
:code:`--json`, :code:`-I --no-filename`, :code:`-0 --null`,
:code:`--null-data`, :code:`--path-separator`. If you specify options via
configuration file, then any changes to the default output format will not be
supported, not just the ones listed.

View File

@@ -7,10 +7,11 @@ The ``icat`` kitten can be used to display arbitrary images in the |kitty|
terminal. Using it is as simple as::
kitty +kitten icat image.jpeg
kitten icat image.jpeg
It supports all image types supported by `ImageMagick
<https://www.imagemagick.org>`_. It even works over SSH. For details, see
the :doc:`kitty graphics protocol </graphics-protocol>`.
<https://www.imagemagick.org>`__. It even works over SSH. For details, see the
:doc:`kitty graphics protocol </graphics-protocol>`.
You might want to create an alias in your shell's configuration files::
@@ -20,14 +21,15 @@ Then you can simply use ``icat image.png`` to view images.
.. note::
`ImageMagick <https://www.imagemagick.org>`_ must be installed for ``icat`` to
work.
`ImageMagick <https://www.imagemagick.org>`__ must be installed for the
full range of image types. Without it only PNG/JPG/GIF/BMP/TIFF/WEBP are
supported.
.. note::
kitty's image display protocol may not work when used within a terminal
multiplexer such as ``screen`` or ``tmux``, depending on whether the
multiplexer has added support for it or not.
multiplexer such as :program:`screen` or :program:`tmux`, depending on
whether the multiplexer has added support for it or not.
.. program:: kitty +kitten icat
@@ -35,18 +37,18 @@ Then you can simply use ``icat image.png`` to view images.
The ``icat`` kitten has various command line arguments to allow it to be used
from inside other programs to display images. In particular, :option:`--place`,
:option:`--detect-support`, :option:`--silent` and :option:`--print-window-size`.
:option:`--detect-support` and :option:`--print-window-size`.
If you are trying to integrate icat into a complex program like a file
manager or editor, there are a few things to keep in mind. icat works by
communicating over the TTY device, it both writes to and reads from the TTY.
So it is imperative that while it is running the host program does not do
any TTY I/O. Any key presses or other input from the user on the TTY device
will be discarded. At a minimum, you should use the :option:`--silent` and
:option:`--transfer-mode` command line arguments. To be
really robust you should consider writing proper support for the
:doc:`../graphics-protocol` in the program instead. Nowadays there are many
libraries that have support for it.
If you are trying to integrate icat into a complex program like a file manager
or editor, there are a few things to keep in mind. icat works by communicating
over the TTY device, it both writes to and reads from the TTY. So it is
imperative that while it is running the host program does not do any TTY I/O.
Any key presses or other input from the user on the TTY device will be
discarded. At a minimum, you should use the :option:`--transfer-mode`
command line arguments. To be really robust you should
consider writing proper support for the :doc:`kitty graphics protocol
</graphics-protocol>` in the program instead. Nowadays there are many libraries
that have support for it.
.. include:: /generated/cli-kitten-icat.rst

View File

@@ -4,8 +4,8 @@ Draw a GPU accelerated dock panel on your desktop
.. highlight:: sh
You can use this kitten to draw a GPU accelerated panel on the edge
of your screen, that shows the output from an arbitrary terminal program.
You can use this kitten to draw a GPU accelerated panel on the edge of your
screen, that shows the output from an arbitrary terminal program.
It is useful for showing status information or notifications on your desktop
using terminal programs instead of GUI toolkits.
@@ -32,8 +32,8 @@ Using this kitten is simple, for example::
kitty +kitten panel sh -c 'printf "\n\n\nHello, world."; sleep 5s'
This will show ``Hello, world.`` at the top edge of your screen for five
seconds. Here the terminal program we are running is ``sh`` with a script to
print out ``Hello, world!``. You can make the terminal program as complex as
seconds. Here the terminal program we are running is :program:`sh` with a script
to print out ``Hello, world!``. You can make the terminal program as complex as
you like, as demonstrated in the screenshot above.

View File

@@ -1,18 +1,18 @@
Query terminal
=================
Used to query kitty from terminal programs about version, values of various
runtime options controlling its features, etc.
This kitten is used to query |kitty| from terminal programs about version, values
of various runtime options controlling its features, etc.
The querying is done using the (*semi*) standard XTGETTCAP escape sequence
pioneered by XTerm, so it works over SSH as well. The downside is that it
is slow, since it requires a roundtrip to the terminal emulator and back.
pioneered by xterm, so it works over SSH as well. The downside is that it is
slow, since it requires a roundtrip to the terminal emulator and back.
If you want to do some of the same querying in your terminal program without
depending on the kitten, you can do so, by processing the same escape codes.
Search `this page <https://invisible-island.net/xterm/ctlseqs/ctlseqs.html>`_
for *XTGETTCAP* to see the syntax for the escape code and read the source
of this kitten to find the values of the keys for the various queries.
Search `this page <https://invisible-island.net/xterm/ctlseqs/ctlseqs.html>`__
for *XTGETTCAP* to see the syntax for the escape code and read the source of
this kitten to find the values of the keys for the various queries.
.. include:: ../generated/cli-kitten-query_terminal.rst

View File

@@ -1,12 +1,12 @@
Remote files
==============
|kitty| has the ability to easily *Edit*, *Open* or *Download* files
from a computer into which you are SSHed. In your SSH session run::
|kitty| has the ability to easily *Edit*, *Open* or *Download* files from a
computer into which you are SSHed. In your SSH session run::
ls --hyperlink=auto
Then hold down :kbd:`ctrl+shift` and click the name of the file.
Then hold down :kbd:`Ctrl+Shift` and click the name of the file.
.. figure:: ../screenshots/remote_file.png
:alt: Remote file actions
@@ -19,23 +19,28 @@ Then hold down :kbd:`ctrl+shift` and click the name of the file.
to *Edit* it in which case kitty will download it and open it locally in your
:envvar:`EDITOR`. As you make changes to the file, they are automatically
transferred to the remote computer. Note that this happens without needing
to install *any* special software on the server, beyond ``ls`` that supports
hyperlinks.
to install *any* special software on the server, beyond :program:`ls` that
supports hyperlinks.
.. seealso:: See the :ref:`edit-in-kitty <edit_file>` command
.. 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
For best results, use this kitten with the :doc:`ssh kitten <./ssh>`.
Otherwise, nested SSH sessions are not supported. The kitten will always try to copy
remote files from the first SSH host. This is because, without the ssh
kitten, there is no way for
|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
editing starts you will be asked to enter your password just once,
thereafter the SSH connection will be re-used.
If you have not setup automatic password-less SSH access, and are not using
the ssh kitten, then, when editing
starts you will be asked to enter your password just once, thereafter the SSH
connection will be re-used.
Similarly, you can choose to save the file to the local computer or download
and open it in its default file handler.

203
docs/kittens/ssh.rst Normal file
View File

@@ -0,0 +1,203 @@
Truly convenient SSH
=========================================
* Automatic :ref:`shell_integration` on remote hosts
* Easily :ref:`clone local shell/editor config <real_world_ssh_kitten_config>` on remote hosts
* Automatic :opt:`re-use of existing connections <kitten-ssh.share_connections>` to avoid connection setup latency
* Make kitty itself available in the remote host :opt:`on demand <kitten-ssh.remote_kitty>`
* Easily :opt:`change terminal colors <kitten-ssh.color_scheme>` when connecting to remote hosts
.. versionadded:: 0.25.0
Automatic shell integration, file transfer and reuse of connections
The ssh kitten allows you to login easily to remote hosts, and automatically
setup the environment there to be as comfortable as your local shell. You can
specify environment variables to set on the remote host and files to copy there,
making your remote experience just like your local shell. Additionally, it
automatically sets up :ref:`shell_integration` on the remote host and copies the
kitty terminfo database there.
The ssh kitten is a thin wrapper around the traditional `ssh <https://man.openbsd.org/ssh>`__
command line program and supports all the same options and arguments and configuration.
In interactive usage scenarios it is a drop in replacement for :program:`ssh`.
To try it out, simply run:
.. code-block:: sh
kitty +kitten ssh some-hostname-to-connect-to
You should end up at a shell prompt on the remote host, with shell integration
enabled. If you like it you can add an alias to it in your shell's rc files:
.. code-block:: sh
alias s="kitty +kitten ssh"
So now you can just type ``s hostname`` to connect.
If you define a mapping in :file:`kitty.conf` such as::
map f1 new_window_with_cwd
Then, pressing :kbd:`F1` will open a new window automatically logged into the
same host using the ssh kitten, at the same directory.
The ssh kitten can be configured using the :file:`~/.config/kitty/ssh.conf` file
where you can specify environment variables to set on the remote host and files
to copy from the local to the remote host. Let's see a quick example:
.. code-block:: conf
# Copy the files and directories needed to setup some common tools
copy .zshrc .vimrc .vim
# Setup some environment variables
env SOME_VAR=x
# COPIED_VAR will have the same value on the remote host as it does locally
env COPIED_VAR=_kitty_copy_env_var_
# Create some per hostname settings
hostname someserver-*
copy env-files
env SOMETHING=else
hostname someuser@somehost
copy --dest=foo/bar some-file
copy --glob some/files.*
See below for full details on the syntax and options of :file:`ssh.conf`.
Additionally, you can pass config options on the command line:
.. code-block:: sh
kitty +kitten ssh --kitten interpreter=python servername
The :code:`--kitten` argument can be specified multiple times, with directives
from :file:`ssh.conf`. These are merged with :file:`ssh.conf` as if they were
appended to the end of that file. They apply only to the host being SSHed to by
this invocation, so any :opt:`hostname <kitten-ssh.hostname>` directives are
ignored.
.. warning::
Due to limitations in the design of SSH, any typing you do before the
shell prompt appears may be lost. So ideally don't start typing till you see
the shell prompt. 😇
.. _real_world_ssh_kitten_config:
A real world example
----------------------
Suppose you often SSH into a production server, and you would like to setup
your shell and editor there using your custom settings. However, other people
could SSH in as well and you don't want to clobber their settings. Here is how
this could be achieved using the ssh kitten with :program:`zsh` and
:program:`vim` as the shell and editor, respectively:
.. code-block:: conf
# Have these settings apply to servers in my organization
hostname myserver-*
# Setup zsh to read its files from my-conf/zsh
env ZDOTDIR $HOME/my-conf/zsh
copy --dest my-conf/zsh/.zshrc .zshrc
copy --dest my-conf/zsh/.zshenv .zshenv
# If you use other zsh init files add them in a similar manner
# Setup vim to read its config from my-conf/vim
env VIMINIT $HOME/my-conf/vim/vimrc
env VIMRUNTIME $HOME/my-conf/vim
copy --dest my-conf/vim .vim
copy --dest my-conf/vim/vimrc .vimrc
How it works
----------------
The ssh kitten works by having SSH transmit and execute a POSIX sh (or
:opt:`optionally <kitten-ssh.interpreter>` Python) bootstrap script on the
remote host using an :opt:`interpreter <kitten-ssh.interpreter>`. This script
reads setup data over the TTY device, which kitty sends as a Base64 encoded
compressed tarball. The script extracts it and places the :opt:`files <kitten-ssh.copy>`
and sets the :opt:`environment variables <kitten-ssh.env>` before finally
launching the :opt:`login shell <kitten-ssh.login_shell>` with :opt:`shell
integration <kitten-ssh.shell_integration>` enabled. The data is requested by
the kitten over the TTY with a random one time password. kitty reads the request
and if the password matches a password pre-stored in shared memory on the
localhost by the kitten, the transmission is allowed. If your local
`OpenSSH <https://www.openssh.com/>`__ version is >= 8.4 then the data is
transmitted instantly without any roundtrip delay.
.. note::
When connecting to BSD hosts, it is possible the bootstrap script will fail
or run slowly, because the default shells are crippled in various ways.
Your best bet is to install Python on the remote, make sure the login shell
is something POSIX sh compliant, and use :code:`python` as the
:opt:`interpreter <kitten-ssh.interpreter>` in :file:`ssh.conf`.
.. note::
This may or may not work when using terminal multiplexers, depending on
whether they passthrough the escape codes and if the values of the
environment variables :envvar:`KITTY_PID` and :envvar:`KITTY_WINDOW_ID` are
correct in the current session (they can be wrong when connecting to a tmux
session running in a different window) and the ssh kitten is run in the
currently active multiplexer window.
.. include:: /generated/conf-kitten-ssh.rst
.. _ssh_copy_command:
The copy command
--------------------
.. include:: /generated/ssh-copy.rst
.. _manual_terminfo_copy:
Copying terminfo files manually
-------------------------------------
Sometimes, the ssh kitten can fail, or maybe you dont like to use it. In such
cases, the terminfo files can be copied over manually to a server with the
following one liner::
infocmp -a xterm-kitty | ssh myserver tic -x -o \~/.terminfo /dev/stdin
If you are behind a proxy (like Balabit) that prevents this, or you are SSHing
into macOS where the :program:`tic` does not support reading from :file:`STDIN`,
you must redirect the first command to a file, copy that to the server and run :program:`tic`
manually. If you connect to a server, embedded, or Android system that doesn't
have :program:`tic`, copy over your local file terminfo to the other system as
:file:`~/.terminfo/x/xterm-kitty`.
If the server is running a relatively modern Linux distribution and you have
root access to it, you could simply install the ``kitty-terminfo`` package on
the server to make the terminfo files available.
Really, the correct solution for this is to convince the OpenSSH maintainers to
have :program:`ssh` do this automatically, if possible, when connecting to a
server, so that all terminals work transparently.
If the server is running FreeBSD, or another system that relies on termcap
rather than terminfo, you will need to convert the terminfo file on your local
machine by running (on local machine with |kitty|)::
infocmp -CrT0 xterm-kitty
The output of this command is the termcap description, which should be appended
to :file:`/usr/share/misc/termcap` on the remote server. Then run the following
command to apply your change (on the server)::
cap_mkdb /usr/share/misc/termcap

View File

@@ -1,8 +1,8 @@
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
The themes kitten allows you to easily change color themes, from a collection of
over two hundred pre-built themes available at `kitty-themes
<https://github.com/kovidgoyal/kitty-themes>`_. To use it, simply run::
kitty +kitten themes
@@ -12,9 +12,9 @@ of almost two hundred pre-built themes available at `kitty-themes
: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 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.
@@ -24,14 +24,15 @@ If you want to restore the colors to default, you can do so by choosing the
.. 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.
: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.
@@ -39,11 +40,12 @@ 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
:file:`themes` sub-directory of the :ref:`kitty config directory <confloc>`,
usually, :file:`~/.config/kitty/themes`. 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
theme of that name. Here, ``Some theme name`` is the actual builtin theme name, not
its file name. Note that after doing so you have to run the kitten and
choose that theme once for your changes to be applied.
@@ -52,13 +54,13 @@ 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
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>`_
<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.
@@ -67,12 +69,12 @@ 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::
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.
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

View File

@@ -14,16 +14,16 @@ etc. Anywhere you have a terminal device, you can transfer files.
: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.
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>`.
kitten instead. Or write your own script to use the underlying
:doc:`file transfer protocol </file-transfer-protocol>`.
.. versionadded:: 0.24.0
@@ -32,7 +32,8 @@ 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.
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::
@@ -42,7 +43,7 @@ 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::
the :option:`--direction <kitty +kitten transfer --direction>` option::
kitty +kitten transfer --direction=receive /path/to/remote/file /path/to/destination/on/local/computer
@@ -58,25 +59,25 @@ 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.
use the :option:`--confirm-paths <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:
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.
#. 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.
#. When invoking the kitten use the :option:`--permissions-bypass
<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
@@ -89,9 +90,10 @@ 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.
differences between files. To turn it on use the :option:`--transmit-deltas
<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

@@ -1,27 +1,29 @@
Unicode input
================
You can input unicode characters by name, hex code, recently used and even an editable favorites list.
Press :sc:`input_unicode_character` to start the unicode input widget, shown below.
You can input Unicode characters by name, hex code, recently used and even an
editable favorites list. Press :sc:`input_unicode_character` to start the
unicode input kitten, shown below.
.. figure:: ../screenshots/unicode.png
:alt: A screenshot of the unicode input widget
:alt: A screenshot of the unicode input kitten
:align: center
:width: 100%
A screenshot of the unicode input widget
A screenshot of the unicode input kitten
In :guilabel:`Code` mode, you enter a unicode character by typing in the hex code for the
character and pressing enter, for example, type in ``2716`` and press enter to get
. You can also choose a character from the list of recently used characters by
typing a leading period and then the two character index and pressing Enter.
The up and down arrow keys can be used to choose the previous and next unicode
symbol respectively.
In :guilabel:`Code` mode, you enter a Unicode character by typing in the hex
code for the character and pressing :kbd:`Enter`. For example, type in ``2716``
and press :kbd:`Enter` to get ````. You can also choose a character from the
list of recently used characters by typing a leading period ``.`` and then the
two character index and pressing :kbd:`Enter`.
The :kbd:`Up` and :kbd:`Down` arrow keys can be used to choose the previous and
next Unicode symbol respectively.
In :guilabel:`Name` mode you instead type words from the character name and use
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.
the :kbd:`ArrowKeys` / :kbd:`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 keys :kbd:`F1` ... :kbd:`F4` or
:kbd:`Ctrl+1` ... :kbd:`Ctrl+4` or by pressing :kbd:`Ctrl+[` and :kbd:`Ctrl+]`

View File

@@ -15,12 +15,13 @@ Extend with kittens
kittens/remote_file
kittens/hyperlinked_grep
kittens/transfer
kittens/ssh
kittens/custom
kittens/*
|kitty| has a framework for easily creating terminal programs that make use of
its advanced features. These programs are called kittens. They are used both
to add features to |kitty| itself and to create useful standalone programs.
its advanced features. These programs are called kittens. They are used both to
add features to |kitty| itself and to create useful standalone programs.
Some prominent kittens:
:doc:`icat <kittens/icat>`
@@ -32,8 +33,8 @@ Some prominent kittens:
images
:doc:`Unicode Input <kittens/unicode_input>`
Easily input arbitrary unicode characters in |kitty| by name or hex code.
:doc:`Unicode input <kittens/unicode_input>`
Easily input arbitrary Unicode characters in |kitty| by name or hex code.
:doc:`Hints <kittens/hints>`
@@ -47,24 +48,31 @@ Some prominent kittens:
:doc:`Transfer files <kittens/transfer>`
Transfer files and directories seamlessly and easily from remote machines over your existing
SSH sessions with a simple command.
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>`_
Search your files using `ripgrep <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.
at the line containing the search result, simply by clicking on the result
you want.
:doc:`Broadcast <kittens/broadcast>`
Type in one :term:`kitty window <window>` and have it broadcast to all (or a subset) of
other :term:`kitty windows <window>`.
Type in one :term:`kitty window <window>` and have it broadcast to all (or a
subset) of other :term:`kitty windows <window>`.
:doc:`SSH <kittens/ssh>`
SSH with automatic :ref:`shell integration <shell_integration>`, connection
re-use for low latency and easy cloning of local shell and editor
configuration to the remote host.
:doc:`Panel <kittens/panel>`
Draw a GPU accelerated dock panel on your desktop showing the output
from an arbitrary terminal program.
Draw a GPU accelerated dock panel on your desktop showing the output from an
arbitrary terminal program.
:doc:`Clipboard <kittens/clipboard>`

View File

@@ -5,22 +5,21 @@ The :command:`launch` command
|kitty| has a :code:`launch` action that can be used to run arbitrary programs
in new windows/tabs. It can be mapped to user defined shortcuts in kitty.conf.
It is very powerful and allows sending the contents of
the current window to the launched program, as well as many other options.
in new windows/tabs. It can be mapped to user defined shortcuts in
:file:`kitty.conf`. It is very powerful and allows sending the contents of the
current window to the launched program, as well as many other options.
In the simplest form, you can use it to open a new kitty window running the
shell, as shown below::
map f1 launch
To run a different program simply pass the command line as arguments to
launch::
To run a different program simply pass the command line as arguments to launch::
map f1 launch vim path/to/some/file
To open a new window with the same working directory as the currently
active window::
To open a new window with the same working directory as the currently active
window::
map f1 launch --cwd=current
@@ -30,9 +29,10 @@ To open the new window in a new tab::
To run multiple commands in a shell, use::
map f1 launch sh -c "ls && zsh"
map f1 launch sh -c "ls && exec zsh"
To pass the contents of the current screen and scrollback to the started process::
To pass the contents of the current screen and scrollback to the started
process::
map f1 launch --stdin-source=@screen_scrollback less
@@ -46,16 +46,16 @@ There are many more powerful options, refer to the complete list below.
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 :kbd:`F1` key will now open :program:`vim` in a new tab with the current
windows working directory.
The piping environment
--------------------------
When using :option:`launch --stdin-source`, the program to which the data is
piped has a special environment variable declared, :envvar:`KITTY_PIPE_DATA` whose
contents are::
piped has a special environment variable declared, :envvar:`KITTY_PIPE_DATA`
whose contents are::
KITTY_PIPE_DATA={scrolled_by}:{cursor_x},{cursor_y}:{lines},{columns}
@@ -73,27 +73,33 @@ the command line:
``@selection``
replaced by the currently selected text
Replaced by the currently selected text.
``@active-kitty-window-id``
replaced by the id of the currently active kitty window
Replaced by the id of the currently active kitty window.
``@line-count``
replaced by the number of lines in STDIN. Only present when passing some
data to STDIN
Replaced by the number of lines in STDIN. Only present when passing some
data to STDIN.
``@input-line-number``
replaced the number of lines a pager should scroll to match the current
scroll position in kitty. See :opt:`scrollback_pager` for details
Replaced the number of lines a pager should scroll to match the current
scroll position in kitty. See :opt:`scrollback_pager` for details.
``@scrolled-by``
replaced by the number of lines kitty is currently scrolled by
Replaced by the number of lines kitty is currently scrolled by.
``@cursor-x``
replaced by the current cursor x position with 1 being the leftmost cell
Replaced by the current cursor x position with 1 being the leftmost cell.
``@cursor-y``
replaced by the current cursor y position with 1 being the topmost cell
Replaced by the current cursor y position with 1 being the topmost cell.
``@first-line-on-screen``
Replaced by the first line on screen. Can be used for pager positioning.
``@last-line-on-screen``
Replaced by the last line on screen. Can be used for pager positioning.
For example::
@@ -106,44 +112,51 @@ For example::
Watching launched windows
---------------------------
The :option:`launch --watcher` option allows you to specify python functions
The :option:`launch --watcher` option allows you to specify Python functions
that will be called at specific events, such as when the window is resized or
closed. Simply specify the path to a python module that specifies callback
closed. Simply specify the path to a Python module that specifies callback
functions for the events you are interested in, for example:
.. code-block:: python
def on_resize(boss, window, data):
from typing import Any, Dict
from kitty.boss import Boss
from kitty.window import Window
def on_resize(boss: Boss, window: Window, data: Dict[str, Any]) -> None:
# Here data will contain old_geometry and new_geometry
def on_focus_change(boss, window, data):
def on_focus_change(boss: Boss, window: Window, data: Dict[str, Any])-> None:
# Here data will contain focused
def on_close(boss, window, data):
def on_close(boss: Boss, window: Window, data: Dict[str, Any])-> None:
# called when window is closed, typically when the program running in
# it exits.
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
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,
the ``Window`` object the action is occurring on. The ``data`` object is 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,
``window.child.pid`` is the PID of the processes that was launched
in the window and ``window.id`` is the internal kitty ``id`` of the
window.
in the window and ``window.id`` is the internal kitty ``id`` of the window.
Finding executables
-----------------------
When you specify a command to run as just a name rather than an absolute path,
it is searched for in the system-wide ``PATH`` environment variable. Note that
this **may not** be the value of ``PATH`` inside a shell, as shell startup scripts
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.
it is searched for in the system-wide :envvar:`PATH` environment variable. Note
that this **may not** be the value of :envvar:`PATH` inside a shell, as shell
startup scripts 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 :envvar:`PATH` inside the
shell is used.
See :opt:`exe_search_path` for details and how to control this.
Syntax reference

View File

@@ -10,7 +10,8 @@ other in arbitrary arrangements, based on *Layouts*, see below for examples:
:align: center
:width: 100%
Screenshot, showing vim, tig and git running in |kitty| with the 'Tall' layout
Screenshot, showing :program:`vim`, :program:`tig` and :program:`git`
running in |kitty| with the *Tall* layout
.. figure:: screenshots/splits.png
@@ -18,21 +19,22 @@ other in arbitrary arrangements, based on *Layouts*, see below for examples:
:align: center
:width: 100%
Screenshot, showing windows with arbitrary arrangement in the 'Splits'
Screenshot, showing windows with arbitrary arrangement in the *Splits*
layout
There are many different layouts available. They are all enabled by default,
you can switch layouts using :sc:`next_layout`. To control which layouts
are available use :opt:`enabled_layouts`, the first listed layout becomes
the default. Individual layouts and how to use them are described below.
There are many different layouts available. They are all enabled by default, you
can switch layouts using :ac:`next_layout` (:sc:`next_layout` by default). To
control which layouts are available use :opt:`enabled_layouts`, the first listed
layout becomes the default. Individual layouts and how to use them are described
below.
The Stack Layout
------------------
This is the simplest layout it displays a single window using all available
space, other windows are hidden behind it. It has no options::
This is the simplest layout. It displays a single window using all available
space, other windows are hidden behind it. This layout has no options::
enabled_layouts stack
@@ -40,14 +42,14 @@ space, other windows are hidden behind it. It has no options::
The Tall Layout
------------------
Displays one (or optionally more) full height windows on the left half of the
Displays one (or optionally more) full-height windows on the left half of the
screen. Remaining windows are tiled vertically on the right half of the screen.
There are options to control how the screen is split horizontally ``bias``
(an integer between ``10`` and ``90``) and options to control how many
full-height windows there are ``full_size`` (a positive integer). The
``mirrored`` option when set to ``true`` will cause the short windows to be
on the left side of the screen instead of the right. The syntax
for the options is shown below::
``mirrored`` option when set to ``true`` will cause the full-height windows to
be on the right side of the screen instead of the left. The syntax
for the options is::
enabled_layouts tall:bias=50;full_size=1;mirrored=false
@@ -65,24 +67,32 @@ for the options is shown below::
│ │ │
└──────────────┴───────────────┘
In addition, you can map keys to increase or decrease the number of full size
windows, for example::
In addition, you can map keys to increase or decrease the number of full-height
windows, or toggle the mirrored setting, for example::
map ctrl+[ layout_action decrease_num_full_size_windows
map ctrl+] layout_action increase_num_full_size_windows
map ctrl+/ layout_action mirror toggle
map ctrl+y layout_action mirror true
map ctrl+n layout_action mirror false
You can also map a key to change the bias by providing a list of percentages
and it will rotate through the list as you press the key. If you only provide
one number it'll toggle between that percentage and 50, for example::
map ctrl+. layout_action bias 50 62 70
map ctrl+, layout_action bias 62
The Fat Layout
----------------
Displays one (or optionally more) full width windows on the top half of the
screen. Remaining windows are tiled horizontally on the bottom half of the screen.
There are options to control how the screen is split vertically ``bias``
Displays one (or optionally more) full-width windows on the top half of the
screen. Remaining windows are tiled horizontally on the bottom half of the
screen. There are options to control how the screen is split vertically ``bias``
(an integer between ``10`` and ``90``) and options to control how many
full-height windows there are ``full_size`` (a positive integer). The
``mirrored`` option when set to ``true`` will cause the narrow windows to be
on the top of the screen instead of the bottom. The syntax for the options is
shown below::
full-width windows there are ``full_size`` (a positive integer). The
``mirrored`` option when set to ``true`` will cause the full-width windows to be
on the bottom of the screen instead of the top. The syntax for the options is::
enabled_layouts fat:bias=50;full_size=1;mirrored=false
@@ -100,11 +110,15 @@ shown below::
└─────────┴──────────┴─────────┘
This layout also supports the same layout actions as the *Tall* layout, shown above.
The Grid Layout
--------------------
Display windows in a balanced grid with all windows the same size except the
last column if there are not enough windows to fill the grid. Has no options::
last column if there are not enough windows to fill the grid. This layout has no
options::
enabled_layouts grid
@@ -132,15 +146,20 @@ define a few extra key bindings in :file:`kitty.conf`::
# Create a new window splitting the space used by the existing one so that
# the two windows are placed one above the other
map F5 launch --location=hsplit
map f5 launch --location=hsplit
# Create a new window splitting the space used by the existing one so that
# the two windows are placed side by side
map F6 launch --location=vsplit
map f6 launch --location=vsplit
# Create a new window splitting the space used by the existing one so that
# the two windows are placed side by side if the existing window is wide or
# one above the other if the existing window is tall.
map f4 launch --location=split
# Rotate the current split, chaging its split axis from vertical to
# horizontal or vice versa
map F7 layout_action rotate
map f7 layout_action rotate
# Move the active window in the indicated direction
map shift+up move_window up
@@ -148,22 +167,28 @@ define a few extra key bindings in :file:`kitty.conf`::
map shift+right move_window right
map shift+down move_window down
# Move the active window to the indicated screen edge
map ctrl+shift+up layout_action move_to_screen_edge top
map ctrl+shift+left layout_action move_to_screen_edge left
map ctrl+shift+right layout_action move_to_screen_edge right
map ctrl+shift+down layout_action move_to_screen_edge bottom
# Switch focus to the neighboring window in the indicated direction
map ctrl+left neighboring_window left
map ctrl+right neighboring_window right
map ctrl+up neighboring_window up
map ctrl+down neighboring_window down
Windows can be resized using :ref:`window_resizing`. You can swap the windows
Windows can be resized using :ref:`window_resizing`. 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 when a ``--location`` is not
specified. A value of ``horizontal`` (same as ``--location=vsplit``)
means when a new split is created the two windows will be placed side by side
and a value of ``vertical`` (same as ``--location=hsplit``) means the two
windows will be placed one on top of the other. By default::
are placed into vertical or horizontal splits when a :option:`--location <launch
--location>` is not specified. A value of ``horizontal`` (same as
``--location=vsplit``) means when a new split is created the two windows will be
placed side by side and a value of ``vertical`` (same as ``--location=hsplit``)
means the two windows will be placed one on top of the other. By default::
enabled_layouts splits:split_axis=horizontal
@@ -188,7 +213,7 @@ windows will be placed one on top of the other. By default::
The Horizontal Layout
------------------------
All windows are shown side by side. Has no options::
All windows are shown side by side. This layout has no options::
enabled_layouts horizontal
@@ -208,7 +233,7 @@ All windows are shown side by side. Has no options::
The Vertical Layout
-----------------------
All windows are shown one below the other. Has no options::
All windows are shown one below the other. This layout has no options::
enabled_layouts vertical
@@ -234,37 +259,38 @@ Resizing windows
You can resize windows inside layouts. Press :sc:`start_resizing_window` (also
:kbd:`⌘+r` on macOS) to enter resizing mode and follow the on-screen
instructions. In a given window layout only some operations may be possible
for a particular window. For example, in the Tall layout you can make the first
instructions. In a given window layout only some operations may be possible for
a particular window. For example, in the *Tall* layout you can make the first
window wider/narrower, but not taller/shorter. Note that what you are resizing
is actually not a window, but a row/column in the layout, all windows in that
row/column will be resized.
You can also define shortcuts in :file:`kitty.conf` to make the active window
wider, narrower, taller, or shorter by mapping to the ``resize_window``
wider, narrower, taller, or shorter by mapping to the :ac:`resize_window`
action, for example::
map ctrl+left resize_window narrower
map ctrl+right resize_window wider
map ctrl+up resize_window taller
map ctrl+down resize_window shorter 3
# reset all windows in the tab to default sizes
map ctrl+home resize_window reset
The ``resize_window`` action has a second, optional argument to control
The :ac:`resize_window` action has a second optional argument to control
the resizing increment (a positive integer that defaults to 1).
Some layouts take options to control their behavior. For example, the ``fat``
and ``tall`` layouts accept the ``bias`` and ``full_size`` options to control
how the available space is split up.
To specify the option, in :opt:`kitty.conf <enabled_layouts>` use::
Some layouts take options to control their behavior. For example, the *Fat*
and *Tall* layouts accept the ``bias`` and ``full_size`` options to control
how the available space is split up. To specify the option, in :opt:`kitty.conf
<enabled_layouts>` use::
enabled_layouts tall:bias=70;full_size=2
This will have ``2`` instead of a single tall window, that occupy ``70%``
instead of ``50%`` of available width. ``bias`` can be any number between 10
and 90.
instead of ``50%`` of available width. ``bias`` can be any number between ``10``
and ``90``.
Writing a new layout only requires about two hundred lines of code, so if there
is some layout you want, take a look at one of the existing layouts in the
`layout <https://github.com/kovidgoyal/kitty/tree/master/kitty/layout>`_
`layout <https://github.com/kovidgoyal/kitty/tree/master/kitty/layout>`__
package and submit a pull request!

View File

@@ -9,12 +9,12 @@ running programs or similar. Lets start with a few examples:
Examples
----------
Suppose we want to be able to highlight the word ERROR in the current window.
Add the following to :file:`kitty.conf`::
Suppose we want to be able to highlight the word :code:`ERROR` in the current
window. Add the following to :file:`kitty.conf`::
map f1 toggle_marker text 1 ERROR
Now when you press :kbd:`F1` all instances of the word :code:`ERROR` will be
Now when you press :kbd:`F1`, all instances of the word :code:`ERROR` will be
highlighted. To turn off the highlighting, press :kbd:`F1` again.
If you want to make it case-insensitive, use::
@@ -39,41 +39,40 @@ can control the colors used for these groups in :file:`kitty.conf` with::
.. note::
For performance reasons, matching is done per line only, and only when that line is
altered in any way. So you cannot match text that stretches across multiple
lines.
For performance reasons, matching is done per line only, and only when that
line is altered in any way. So you cannot match text that stretches across
multiple lines.
Creating markers dynamically
---------------------------------
If you want to create markers dynamically rather than pre-defining them in
:file:`kitty.conf` you can do so as follows::
:file:`kitty.conf`, you can do so as follows::
map f1 create_marker
map f2 remove_marker
Then pressing :kbd:`F1` will allow you to enter the marker definition and set
it and pressing :kbd:`F2` will remove the marker. ``create_marker`` accepts
the same syntax as ``toggle_marker`` above. Note that while creating
markers, the prompt has history so you can easily re-use previous marker
expressions.
Then pressing :kbd:`F1` will allow you to enter the marker definition and set it
and pressing :kbd:`F2` will remove the marker. :ac:`create_marker` accepts the
same syntax as :ac:`toggle_marker` above. Note that while creating markers, the
prompt has history so you can easily re-use previous marker expressions.
You can also use the facilities for :doc:`remote-control` to dynamically
add/remove markers.
You can also use the facilities for :doc:`remote-control` to dynamically add or
remove markers.
Scrolling to marks
--------------------
kitty has an action to scroll to the next line that contains a mark. You can
use it by mapping it to some shortcut in :file:`kitty.conf`::
kitty has a :ac:`scroll_to_mark` action to scroll to the next line that contains
a mark. You can use it by mapping it to some shortcut in :file:`kitty.conf`::
map ctrl+p scroll_to_mark prev
map ctrl+n scroll_to_mark next
Then pressing :kbd:`ctrl+p` will scroll to the first line in the scrollback
buffer above the current top line that contains a mark. Pressing :kbd:`ctrl+n`
Then pressing :kbd:`Ctrl+P` will scroll to the first line in the scrollback
buffer above the current top line that contains a mark. Pressing :kbd:`Ctrl+N`
will scroll to show the first line below the current last line that contains
a mark. If you wish to jump to a mark of a specific type, you can add that to
the mapping::
@@ -86,26 +85,26 @@ Which will scroll only to marks of type 1.
The full syntax for creating marks
-------------------------------------
The syntax of the :code:`toggle_marker` command is::
The syntax of the :ac:`toggle_marker` action is::
toggle_marker <marker-type> <specification>
Here :code:`marker-type` is one of:
* :code:`text` - simple substring matching
* :code:`itext` - case-insensitive substring matching
* :code:`regex` - A python regular expression
* :code:`iregex` - A case-insensitive python regular expression
* :code:`function` - An arbitrary function defined in a python file, see :ref:`marker_funcs`.
* :code:`text` - Simple substring matching
* :code:`itext` - Case-insensitive substring matching
* :code:`regex` - A Python regular expression
* :code:`iregex` - A case-insensitive Python regular expression
* :code:`function` - An arbitrary function defined in a Python file, see :ref:`marker_funcs`.
.. _marker_funcs:
Arbitrary marker functions
-----------------------------
You can create your own marker functions. Create a python file named
:file:`mymarker.py` and in it create a :code:`marker` function. This
function receives the text of the line as input and must yield three numbers,
You can create your own marker functions. Create a Python file named
:file:`mymarker.py` and in it create a :code:`marker` function. This function
receives the text of the line as input and must yield three numbers,
the starting character position, the ending character position and the mark
group (1-3). For example:
@@ -122,6 +121,7 @@ Save this file somewhere and in :file:`kitty.conf`, use::
map f1 toggle_marker function /path/to/mymarker.py
If you save the file in the kitty config directory, you can use::
If you save the file in the :ref:`kitty config directory <confloc>`, you can
use::
map f1 toggle_marker function mymarker.py

View File

@@ -1,15 +1,14 @@
Scripting the mouse click
======================================================
|kitty| has support for `terminal hyperlinks
<https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda>`_. These
are generated by many terminal programs, such as ``ls``, ``gcc``, ``systemd``,
:ref:`tool_mdcat`, etc. You can customize exactly what happens when clicking on these
hyperlinks in |kitty|.
|kitty| has support for :term:`terminal hyperlinks <hyperlinks>`. These are
generated by many terminal programs, such as ``ls``, ``gcc``, ``systemd``,
:ref:`tool_mdcat`, etc. You can customize exactly what happens when clicking on
these hyperlinks in |kitty|.
You can tell kitty to take arbitrarily many, complex actions
when a link is clicked. Let us illustrate with some examples, first. Create
the file :file:`~/.config/kitty/open-actions.conf` with the following:
You can tell kitty to take arbitrarily many, complex actions when a link is
clicked. Let us illustrate with some examples, first. Create the file
:file:`~/.config/kitty/open-actions.conf` with the following:
.. code:: conf
@@ -22,6 +21,13 @@ Now, run ``ls --hyperlink=auto`` in kitty and click on the filename of an
image, holding down :kbd:`ctrl+shift`. It will be opened over the current
window. Press any key to close it.
.. note::
The :program:`ls` comes with macOS does not support hyperlink, you need to
install `GNU Coreutils <https://www.gnu.org/software/coreutils/>`__. If you
install it via `Homebrew <https://formulae.brew.sh/formula/coreutils>`__, it
will be :program:`gls`.
Each entry in :file:`open-actions.conf` consists of one or more
:ref:`matching_criteria`, such as ``protocol`` and ``mime`` and one or more
``action`` entries. In the example above kitty uses the :doc:`launch <launch>`
@@ -29,8 +35,8 @@ action which can be used to run external programs. Entries are separated by
blank lines.
Actions are very powerful, anything that you can map to a key combination in
`kitty.conf` can be used as an action. You can specify more than one action per
entry if you like, for example:
:file:`kitty.conf` can be used as an action. You can specify more than one
action per entry if you like, for example:
.. code:: conf
@@ -58,9 +64,20 @@ some special variables, documented below:
``FRAGMENT``
The fragment (unquoted), if any of the URL or the empty string.
``URL_PATH``
The path, query and fragment portions of the URL, without any
unquoting.
``EDITOR``
The terminal based text editor. The configured :opt:`editor` in
:file:`kitty.conf` is preferred.
``SHELL``
The path to the shell. The configured :opt:`shell` in :file:`kitty.conf` is
preferred, without arguments.
.. note::
You can use the :opt:`action_alias` option just as in kitty.conf to
You can use the :opt:`action_alias` option just as in :file:`kitty.conf` to
define aliases for frequently used actions.
@@ -77,7 +94,7 @@ lines. The various available criteria are:
``protocol``
A comma separated list of protocols, for example: ``http, https``. If
absent, there is no constraint on protocol
absent, there is no constraint on protocol.
``url``
A regular expression that must match against the entire (unquoted) URL
@@ -88,11 +105,13 @@ lines. The various available criteria are:
``mime``
A comma separated list of MIME types, for example: ``text/*, image/*,
application/pdf``. You can add MIME types to kitty by creating the
:file:`mime.types` in the kitty configuration directory. Useful if your
system MIME database does not have definitions you need. This file is
in the standard format of one definition per line, like: ``text/plain rst
md``. Note that the MIME type for directories is ``inode/directory``.
application/pdf``. You can add MIME types to kitty by creating a file named
:file:`mime.types` in the :ref:`kitty configuration directory <confloc>`.
Useful if your system MIME database does not have definitions you need. This
file is in the standard format of one definition per line, like:
``text/plain rst md``. Note that the MIME type for directories is
``inode/directory``. MIME types are detected based on file extension, not
file contents.
``ext``
A comma separated list of file extensions, for example: ``jpeg, tar.gz``
@@ -102,39 +121,42 @@ lines. The various available criteria are:
``image-??.png``
.. _launch_actions:
Scripting the opening of files with kitty on macOS
-------------------------------------------------------
On macOS you can use :guilabel:`Open With` in Finder or drag and drop files
onto the kitty dock icon to open them with kitty. The default action
is to open text files in your editor and images using the icat kitten.
Shell scripts are run in a shell. You can customize these actions by creating
a :file:`launch-actions.conf` file in the kitty config directory, just like
the :file:`open-actions.conf` file above. For example:
On macOS you can use :guilabel:`Open With` in Finder or drag and drop files and
URLs onto the kitty dock icon to open them with kitty. The default actions are:
.. code:: conf
* Open text files in your editor and images using the icat kitten.
* Run shell scripts in a shell
* Open SSH urls using the ssh command
# Open script files based on their shebangs
protocol file
ext sh,command,tool
action launch --hold --type=os-window kitty +shebang $FILE_PATH {SHELL}
These actions can also be executed from the command line by running::
# Open shell specific script files
protocol file
ext fish,bash,zsh
action launch --hold --type=os-window kitty +shebang $FILE_PATH __ext__
kitty +open file_or_url another_url ...
# Open directories
protocol file
mime inode/directory
action launch --type=os-window --cwd $FILE_PATH
# macOS only
open -a kitty.app file_or_url another_url ...
# Open text files without fragments in the editor
protocol file
mime text/*
action launch --type=os-window $EDITOR $FILE_PATH
Since macOS lacks an official interface to set default URL scheme handlers,
kitty has a command you can use for it. The first argument for is the URL
scheme, and the second optional argument is the bundle id of the app, which
defaults to kitty, if not specified. For example:
# Open image files with icat
protocol file
mime image/*
action launch --type=os-window kitty +kitten icat --hold $FILE_PATH
.. code-block:: sh
# Set kitty as the handler for ssh:// URLs
kitty +runpy 'from kitty.fast_data_types import cocoa_set_url_handler; import sys; cocoa_set_url_handler(*sys.argv[1:]); print("OK")' ssh
# Set someapp as the handler for xyz:// URLs
kitty +runpy 'from kitty.fast_data_types import cocoa_set_url_handler; import sys; cocoa_set_url_handler(*sys.argv[1:]); print("OK")' xyz someapp.bundle.identifier
You can customize these actions by creating a :file:`launch-actions.conf` file
in the :ref:`kitty config directory <confloc>`, just like the
:file:`open-actions.conf` file above. For example:
.. literalinclude:: ../kitty/open_actions.py
:language: conf
:start-at: # Open script files
:end-before: '''.splitlines()))

View File

@@ -4,23 +4,23 @@ Overview
Design philosophy
-------------------
|kitty| is designed for power keyboard users. To that end all its controls
work with the keyboard (although it fully supports mouse interactions as
well). Its configuration is a simple, human editable, single file for
easy reproducibility (I like to store configuration in source control).
|kitty| is designed for power keyboard users. To that end all its controls work
with the keyboard (although it fully supports mouse interactions as well). Its
configuration is a simple, human editable, single file for easy reproducibility
(I like to store configuration in source control).
The code in |kitty| is designed to be simple, modular and hackable. It is
written in a mix of C (for performance sensitive parts) and Python (for
easy hackability of the UI). It does not depend on any large and complex
UI toolkit, using only OpenGL for rendering everything.
written in a mix of C (for performance sensitive parts), Python (for easy
extensibility and flexibility of the UI) and Go (for the command line
:term:`kittens`). It does not depend on any large and complex UI toolkit,
using only OpenGL for rendering everything.
Finally, |kitty| is designed from the ground up to support all modern
terminal features, such as unicode, true color, bold/italic fonts, text
formatting, etc. It even extends existing text formatting escape codes,
to add support for features not available elsewhere, such as colored and
styled (curly) underlines. One of the design goals of |kitty| is to be
easily extensible so that new features can be added in the future with
relatively little effort.
Finally, |kitty| is designed from the ground up to support all modern terminal
features, such as Unicode, true color, bold/italic fonts, text formatting, etc.
It even extends existing text formatting escape codes, to add support for
features not available elsewhere, such as colored and styled (curly) underlines.
One of the design goals of |kitty| is to be easily extensible so that new
features can be added in the future with relatively little effort.
.. include:: basic.rst
@@ -28,10 +28,10 @@ relatively little effort.
Configuring kitty
-------------------
|kitty| is highly configurable, everything from keyboard shortcuts to
painting frames-per-second. Press :sc:`edit_config_file` in kitty
to open its fully commented sample config file in your text editor.
For details see the :doc:`configuration docs <conf>`.
|kitty| is highly configurable, everything from keyboard shortcuts to painting
frames-per-second. Press :sc:`edit_config_file` in kitty to open its fully
commented sample config file in your text editor. For details see the
:doc:`configuration docs <conf>`.
.. toctree::
:hidden:
@@ -51,17 +51,26 @@ windows automatically, resizing and moving them as needed. You can create a new
Currently, there are seven layouts available:
* **Fat** -- One (or optionally more) windows are shown full width on the top, the rest of the windows are shown side-by-side on the bottom
* **Fat** -- One (or optionally more) windows are shown full width on the top,
the rest of the windows are shown side-by-side on the bottom
* **Grid** -- All windows are shown in a grid
* **Horizontal** -- All windows are shown side-by-side
* **Splits** -- Windows arranged in arbitrary patterns created using horizontal and vertical splits
* **Splits** -- Windows arranged in arbitrary patterns created using horizontal
and vertical splits
* **Stack** -- Only a single maximized window is shown at a time
* **Tall** -- One (or optionally more) windows are shown full height on the left, the rest of the windows are shown one below the other on the right
* **Tall** -- One (or optionally more) windows are shown full height on the
left, the rest of the windows are shown one below the other on the right
* **Vertical** -- All windows are shown one below the other
By default, all layouts are enabled and you can switch between layouts using
the :sc:`next_layout` key combination. You can also create shortcuts to select
particular layouts, and choose which layouts you want to enable/disable, see
particular layouts, and choose which layouts you want to enable, see
:ref:`conf-kitty-shortcuts.layout` for examples. The first layout listed in
:opt:`enabled_layouts` becomes the default layout.
@@ -77,11 +86,11 @@ 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
programs called :doc:`kittens <kittens_intro>`. These can be 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
:doc:`viewing images <kittens/icat>` or :doc:`diffing files with image support
<kittens/diff>`.
You can :doc:`create your own kittens to scratch your own itches
@@ -101,9 +110,9 @@ Remote control
|kitty| has a very powerful system that allows you to control it from the
:doc:`shell prompt, even over SSH <remote-control>`. You can change colors,
fonts, open new :term:`windows <window>`, :term:`tabs <tab>`, set their titles,
change window layout, get text
from one window and send text to another, etc, etc. The possibilities are
endless. See the :doc:`tutorial <remote-control>` to get started.
change window layout, get text from one window and send text to another, etc.
The possibilities are endless. See the :doc:`tutorial <remote-control>` to get
started.
.. toctree::
:hidden:
@@ -117,10 +126,9 @@ Startup Sessions
------------------
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`.
For example:
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`. An example, showing all available commands:
.. code-block:: session
@@ -130,37 +138,48 @@ For example:
cd ~
# Create a window and run the specified command in it
launch zsh
# Create a window with some environment variables set and run
# vim in it
# Create a window with some environment variables set and run vim in it
launch --env FOO=BAR vim
# Set the title for the next window
launch --title "Chat with x" irssi --profile x
# Create a new tab (the part after new_tab is the optional tab
# name which will be displayed in the tab bar, if omitted, the
# title of the active window will be used instead)
# Create a new tab
# The part after new_tab is the optional tab title which will be displayed in
# the tab bar, if omitted, the title of the active window will be used instead.
new_tab my tab
cd ~/somewhere
# Set the layouts allowed in this tab
enabled_layouts tall, stack
enabled_layouts tall,stack
# Set the current layout
layout stack
launch zsh
# Create a new OS window
# Any definitions specified before the first new_os_window will apply to first OS window.
new_os_window
# set new window size to 80x25 cells
os_window_size 80c 25c
# set the --class for the new OS window
# Set new window size to 80x24 cells
os_window_size 80c 24c
# Set the --class for the new OS window
os_window_class mywindow
# Change the OS window state to normal, fullscreen, maximized or minimized
os_window_state normal
launch sh
# Make the current window the active (focused) window
# Resize the current window (see the resize_window action for details)
resize_window wider 2
# Make the current window the active (focused) window in its tab
focus
# Make the current OS Window the globally active window (not supported on Wayland)
focus_os_window
launch emacs
.. note::
The :doc:`launch <launch>` command when used in a session file
cannot create new OS windows, or tabs.
The :doc:`launch <launch>` command when used in a session file cannot create
new OS windows, or tabs.
.. note::
Environment variables of the for :code:`${NAME}` or :code:`$NAME` are
expanded in the session file, except in the *arguments* (not options) to the
launch command.
Creating tabs/windows
@@ -182,25 +201,25 @@ Mouse features
* You can click on a URL to open it in a browser.
* You can double click to select a word and then drag to select more words.
* You can triple click to select a line and then drag to select more lines.
* You can triple click while holding :kbd:`ctrl+alt` to select from clicked
* You can triple click while holding :kbd:`Ctrl+Alt` to select from clicked
point to end of line.
* You can right click to extend a previous selection.
* You can hold down :kbd:`ctrl+alt` and drag with the mouse to select in
* You can hold down :kbd:`Ctrl+Alt` and drag with the mouse to select in
columns.
* Selecting text automatically copies it to the primary clipboard (on
platforms with a primary clipboard).
* You can middle click to paste from the primary clipboard (on platforms
* Selecting text automatically copies it to 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
* 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
All these actions can be customized in :file:`kitty.conf` as described
:ref:`here <conf-kitty-mouse.mousemap>`.
You can also customize what happens when clicking on :term:`hyperlinks` in kitty,
having it open files in your editor, download remote files, open things
You can also customize what happens when clicking on :term:`hyperlinks` in
kitty, having it open files in your editor, download remote files, open things
in your browser, etc.
For details, see :doc:`here <open_actions>`.
@@ -214,11 +233,11 @@ Font control
-----------------
|kitty| has extremely flexible and powerful font selection features. You can
specify individual families for the regular, bold, italic and bold+italic
fonts. You can even specify specific font families for specific ranges of
unicode characters. This allows precise control over text rendering. It can
come in handy for applications like powerline, without the need to use patched
fonts. See the various font related configuration directives in
specify individual families for the regular, bold, italic and bold+italic fonts.
You can even specify specific font families for specific ranges of Unicode
characters. This allows precise control over text rendering. It can come in
handy for applications like powerline, without the need to use patched fonts.
See the various font related configuration directives in
:ref:`conf-kitty-fonts`.
@@ -228,29 +247,29 @@ The scrollback buffer
-----------------------
|kitty| supports scrolling back to view history, just like most terminals. You
can use either keyboard shortcuts or the mouse scroll wheel to do so. However,
|kitty| has an extra, neat feature. Sometimes you need to explore the
scrollback buffer in more detail, maybe search for some text or refer to it
side-by-side while typing in a follow-up command. |kitty| allows you to do this
by pressing the :sc:`show_scrollback` key-combination, which will open the
scrollback buffer in your favorite pager program (which is ``less`` by default).
Colors and text formatting are preserved. You can explore the scrollback buffer
comfortably within the pager.
can use either keyboard shortcuts or the mouse scroll wheel to do so. However,
|kitty| has an extra, neat feature. Sometimes you need to explore the scrollback
buffer in more detail, maybe search for some text or refer to it side-by-side
while typing in a follow-up command. |kitty| allows you to do this by pressing
the :sc:`show_scrollback` shortcut, which will open the scrollback buffer in
your favorite pager program (which is :program:`less` by default). Colors and
text formatting are preserved. You can explore the scrollback buffer comfortably
within the pager.
Additionally, you can pipe the contents of the scrollback buffer to an
arbitrary, command running in a new :term:`window`, :term:`tab` or :term:`overlay`,
for example::
arbitrary, command running in a new :term:`window`, :term:`tab` or
:term:`overlay`. 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 <show_scrollback>` for details.
Would open the scrollback buffer in a new :term:`window` when you press the
:kbd:`F1` 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 :iss:`this thread <719>`.
If you want to use it with an editor such as :program:`vim` to get more powerful
features, you can see tips for doing so, in :iss:`this thread <719>`.
If you wish to store very large amounts of scrollback to view using the piping or
:sc:`show_scrollback <show_scrollback>` features, you can use the
If you wish to store very large amounts of scrollback to view using the piping
or :sc:`show_scrollback <show_scrollback>` features, you can use the
:opt:`scrollback_pager_history_size` option.
@@ -258,8 +277,8 @@ 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
<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.
@@ -274,17 +293,16 @@ See :doc:`shell-integration` for details.
Multiple copy/paste buffers
-----------------------------
In addition to being able to copy/paste from the system clipboard, in |kitty| you
can also setup an arbitrary number of copy paste buffers. To do so, simply add
something like the following to your :file:`kitty.conf`::
In addition to being able to copy/paste from the system clipboard, in |kitty|
you can also setup an arbitrary number of copy paste buffers. To do so, simply
add something like the following to your :file:`kitty.conf`::
map f1 copy_to_buffer a
map f2 paste_from_buffer a
This will allow you to press :kbd:`F1` to copy the current selection to an
internal buffer named ``a`` and :kbd:`F2` to paste from that buffer. The buffer
names are arbitrary strings, so you can define as many such buffers as you
need.
names are arbitrary strings, so you can define as many such buffers as you need.
Marks

View File

@@ -2,30 +2,31 @@ Performance
===================
The main goals for |kitty| performance are user perceived latency while typing
and "smoothness" while scrolling as well as CPU usage. |kitty| tries hard to find
an optimum balance for these. To that end it keeps a cache of each rendered
glyph in video RAM so that font rendering is not a bottleneck. Interaction
with child programs takes place in a separate thread from rendering, to improve
and "smoothness" while scrolling as well as CPU usage. |kitty| tries hard to
find an optimum balance for these. To that end it keeps a cache of each rendered
glyph in video RAM so that font rendering is not a bottleneck. Interaction with
child programs takes place in a separate thread from rendering, to improve
smoothness.
There are two parameters you can tune to adjust the performance. :opt:`repaint_delay`
and :opt:`input_delay`. These control the artificial delays introduced into the
render loop to reduce CPU usage. See :ref:`conf-kitty-performance` for details.
See also the :opt:`sync_to_monitor` option to further decrease latency at the cost
of some `tearing <https://en.wikipedia.org/wiki/Screen_tearing>`_ while scrolling.
There are two config options you can tune to adjust the performance,
:opt:`repaint_delay` and :opt:`input_delay`. These control the artificial delays
introduced into the render loop to reduce CPU usage. See
:ref:`conf-kitty-performance` for details. See also the :opt:`sync_to_monitor`
option to further decrease latency at the cost of some `screen tearing
<https://en.wikipedia.org/wiki/Screen_tearing>`__ while scrolling.
You can generate detailed per-function performance data using `gperftools
<https://github.com/gperftools/gperftools>`_. Build |kitty| with `make
profile`. Run kitty and perform the task you want to analyse, for example,
scrolling a large file with `less`. After you quit, function call statistics
will be printed to `stdout` and you can use tools like *kcachegrind* for more
detailed analysis.
You can generate detailed per-function performance data using
`gperftools <https://github.com/gperftools/gperftools>`__. Build |kitty| with
``make profile``. Run kitty and perform the task you want to analyse, for
example, scrolling a large file with :program:`less`. After you quit, function
call statistics will be printed to STDOUT and you can use tools like
*KCachegrind* for more detailed analysis.
Here are some CPU usage numbers for the task of scrolling a file continuously
in less. The CPU usage is for the terminal process and X together and is
measured using htop. The measurements are taken at the same font and window
size for all terminals on a ``Intel(R) Core(TM) i7-4820K CPU @ 3.70GHz`` CPU
with a ``Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde XT [Radeon HD
Here are some CPU usage numbers for the task of scrolling a file continuously in
:program:`less`. The CPU usage is for the terminal process and X together and is
measured using :program:`htop`. The measurements are taken at the same font and
window size for all terminals on a ``Intel(R) Core(TM) i7-4820K CPU @ 3.70GHz``
CPU with a ``Advanced Micro Devices, Inc. [AMD/ATI] Cape Verde XT [Radeon HD
7770/8760 / R7 250X]`` GPU.
============== =========================
@@ -49,11 +50,11 @@ admittedly biased, eyes).
.. note::
Some people have asked why kitty does not perform better than terminal XXX in
the test of sinking large amounts of data, such as catting a large text
file. The answer is because this is not a goal for kitty. kitty
deliberately throttles input parsing and output rendering to minimize
resource usage while still being able to sink output faster than any real
world program can produce it. Reducing CPU usage, and hence battery drain
while achieving instant response times and smooth scrolling to a human eye
is a far more important goal.
Some people have asked why kitty does not perform better than terminal XXX
in the test of sinking large amounts of data, such as catting a large text
file. The answer is because this is not a goal for kitty. kitty deliberately
throttles input parsing and output rendering to minimize resource usage
while still being able to sink output faster than any real world program can
produce it. Reducing CPU usage, and hence battery drain while achieving
instant response times and smooth scrolling to a human eye is a far more
important goal.

View File

@@ -1,5 +1,18 @@
Press mentions of kitty
========================
`Console #88 <https://console.substack.com/p/console-88>`__
`Python Bytes 272 <https://youtu.be/8HKliSbA-gQ?t=815>`__ (Feb 2022)
A podcast demoing some of kitty's coolness
`Console #88 <https://console.substack.com/p/console-88>`__ (Jan 2022)
An interview with Kovid about kitty
Video reviews
--------------
`Review (Jan 2021) <https://www.youtube.com/watch?v=TTzP2zYJn2k>`__
A kitty review by distrotube
`Review (Dec 2020) <https://www.youtube.com/watch?v=KUMkLhFeBrI>`__
A kitty review/intro by TechHut

View File

@@ -1,23 +1,24 @@
Terminal protocol extensions
===================================
|kitty| has extensions to the legacy terminal protocol, to enable advanced features.
These are typically in the form of new or re-purposed escape codes. While these
extensions are currently |kitty| specific, it would be nice to get some of them
adopted more broadly, to push the state of terminal emulators forward.
|kitty| has extensions to the legacy terminal protocol, to enable advanced
features. These are typically in the form of new or re-purposed escape codes.
While these extensions are currently |kitty| specific, it would be nice to get
some of them adopted more broadly, to push the state of terminal emulators
forward.
The goal of these extensions is to be as small and unobtrusive as possible,
while filling in some gaps in the existing xterm protocol. In particular, one
of the goals of this specification is explicitly not to "re-imagine" the tty.
The tty should remain what it is -- a device for efficiently processing text
while filling in some gaps in the existing xterm protocol. In particular, one of
the goals of this specification is explicitly not to "re-imagine" the TTY. The
TTY should remain what it is -- a device for efficiently processing text
received as a simple byte stream. Another objective is to only move the minimum
possible amount of extra functionality into the terminal program itself. This
is to make it as easy to implement these protocol extensions as possible,
thereby hopefully encouraging their widespread adoption.
possible amount of extra functionality into the terminal program itself. This is
to make it as easy to implement these protocol extensions as possible, thereby
hopefully encouraging their widespread adoption.
If you wish to discuss these extensions, propose additions/changes to them
please do so by opening issues in the `GitHub
<https://github.com/kovidgoyal/kitty/issues>`_ bug tracker.
If you wish to discuss these extensions, propose additions or changes to them,
please do so by opening issues in the `GitHub bug tracker
<https://github.com/kovidgoyal/kitty/issues>`__.
.. toctree::
@@ -31,3 +32,4 @@ please do so by opening issues in the `GitHub
unscroll
color-stack
deccara
clipboard

View File

@@ -9,9 +9,9 @@ Quickstart
binary
build
Pre-built binaries of |kitty| are available for both macOS and Linux.
See the :doc:`binary install instructions </binary>`. You can also
:doc:`build from source </build>`.
Pre-built binaries of |kitty| are available for both macOS and Linux. See the
:doc:`binary install instructions </binary>`. You can also :doc:`build from
source </build>`.
Additionally, you can use your favorite package manager to install the |kitty|
package, but note that some Linux distribution packages are woefully outdated.
@@ -25,4 +25,4 @@ and Linux.
See :doc:`Configuring kitty <conf>` for help on configuring |kitty| and
:doc:`Invocation <invocation>` for the command line arguments |kitty| supports.
For a tour of kitty's design and features, see the :doc:`/overview`.
For a tour of kitty's design and features, see the :doc:`overview`.

View File

@@ -7,34 +7,101 @@ form::
<ESC>P@kitty-cmd<JSON object><ESC>\
Where ``<ESC>`` is the byte ``0x1b``. The JSON object has the form::
Where ``<ESC>`` is the byte ``0x1b``. The JSON object has the form:
.. code-block:: json
{
"cmd": "command name",
"version": <kitty version>,
"no_response": <Optional Boolean>,
"payload": <Optional JSON object>,
"version": "<kitty version>",
"no_response": "<Optional Boolean>",
"kitty_window_id": "<Optional value of the KITTY_WINDOW_ID env var>",
"payload": "<Optional JSON object>"
}
The ``version`` above is an array of the form :code:`[0, 14, 2]`. If you are developing a
standalone client, use the kitty version that you are developing against. Using
a version greater than the version of the kitty instance you are talking to,
will cause a failure.
The ``version`` above is an array of the form :code:`[0, 14, 2]`. If you are
developing a standalone client, use the kitty version that you are developing
against. Using a version greater than the version of the kitty instance you are
talking to, will cause a failure.
Set ``no_response`` to ``true`` if you don't want a response from kitty.
The optional payload is a JSON object that is specific to the actual command being sent.
The fields in the object for every command are documented below.
The optional payload is a JSON object that is specific to the actual command
being sent. The fields in the object for every command are documented below.
As a quick example showing how easy to use this protocol is, we will implement
the ``@ ls`` command from the shell using only shell tools. First, run kitty
as::
the ``@ ls`` command from the shell using only shell tools.
First, run kitty as::
kitty -o allow_remote_control=socket-only --listen-on unix:/tmp/test
Now, in a different terminal, you can get the pretty printed ``@ ls`` output
with the following command line::
echo -en '\eP@kitty-cmd{"cmd":"ls","version":[0,14,2]}\e\' | socat - unix:/tmp/test | awk '{ print substr($0, 13, length($0) - 14) }' | jq -c '.data | fromjson' | jq .
echo -en '\eP@kitty-cmd{"cmd":"ls","version":[0,14,2]}\e\\' | socat - unix:/tmp/test | awk '{ print substr($0, 13, length($0) - 14) }' | jq -c '.data | fromjson' | jq .
There is also the statically compiled stand-alone executable ``kitten``
that can be used for this, available from the `kitty releases
<https://github.com/kovidgoyal/kitty/releases>`__ page::
kitten @ --help
.. _rc_crypto:
Encrypted communication
--------------------------
.. versionadded:: 0.26.0
When using the :opt:`remote_control_password` option communication to the
terminal is encrypted to keep the password secure. A public key is used from
the :envvar:`KITTY_PUBLIC_KEY` environment variable. Currently, only one
encryption protocol is supported. The protocol number is present in
:envvar:`KITTY_PUBLIC_KEY` as ``1``. The key data in this environment variable
is :rfc:`Base-85 <1924>` encoded. The algorithm used is `Elliptic Curve Diffie
Helman <https://en.wikipedia.org/wiki/Elliptic-curve_DiffieHellman>`__ with
the `X25519 curve <https://en.wikipedia.org/wiki/Curve25519>`__. A time based
nonce is used to minimise replay attacks. The original JSON command has the
fields: ``password`` and ``timestamp`` added. The timestamp is the number of
nanoseconds since the epoch, excluding leap seconds. Commands with a timestamp
more than 5 minutes from the current time are rejected. The command is then
encrypted using AES-256-GCM in authenticated encryption mode, with a symmetric
key that is derived from the ECDH key-pair by running the shared secret through
SHA-256 hashing, once. An IV of at least 96 bits of CSPRNG data is used. The
tag for authenticated encryption **must** be at least 128 bits long. The tag
**must** authenticate only the value of the ``encrypted`` field. A new command
is created and transmitted that contains the fields:
.. code-block:: json
{
"version": "<kitty version>",
"iv": "base85 encoded IV",
"tag": "base85 encoded AEAD tag",
"pubkey": "base85 encoded ECDH public key of sender",
"encrypted": "The original command encrypted and base85 encoded"
}
Async and streaming requests
---------------------------------
Some remote control commands require asynchronous communication, that is, the
response from the terminal can happen after an arbitrary amount of time. For
example, the :code:`select-window` command requires the user to select a window
before a response can be sent. Such command must set the field :code:`async`
in the JSON block above to a random string that serves as a unique id. The
client can cancel an async request in flight by adding the :code:`cancel_async`
field to the JSON block. A async response remains in flight until the terminal
sends a response to the request. Note that cancellation requests dont need to
be encrypted as users must not be prompted for these and the worst a malicious
cancellation request can do is prevent another sync request from getting a
response.
Similar to async requests are *streaming* requests. In these the client has to
send a large amount of data to the terminal and so the request is split into
chunks. In every chunk the JSON block must contain the field ``stream`` set to
``true`` and ``stream_id`` set to a random long string, that should be the same for
all chunks in a request. End of data is indicated by sending a chunk with no data.
.. include:: generated/rc.rst

View File

@@ -4,9 +4,12 @@ Control kitty from scripts
.. highlight:: sh
|kitty| can be controlled from scripts or the shell prompt. You can open new
windows, send arbitrary text input to any window, name windows and tabs, etc.
windows, send arbitrary text input to any window, change the title of windows
and tabs, etc.
Let's walk through a few examples of controlling |kitty|.
Tutorial
------------
@@ -14,50 +17,52 @@ Start by running |kitty| as::
kitty -o allow_remote_control=yes -o enabled_layouts=tall
In order for control to work, :opt:`allow_remote_control` must be enabled in
:file:`kitty.conf`. Here we turn it on explicitly at the command line.
In order for control to work, :opt:`allow_remote_control` or
:opt:`remote_control_password` must be enabled in :file:`kitty.conf`. Here we
turn it on explicitly at the command line.
Now, in the new |kitty| window, enter the command::
kitty @ launch --title Output --keep-focus cat
This will open a new window, running the ``cat`` program that will appear next
to the current window.
This will open a new window, running the :program:`cat` program that will appear
next to the current window.
Let's send some text to this new window::
kitty @ send-text --match cmdline:cat Hello, World
This will make ``Hello, World`` show up in the window running the ``cat`` program.
The :option:`kitty @ send-text --match` option is very powerful, it allows selecting windows by their
titles, the command line of the program running in the window, the working
directory of the program running in the window, etc. See ``kitty @ send-text
--help`` for details.
This will make ``Hello, World`` show up in the window running the :program:`cat`
program. The :option:`kitty @ send-text --match` option is very powerful, it
allows selecting windows by their titles, the command line of the program
running in the window, the working directory of the program running in the
window, etc. See :ref:`kitty @ send-text --help <at-send-text>` for details.
More usefully, you can pipe the output of a command running in one window to
another window, for example::
ls | kitty @ send-text --match title:Output --stdin
ls | kitty @ send-text --match 'title:^Output' --stdin
This will show the output of ls in the output window instead of the current
window. You can use this technique to, for example, show the output of running
``make`` in your editor in a different window. The possibilities are endless.
This will show the output of :program:`ls` in the output window instead of the
current window. You can use this technique to, for example, show the output of
running :program:`make` in your editor in a different window. The possibilities
are endless.
You can even have things you type show up in a different window. Run::
kitty @ send-text --match title:Output --stdin
kitty @ send-text --match 'title:^Output' --stdin
And type some text, it will show up in the output window, instead of the current
window. Type ``Ctrl+D`` when you are ready to stop.
window. Type :kbd:`Ctrl+D` when you are ready to stop.
Now, let's open a new tab::
kitty @ launch --type=tab --tab-title "My Tab" --keep-focus bash
This will open a new tab running the bash shell with the title "My Tab".
We can change the title of the tab with::
We can change the title of the tab to "New Title" with::
kitty @ set-tab-title --match title:My New Title
kitty @ set-tab-title --match 'title:^My' New Title
Let's change the title of the current tab::
@@ -65,79 +70,196 @@ Let's change the title of the current tab::
Now lets switch to the newly opened tab::
kitty @ focus-tab --match title:New
kitty @ focus-tab --match 'title:^New'
Similarly, to focus the previously opened output window (which will also switch
back to the old tab, automatically)::
kitty @ focus-window --match title:Output
kitty @ focus-window --match 'title:^Output'
You can get a listing of available tabs and windows, by running::
kitty @ ls
This outputs a tree of data in JSON format. The top level of the tree is all
operating system kitty windows. Each OS window has an id and a list of tabs.
Each tab has its own id, a title and a list of windows. Each window has an id,
title, current working directory, process id (PID) and command-line of the
process running in the window. You can use this information with :option:`kitty @ focus-window --match`
to control individual windows.
:term:`OS windows <os_window>`. Each OS window has an id and a list of
:term:`tabs <tab>`. Each tab has its own id, a title and a list of :term:`kitty
windows <window>`. Each window has an id, title, current working directory,
process id (PID) and command-line of the process running in the window. You can
use this information with :option:`kitty @ focus-window --match` to control
individual windows.
As you can see, it is very easy to control |kitty| using the
``kitty @`` messaging system. This tutorial touches only the
surface of what is possible. See ``kitty @ --help`` for more details.
As you can see, it is very easy to control |kitty| using the ``kitty @``
messaging system. This tutorial touches only the surface of what is possible.
See ``kitty @ --help`` for more details.
Note that in the example's above, ``kitty @`` messaging works only when run inside a |kitty| window,
not anywhere. But, within a |kitty| window it even works over SSH. If you want to control
|kitty| from programs/scripts not running inside a |kitty| window, you have to implement a couple of
extra steps. First start |kitty| as::
In the example's above, ``kitty @`` messaging works only when run
inside a |kitty| window, not anywhere. But, within a |kitty| window it even
works over SSH. If you want to control |kitty| from programs/scripts not running
inside a |kitty| window, see the section on :ref:`using a socket for remote control <rc_via_socket>`
below.
Note that if all you want to do is run a single |kitty| "daemon" and have
subsequent |kitty| invocations appear as new top-level windows, you can use the
simpler :option:`kitty --single-instance` option, see ``kitty --help`` for that.
.. _rc_via_socket:
Remote control via a socket
--------------------------------
First, start |kitty| as::
kitty -o allow_remote_control=yes --listen-on unix:/tmp/mykitty
The :option:`kitty --listen-on` option tells |kitty| to listen for control messages at the
specified path. See ``kitty --help`` for details. Now you can control this
instance of |kitty| using the :option:`kitty @ --to` command line argument to ``kitty @``. For example::
The :option:`kitty --listen-on` option tells |kitty| to listen for control
messages at the specified UNIX-domain socket. See ``kitty --help`` for details.
Now you can control this instance of |kitty| using the :option:`kitty @ --to`
command line argument to ``kitty @``. For example::
kitty @ --to unix:/tmp/mykitty ls
Note that if all you want to do is run a single |kitty| "daemon" and have subsequent
|kitty| invocations appear as new top-level windows, you can use the simpler :option:`kitty --single-instance`
option, see ``kitty --help`` for that.
The builtin kitty shell
--------------------------
You can explore the |kitty| command language more easily using the builtin |kitty|
shell. Run ``kitty @`` with no arguments and you will be dropped into the |kitty|
shell with completion for |kitty| command names and options.
You can explore the |kitty| command language more easily using the builtin
|kitty| shell. Run ``kitty @`` with no arguments and you will be dropped into
the |kitty| shell with completion for |kitty| command names and options.
You can even open the |kitty| shell inside a running |kitty| using a simple
keyboard shortcut (:sc:`kitty_shell` by default).
.. note:: This has the added advantage that you don't need to use
``allow_remote_control`` to make it work.
:opt:`allow_remote_control` to make it work.
Allowing only some windows to control kitty
----------------------------------------------
If you do not want to allow all programs running in |kitty| to control it, you can selectively
enable remote control for only some |kitty| windows. Simply create a shortcut
such as::
If you do not want to allow all programs running in |kitty| to control it, you
can selectively enable remote control for only some |kitty| windows. Simply
create a shortcut such as::
map ctrl+k launch --allow-remote-control some_program
Then programs running in windows created with that shortcut can use ``kitty @``
to control kitty. Note that any program with the right level of permissions can
still write to the pipes of any other program on the same computer and
therefore can control |kitty|. It can, however, be useful to block programs
running on other computers (for example, over ssh) or as other users.
still write to the pipes of any other program on the same computer and therefore
can control |kitty|. It can, however, be useful to block programs running on
other computers (for example, over SSH) or as other users.
.. note:: You dont need ``allow_remote_control`` to make this work as it is
.. note:: You don't need :opt:`allow_remote_control` to make this work as it is
limited to only programs running in that specific window. Be careful with
what programs you run in such windows, since they can effectively control
kitty, as if you were running with ``allow_remote_control`` turned on.
kitty, as if you were running with :opt:`allow_remote_control` turned on.
You can further restrict what is allowed in these windows by using
:option:`kitty @ launch --remote-control-password`.
Fine grained permissions for remote control
----------------------------------------------
.. versionadded:: 0.26.0
The :opt:`allow_remote_control` option discussed so far is a blunt
instrument, granting the ability to any program running on your computer
or even on remote computers via SSH the ability to use remote control.
You can instead define remote control passwords that can be used to grant
different levels of control to different places. You can even write your
own script to decide which remote control requests are allowed. This is
done using the :opt:`remote_control_password` option in :file:`kitty.conf`.
Set :opt:`allow_remote_control` to :code:`password` to use this feature.
Let's see some examples:
.. code-block:: conf
remote_control_password "control colors" get-colors set-colors
Now, using this password, you can, in scripts run the command::
kitty @ --password="control colors" set-colors background=red
Any script with access to the password can now change colors in kitty using
remote control, but only that and nothing else. You can even supply the
password via the :envvar:`KITTY_RC_PASSWORD` environment variable, or the
file :file:`~/.config/kitty/rc-password` to avoid having to type it repeatedly.
See :option:`kitty @ --password-file` and :option:`kitty @ --password-env`.
The :opt:`remote_control_password` can be specified multiple times to create
different passwords with different capabilities. Run the following to get a
list of all action names::
kitty @ --help
You can even use glob patterns to match action names, for example:
.. code-block:: conf
remote_control_password "control colors" *-colors
If no action names are specified, all actions are allowed.
If ``kitty @`` is run with a password that is not present in
:file:`kitty.conf`, then kitty will interactively prompt the user to allow or
disallow the remote control request. The user can choose to allow or disallow
either just that request or all requests using that password. The user's
decision is remembered for the duration of that kitty instance.
.. note::
For password based authentication to work over SSH, you must pass the
:envvar:`KITTY_PUBLIC_KEY` environment variable to the remote host. The
:doc:`ssh kitten <kittens/ssh>` does this for you automatically. When
using a password, :ref:`rc_crypto` is used to ensure the password
is kept secure. This does mean that using password based authentication
is slower as the entire command is encrypted before transmission. This
can be noticeable when using a command like ``kitty @ set-background-image``
which transmits large amounts of image data. Also, the clock on the remote
system must match (within a few minutes) the clock on the local system.
kitty uses a time based nonce to minimise the potential for replay attacks.
.. _rc_custom_auth:
Customizing authorization with your own program
____________________________________________________________
If the ability to control access by action names is not fine grained enough,
you can define your own Python script to examine every remote control command
and allow/disallow it. To do so create a file in the kitty configuration
directory, :file:`~/.config/kitty/my_rc_auth.py` and add the following
to :file:`kitty.conf`:
.. code-block:: conf
remote_control_password "testing custom auth" my_rc_auth.py
:file:`my_rc_auth.py` should define a :code:`is_cmd_allowed` function
as shown below:
.. code-block:: py
def is_cmd_allowed(pcmd, window, from_socket, extra_data):
cmd_name = pcmd['cmd'] # the name of the command
cmd_payload = pcmd['payload'] # the arguments to the command
# examine the cmd_name and cmd_payload and return True to allow
# the command or False to disallow it. Return None to have no
# effect on the command.
# The command payload will vary from command to command, see
# the rc protocol docs for details. Below is an example of
# restricting the launch command to allow only running the
# default shell.
if cmd_name != 'launch':
return None
if cmd_payload.get('args') or cmd_payload.get('env') or cmd_payload.get('copy_cmdline') or cmd_payload.get('copy_env'):
return False
# prints in this function go to the parent kitty process STDOUT
print('Allowing launch command:', cmd_payload)
return True
.. _rc_mapping:
@@ -148,15 +270,21 @@ Mapping key presses to remote control commands
If you wish to trigger a remote control command easily with just a keypress,
you can map it in :file:`kitty.conf`. For example::
map F1 remote_control set-spacing margin=30
map f1 remote_control set-spacing margin=30
Then pressing the :kbd:`F1` key will set the active window margins to 30.
The syntax for what follows :code:`remote_control` is exactly the same
Then pressing the :kbd:`F1` key will set the active window margins to
:code:`30`. The syntax for what follows :ac:`remote_control` is exactly the same
as the syntax for what follows :code:`kitty @` above.
.. note:: You do not need ``allow_remote_control`` to use these mappings,
as they are not actual remote programs, but are simply a way to resuse
the remote control infrastructure via keybings.
If you wish to ignore errors from the command, prefix the command with an
``!``. For example, the following will not return an error when no windows
are matched::
map f1 remote_control !focus-window --match XXXXXX
.. note:: You do not need :opt:`allow_remote_control` to use these mappings,
as they are not actual remote programs, but are simply a way to resuse the
remote control infrastructure via keybings.
Broadcasting what you type to all kitty windows
@@ -166,17 +294,42 @@ As a simple illustration of the power of remote control, lets
have what we type sent to all open kitty windows. To do that define the
following mapping in :file:`kitty.conf`::
map F1 launch --allow-remote-control kitty +kitten broadcast
map f1 launch --allow-remote-control kitty +kitten broadcast
Now press, F1 and start typing, what you type will be sent to all windows,
Now press :kbd:`F1` and start typing, what you type will be sent to all windows,
live, as you type it.
The remote control protocol
-----------------------------------------------
If you wish to develop your own client to talk to |kitty|, you
can use the :doc:`protocol specification <rc_protocol>`.
If you wish to develop your own client to talk to |kitty|, you can use the
:doc:`remote control protocol specification <rc_protocol>`. Note that there
is a statically compiled, standalone executable, ``kitten`` available that
can be used as a remote control client on any UNIX like computer. This can be
downloaded and used directly from the `kitty releases
<https://github.com/kovidgoyal/kitty/releases>`__ page::
kitten @ --help
.. _search_syntax:
Matching windows and tabs
----------------------------
Many remote control operations operate on windows or tabs. To select these, the
:code:`--match` option is often used. This allows matching using various
sophisticated criteria such as title, ids, cmdlines, etc. These criteria are
expressions of the form :code:`field:query`. Where :italic:`field` is the field
against which to match and :italic:`query` is the expression to match. They can
be further combined using Boolean operators, best illustrated with some
examples::
title:"My special window" or id:43
title:bash and env:USER=kovid
not id:1
(id:2 or id:3) and title:something
.. toctree::
:hidden:

View File

@@ -4,8 +4,8 @@ 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
<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.
@@ -22,7 +22,7 @@ Features
* 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
* 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
@@ -30,37 +30,57 @@ Features
* The text cursor is changed to a bar when editing commands at the shell prompt
* :ref:`clone_shell` with all environment variables and the working directory
copied
* :ref:`Edit files in new kitty windows <edit_file>` even over SSH
* 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`)
it is not counted (for details, 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
default, all integration features are 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
Turn off all shell integration. The shell's launch environment is not
modified and :envvar:`KITTY_SHELL_INTEGRATION` is not set. Useful for
:ref:`manual integration <manual_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>`.
Do not modify the shell's launch environment to enable integration. Useful
if you prefer to load the kitty shell integration code yourself, either as
part of :ref:`manually integration <manual_shell_integration>` or because
you have some other software that sets up shell integration.
This will still set the :envvar:`KITTY_SHELL_INTEGRATION` environment
variable when kitty runs the shell.
no-cursor
Turn off changing of the text cursor to a bar when editing text
Turn off changing of the text cursor to a bar when editing shell command
line.
no-title
Turn off setting the kitty window/tab title based on shell state.
Note that for the ``fish`` shell kitty relies on fish's native title
setting functionality instead.
Note that for the fish shell kitty relies on fish's native title setting
functionality instead.
no-cwd
Turn off reporting the current working directory. This is used to allow
:ac:`new_window_with_cwd` and similar to open windows logged into remote
machines using the :doc:`ssh kitten <kittens/ssh>` automatically with the
same working directory as the current window.
Note that for the fish shell this will not disable its built-in current
working directory reporting.
no-prompt-mark
Turn off marking of prompts. This disables jumping to prompt, browsing
@@ -68,16 +88,16 @@ no-prompt-mark
no-complete
Turn off completion for the kitty command.
Note that for the ``fish`` shell this does not take effect, since fish
already comes with a kitty completion script.
Note that for the fish shell this does not take effect, since fish already
comes with a kitty completion script.
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`:
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
@@ -88,8 +108,8 @@ 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
actions (:ac:`mouse_select_command_output` and :ac:`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
@@ -121,38 +141,41 @@ 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.
or the :opt:`shell` option in :file:`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.
For zsh, kitty sets the :envvar:`ZDOTDIR` environment variable to make zsh
load kitty's :file:`.zshenv` which restores the original value of
:envvar:`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.
:envvar:`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.
For bash, kitty starts bash in POSIX mode, using the environment variable
:envvar:`ENV` to load the shell integration script. This prevents bash from
loading any startup files itself. The loading of the startup files is done
by the integration script, after disabling POSIX mode. From the perspective
of those scripts there should be no difference to running vanilla bash.
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.
pollute the system.
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
@@ -185,13 +208,97 @@ code used for each shell below:
</details>
Shell integration over SSH
----------------------------
The easiest way to have shell integration work when SSHing into remote systems
is to use the :doc:`ssh kitten <kittens/ssh>`. Simply run::
kitty +kitten ssh hostname
And, by magic, you will be logged into the remote system with fully functional
shell integration. Alternately, you can :ref:`setup shell integration manually
<manual_shell_integration>`, by copying the kitty shell integration scripts to
the remote server and editing the shell rc files there, as described below.
.. _clone_shell:
Clone the current shell into a new window
-----------------------------------------------
You can clone the current shell into a new kitty window by simply running the
:command:`clone-in-kitty` command, for example:
.. code-block:: sh
clone-in-kitty
clone-in-kitty --type=tab
clone-in-kitty --title "I am a clone"
This will open a new window running a new shell instance but with all
environment variables and the current working directory copied. This even works
over SSH when using :doc:`kittens/ssh`.
The :command:`clone-in-kitty` command takes almost all the same arguments as the
:doc:`launch <launch>` command, so you can open a new tab instead or a new OS
window, etc. Arguments of launch that can cause code execution or that don't
make sense when cloning are ignored. Most prominently, the following options are
ignored: :option:`--allow-remote-control <launch --allow-remote-control>`,
:option:`--copy-cmdline <launch --copy-cmdline>`, :option:`--copy-env <launch
--copy-env>`, :option:`--stdin-source <launch --stdin-source>`,
:option:`--marker <launch --marker>` and :option:`--watcher <launch --watcher>`.
:command:`clone-in-kitty` can be configured to source arbitrary code in the
cloned window using environment variables. It will automatically clone virtual
environments created by the :link:`Python venv module
<https://docs.python.org/3/library/venv.html>` or :link:`Conda
<https://conda.io/>`. In addition, setting the
env var :envvar:`KITTY_CLONE_SOURCE_CODE` to some shell code will cause that
code to be run in the cloned window with :code:`eval`. Similarly, setting
:envvar:`KITTY_CLONE_SOURCE_PATH` to the path of a file will cause that file to
be sourced in the cloned window. This can be controlled by
:opt:`clone_source_strategies`.
:command:`clone-in-kitty` works by asking the shell to serialize its internal
state (mainly CWD and env vars) and this state is transmitted to kitty and
restored by the shell integration scripts in the cloned window.
.. _edit_file:
Edit files in new kitty windows even over SSH
------------------------------------------------
.. code-block:: sh
edit-in-kitty myfile.txt
edit-in-kitty --type tab --title "Editing My File" myfile.txt
# open myfile.txt at line 75 (works with vim, neovim, emacs, nano, micro)
edit-in-kitty +75 myfile.txt
The :command:`edit-in-kitty` command allows you to seamlessly edit files
in your default :opt:`editor` in new kitty windows. This works even over
SSH (if you use the :doc:`ssh kitten <kittens/ssh>`), allowing you
to easily edit remote files in your local editor with all its bells and
whistles.
The :command:`edit-in-kitty` command takes almost all the same arguments as the
:doc:`launch <launch>` command, so you can open a new tab instead or a new OS
window, etc. Not all arguments are supported, see the discussion in the
:ref:`clone_shell` section above.
In order to avoid remote code execution, kitty will only execute the configured
editor and pass the file path to edit to it.
.. _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.
it wont work for sub-shells, terminal multiplexers, containers, 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.
@@ -239,18 +346,17 @@ The value of :envvar:`KITTY_SHELL_INTEGRATION` is the same as that for
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 :envvar:`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.
In a container, you will need to install the kitty shell integration scripts
and make sure the :envvar:`KITTY_INSTALLATION_DIR` environment variable is set
to point to the location of the scripts.
Integration with other shells
-------------------------------
There exist third-party integrations to use these features for various other shells:
There exist third-party integrations to use these features for various other
shells:
* Jupyter console via a patch (:iss:`4475`)
* Jupyter console and IPython via a patch (:iss:`4475`)
* `xonsh <https://github.com/xonsh/xonsh/issues/4623>`__

View File

@@ -1,5 +1,21 @@
A message from us at KittyPatch
===============================
KittyPatch was created as a home for useful features that are unavailable
in the kitty main branch. To this end, we do not accept donations directly.
If you wish to support KittyPatch: share your ideas and spread the word.
If you still wish to donate, please `support the Free Software Foundation
<https://my.fsf.org/donate>`.
A message from the maintainer of Kitty
======================================
Support kitty development ❤️
==============================
>>>>>>> upstream/master
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

View File

@@ -1,24 +1,25 @@
Colored and styled underlines
================================
|kitty| supports colored and styled (wavy) underlines. This is of particular
use in terminal editors such as vim and emacs to display red, wavy underlines
under mis-spelled words and/or syntax errors. This is done by re-purposing some
SGR escape codes that are not used in modern terminals (`CSI codes
<https://en.wikipedia.org/wiki/ANSI_escape_code#CSI_(Control_Sequence_Introducer)_sequences>`_)
|kitty| supports colored and styled (wavy) underlines. This is of particular use
in terminal based text editors such as :program:`vim` and :program:`emacs` to
display red, wavy underlines under mis-spelled words and/or syntax errors. This
is done by re-purposing some SGR escape codes that are not used in modern
terminals (`CSI codes <https://en.wikipedia.org/wiki/ANSI_escape_code#CSI_(Control_Sequence_Introducer)_sequences>`__)
To set the underline style::
<ESC>[4:0m # this is no underline
<ESC>[4:1m # this is a straight underline
<ESC>[4:2m # this is a double underline
<ESC>[4:3m # this is a curly underline
<ESC>[4:4m # this is a dotted underline
<ESC>[4:5m # this is a dashed underline
<ESC>[4m # this is a straight underline (for backwards compat)
<ESC>[24m # this is no underline (for backwards compat)
<ESC>[4:0m # no underline
<ESC>[4:1m # straight underline
<ESC>[4:2m # double underline
<ESC>[4:3m # curly underline
<ESC>[4:4m # dotted underline
<ESC>[4:5m # dashed underline
<ESC>[4m # straight underline (for backwards compat)
<ESC>[24m # no underline (for backwards compat)
To set the underline color (this is reserved and as far as I can tell not actually used for anything)::
To set the underline color (this is reserved and as far as I can tell not
actually used for anything)::
<ESC>[58...m
@@ -29,8 +30,8 @@ To reset the underline color (also previously reserved and unused)::
<ESC>[59m
The underline color must remain the same under reverse video, if it has a
color, if not, it should follow the foreground color.
The underline color must remain the same under reverse video, if it has a color,
if not, it should follow the foreground color.
To detect support for this feature in a terminal emulator, query the terminfo database
for the ``Su`` boolean capability.
To detect support for this feature in a terminal emulator, query the terminfo
database for the ``Su`` boolean capability.

View File

@@ -4,10 +4,10 @@ Unscrolling the screen
========================
This is a small extension to the `SD (Pan up) escape code
<https://vt100.net/docs/vt510-rm/SD.html>`_ from the VT-420 terminal. The
``SD`` escape code normally causes the text on screen to scroll down by the
specified number of lines, with empty lines appearing at the top of the screen.
This extension allows the new lines to be filled in from the scrollback buffer
<https://vt100.net/docs/vt510-rm/SD.html>`_ from the VT-420 terminal. The ``SD``
escape code normally causes the text on screen to scroll down by the specified
number of lines, with empty lines appearing at the top of the screen. This
extension allows the new lines to be filled in from the scrollback buffer
instead of being blank.
The motivation for this is that many modern shells will show completions in a
@@ -22,17 +22,17 @@ scrolled down is implementation defined, but must be at least one screen worth.
The syntax of the escape code is identical to that of ``SD`` except that it has
a trailing ``+`` modifier. This is legal under the `ECMA 48 standard
<https://www.ecma-international.org/publications-and-standards/standards/ecma-48/>`_
<https://www.ecma-international.org/publications-and-standards/standards/ecma-48/>`__
and unused for any other purpose as far as I can tell. So for example, to
unscroll three lines, the escape code would be::
CSI 3 + T
See `discussion here
<https://gitlab.freedesktop.org/terminal-wg/specifications/-/issues/30>`_.
<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>`_
* `mintty <https://github.com/mintty/mintty/releases/tag/3.5.2>`__

View File

@@ -274,6 +274,7 @@ def graphics_parser() -> None:
'Y': ('cell_y_offset', 'uint'),
'z': ('z_index', 'int'),
'C': ('cursor_movement', 'uint'),
'U': ('unicode_placement', 'uint'),
}
text = generate('parse_graphics_code', 'screen_handle_graphics_command', 'graphics_command', keymap, 'GraphicsCommand')
write_header(text, 'kitty/parse-graphics-command.h')

View File

@@ -1,8 +1,9 @@
#!/usr/bin/env python
#!./kitty/launcher/kitty +launch
# License: GPLv3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
import re
import subprocess
from typing import List
from kitty.conf.generate import write_output
@@ -11,14 +12,25 @@ 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)
colors = sorted(colors)
if path.endswith('.go'):
spc = '\t'
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}":true,', colors)) + r'\2',
raw, flags=re.DOTALL | re.MULTILINE)
else:
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},', colors)) + r'\2',
raw, flags=re.DOTALL | re.MULTILINE)
if nraw != raw:
f.seek(0)
f.truncate()
f.write(nraw)
f.flush()
if path.endswith('.go'):
subprocess.check_call(['gofmt', '-w', path])
def main() -> None:
@@ -34,10 +46,8 @@ def main() -> None:
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)
patch_color_list('tools/cmd/at/set_colors.go', nullable_colors, 'NULLABLE')
patch_color_list('tools/themes/collection.go', all_colors, 'ALL')
if __name__ == '__main__':

767
gen-go-code.py Executable file
View File

@@ -0,0 +1,767 @@
#!./kitty/launcher/kitty +launch
# License: GPLv3 Copyright: 2022, Kovid Goyal <kovid at kovidgoyal.net>
import bz2
import io
import json
import os
import re
import struct
import subprocess
import sys
import tarfile
from contextlib import contextmanager, suppress
from functools import lru_cache
from itertools import chain
from typing import (
Any,
BinaryIO,
Dict,
Iterator,
List,
Optional,
Sequence,
Set,
TextIO,
Tuple,
Union,
)
import kitty.constants as kc
from kittens.tui.operations import Mode
from kittens.tui.spinners import spinners
from kitty.cli import (
CompletionSpec,
GoOption,
go_options_for_seq,
parse_option_spec,
serialize_as_go_string,
)
from kitty.conf.generate import gen_go_code
from kitty.conf.types import Definition
from kitty.guess_mime_type import known_extensions, text_mimes
from kitty.key_encoding import config_mod_map
from kitty.key_names import character_key_name_aliases, functional_key_name_aliases
from kitty.options.types import Options
from kitty.rc.base import RemoteCommand, all_command_names, command_for_name
from kitty.remote_control import global_options_spec
from kitty.rgb import color_names
changed: List[str] = []
def newer(dest: str, *sources: str) -> bool:
try:
dtime = os.path.getmtime(dest)
except OSError:
return True
for s in chain(sources, (__file__,)):
with suppress(FileNotFoundError):
if os.path.getmtime(s) >= dtime:
return True
return False
# Utils {{{
def serialize_go_dict(x: Union[Dict[str, int], Dict[int, str], Dict[int, int], Dict[str, str]]) -> str:
ans = []
def s(x: Union[int, str]) -> str:
if isinstance(x, int):
return str(x)
return f'"{serialize_as_go_string(x)}"'
for k, v in x.items():
ans.append(f'{s(k)}: {s(v)}')
return '{' + ', '.join(ans) + '}'
def replace(template: str, **kw: str) -> str:
for k, v in kw.items():
template = template.replace(k, v)
return template
# }}}
# Completions {{{
@lru_cache
def kitten_cli_docs(kitten: str) -> Any:
from kittens.runner import get_kitten_cli_docs
return get_kitten_cli_docs(kitten)
@lru_cache
def go_options_for_kitten(kitten: str) -> Tuple[Sequence[GoOption], Optional[CompletionSpec]]:
kcd = kitten_cli_docs(kitten)
if kcd:
ospec = kcd['options']
return (tuple(go_options_for_seq(parse_option_spec(ospec())[0])), kcd.get('args_completion'))
return (), None
def generate_kittens_completion() -> None:
from kittens.runner import all_kitten_names, get_kitten_wrapper_of
for kitten in sorted(all_kitten_names()):
kn = 'kitten_' + kitten
print(f'{kn} := plus_kitten.AddSubCommand(&cli.Command{{Name:"{kitten}", Group: "Kittens"}})')
wof = get_kitten_wrapper_of(kitten)
if wof:
print(f'{kn}.ArgCompleter = cli.CompletionForWrapper("{serialize_as_go_string(wof)}")')
print(f'{kn}.OnlyArgsAllowed = true')
continue
gopts, ac = go_options_for_kitten(kitten)
if gopts or ac:
for opt in gopts:
print(opt.as_option(kn))
if ac is not None:
print(''.join(ac.as_go_code(kn + '.ArgCompleter', ' = ')))
else:
print(f'{kn}.HelpText = ""')
@lru_cache
def clone_safe_launch_opts() -> Sequence[GoOption]:
from kitty.launch import clone_safe_opts, options_spec
ans = []
allowed = clone_safe_opts()
for o in go_options_for_seq(parse_option_spec(options_spec())[0]):
if o.obj_dict['name'] in allowed:
ans.append(o)
return tuple(ans)
def completion_for_launch_wrappers(*names: str) -> None:
for o in clone_safe_launch_opts():
for name in names:
print(o.as_option(name))
def generate_completions_for_kitty() -> None:
from kitty.config import option_names_for_completion
print('package completion\n')
print('import "kitty/tools/cli"')
print('import "kitty/tools/cmd/tool"')
print('import "kitty/tools/cmd/at"')
conf_names = ', '.join((f'"{serialize_as_go_string(x)}"' for x in option_names_for_completion()))
print('var kitty_option_names_for_completion = []string{' + conf_names + '}')
print('func kitty(root *cli.Command) {')
# The kitty exe
print('k := root.AddSubCommand(&cli.Command{'
'Name:"kitty", SubCommandIsOptional: true, ArgCompleter: cli.CompleteExecutableFirstArg, SubCommandMustBeFirst: true })')
print('kt := root.AddSubCommand(&cli.Command{Name:"kitten", SubCommandMustBeFirst: true })')
print('tool.KittyToolEntryPoints(kt)')
for opt in go_options_for_seq(parse_option_spec()[0]):
print(opt.as_option('k'))
# kitty +
print('plus := k.AddSubCommand(&cli.Command{Name:"+", Group:"Entry points", ShortDescription: "Various special purpose tools and kittens"})')
# kitty +launch
print('plus_launch := plus.AddSubCommand(&cli.Command{'
'Name:"launch", Group:"Entry points", ShortDescription: "Launch Python scripts", ArgCompleter: complete_plus_launch})')
print('k.AddClone("", plus_launch).Name = "+launch"')
# kitty +list-fonts
print('plus_list_fonts := plus.AddSubCommand(&cli.Command{'
'Name:"list-fonts", Group:"Entry points", ShortDescription: "List all available monospaced fonts"})')
print('k.AddClone("", plus_list_fonts).Name = "+list-fonts"')
# kitty +runpy
print('plus_runpy := plus.AddSubCommand(&cli.Command{'
'Name: "runpy", Group:"Entry points", ArgCompleter: complete_plus_runpy, ShortDescription: "Run Python code"})')
print('k.AddClone("", plus_runpy).Name = "+runpy"')
# kitty +open
print('plus_open := plus.AddSubCommand(&cli.Command{'
'Name:"open", Group:"Entry points", ArgCompleter: complete_plus_open, ShortDescription: "Open files and URLs"})')
print('for _, og := range k.OptionGroups { plus_open.OptionGroups = append(plus_open.OptionGroups, og.Clone(plus_open)) }')
print('k.AddClone("", plus_open).Name = "+open"')
# kitty +kitten
print('plus_kitten := plus.AddSubCommand(&cli.Command{Name:"kitten", Group:"Kittens", SubCommandMustBeFirst: true})')
generate_kittens_completion()
print('k.AddClone("", plus_kitten).Name = "+kitten"')
# @
print('at.EntryPoint(k)')
# clone-in-kitty, edit-in-kitty
print('cik := root.AddSubCommand(&cli.Command{Name:"clone-in-kitty"})')
completion_for_launch_wrappers('cik')
print('}')
print('func init() {')
print('cli.RegisterExeForCompletion(kitty)')
print('}')
# }}}
# rc command wrappers {{{
json_field_types: Dict[str, str] = {
'bool': 'bool', 'str': 'escaped_string', 'list.str': '[]escaped_string', 'dict.str': 'map[escaped_string]escaped_string', 'float': 'float64', 'int': 'int',
'scroll_amount': 'any', 'spacing': 'any', 'colors': 'any',
}
def go_field_type(json_field_type: str) -> str:
q = json_field_types.get(json_field_type)
if q:
return q
if json_field_type.startswith('choices.'):
return 'string'
if '.' in json_field_type:
p, r = json_field_type.split('.', 1)
p = {'list': '[]', 'dict': 'map[string]'}[p]
return p + go_field_type(r)
raise TypeError(f'Unknown JSON field type: {json_field_type}')
class JSONField:
def __init__(self, line: str) -> None:
field_def = line.split(':', 1)[0]
self.required = False
self.field, self.field_type = field_def.split('/', 1)
if self.field.endswith('+'):
self.required = True
self.field = self.field[:-1]
self.struct_field_name = self.field[0].upper() + self.field[1:]
def go_declaration(self) -> str:
return self.struct_field_name + ' ' + go_field_type(self.field_type) + f'`json:"{self.field},omitempty"`'
def go_code_for_remote_command(name: str, cmd: RemoteCommand, template: str) -> str:
template = '\n' + template[len('//go:build exclude'):]
NO_RESPONSE_BASE = 'false'
af: List[str] = []
a = af.append
af.extend(cmd.args.as_go_completion_code('ans'))
od: List[str] = []
option_map: Dict[str, GoOption] = {}
for o in rc_command_options(name):
option_map[o.go_var_name] = o
a(o.as_option('ans'))
if o.go_var_name in ('NoResponse', 'ResponseTimeout'):
continue
od.append(o.struct_declaration())
jd: List[str] = []
json_fields = []
field_types: Dict[str, str] = {}
for line in cmd.protocol_spec.splitlines():
line = line.strip()
if ':' not in line:
continue
f = JSONField(line)
json_fields.append(f)
field_types[f.field] = f.field_type
jd.append(f.go_declaration())
jc: List[str] = []
handled_fields: Set[str] = set()
jc.extend(cmd.args.as_go_code(name, field_types, handled_fields))
unhandled = {}
used_options = set()
for field in json_fields:
oq = (cmd.field_to_option_map or {}).get(field.field, field.field)
oq = ''.join(x.capitalize() for x in oq.split('_'))
if oq in option_map:
o = option_map[oq]
used_options.add(oq)
if field.field_type == 'str':
jc.append(f'payload.{field.struct_field_name} = escaped_string(options_{name}.{o.go_var_name})')
elif field.field_type == 'list.str':
jc.append(f'payload.{field.struct_field_name} = escape_list_of_strings(options_{name}.{o.go_var_name})')
elif field.field_type == 'dict.str':
jc.append(f'payload.{field.struct_field_name} = escape_dict_of_strings(options_{name}.{o.go_var_name})')
else:
jc.append(f'payload.{field.struct_field_name} = options_{name}.{o.go_var_name}')
elif field.field in handled_fields:
pass
else:
unhandled[field.field] = field
for x in tuple(unhandled):
if x == 'match_window' and 'Match' in option_map and 'Match' not in used_options:
used_options.add('Match')
o = option_map['Match']
field = unhandled[x]
if field.field_type == 'str':
jc.append(f'payload.{field.struct_field_name} = escaped_string(options_{name}.{o.go_var_name})')
else:
jc.append(f'payload.{field.struct_field_name} = options_{name}.{o.go_var_name}')
del unhandled[x]
if unhandled:
raise SystemExit(f'Cant map fields: {", ".join(unhandled)} for cmd: {name}')
if name != 'send_text':
unused_options = set(option_map) - used_options - {'NoResponse', 'ResponseTimeout'}
if unused_options:
raise SystemExit(f'Unused options: {", ".join(unused_options)} for command: {name}')
argspec = cmd.args.spec
if argspec:
argspec = ' ' + argspec
ans = replace(
template,
CMD_NAME=name, __FILE__=__file__, CLI_NAME=name.replace('_', '-'),
SHORT_DESC=serialize_as_go_string(cmd.short_desc),
LONG_DESC=serialize_as_go_string(cmd.desc.strip()),
IS_ASYNC='true' if cmd.is_asynchronous else 'false',
NO_RESPONSE_BASE=NO_RESPONSE_BASE, ADD_FLAGS_CODE='\n'.join(af),
WAIT_TIMEOUT=str(cmd.response_timeout),
OPTIONS_DECLARATION_CODE='\n'.join(od),
JSON_DECLARATION_CODE='\n'.join(jd),
JSON_INIT_CODE='\n'.join(jc), ARGSPEC=argspec,
STRING_RESPONSE_IS_ERROR='true' if cmd.string_return_is_error else 'false',
STREAM_WANTED='true' if cmd.reads_streaming_data else 'false',
)
return ans
# }}}
# kittens {{{
@lru_cache
def wrapped_kittens() -> Sequence[str]:
with open('shell-integration/ssh/kitty') as f:
for line in f:
if line.startswith(' wrapped_kittens="'):
val = line.strip().partition('"')[2][:-1]
return tuple(sorted(filter(None, val.split())))
raise Exception('Failed to read wrapped kittens from kitty wrapper script')
def generate_conf_parser(kitten: str, defn: Definition) -> None:
with replace_if_needed(f'kittens/{kitten}/conf_generated.go'):
print(f'package {kitten}')
print(gen_go_code(defn))
def generate_extra_cli_parser(name: str, spec: str) -> None:
print('import "kitty/tools/cli"')
go_opts = tuple(go_options_for_seq(parse_option_spec(spec)[0]))
print(f'type {name}_options struct ''{')
for opt in go_opts:
print(opt.struct_declaration())
print('}')
print(f'func parse_{name}_args(args []string) (*{name}_options, []string, error) ''{')
print(f'root := cli.Command{{Name: `{name}` }}')
for opt in go_opts:
print(opt.as_option('root'))
print('cmd, err := root.ParseArgs(args)')
print('if err != nil { return nil, nil, err }')
print(f'var opts {name}_options')
print('err = cmd.GetOptionValues(&opts)')
print('if err != nil { return nil, nil, err }')
print('return &opts, cmd.Args, nil')
print('}')
def kitten_clis() -> None:
from kittens.runner import get_kitten_conf_docs, get_kitten_extra_cli_parsers
for kitten in wrapped_kittens():
defn = get_kitten_conf_docs(kitten)
if defn is not None:
generate_conf_parser(kitten, defn)
ecp = get_kitten_extra_cli_parsers(kitten)
if ecp:
for name, spec in ecp.items():
with replace_if_needed(f'kittens/{kitten}/{name}_cli_generated.go'):
print(f'package {kitten}')
generate_extra_cli_parser(name, spec)
with replace_if_needed(f'kittens/{kitten}/cli_generated.go'):
od = []
kcd = kitten_cli_docs(kitten)
has_underscore = '_' in kitten
print(f'package {kitten}')
print('import "kitty/tools/cli"')
print('func create_cmd(root *cli.Command, run_func func(*cli.Command, *Options, []string)(int, error)) {')
print('ans := root.AddSubCommand(&cli.Command{')
print(f'Name: "{kitten}",')
if kcd:
print(f'ShortDescription: "{serialize_as_go_string(kcd["short_desc"])}",')
if kcd['usage']:
print(f'Usage: "[options] {serialize_as_go_string(kcd["usage"])}",')
print(f'HelpText: "{serialize_as_go_string(kcd["help_text"])}",')
print('Run: func(cmd *cli.Command, args []string) (int, error) {')
print('opts := Options{}')
print('err := cmd.GetOptionValues(&opts)')
print('if err != nil { return 1, err }')
print('return run_func(cmd, &opts, args)},')
if has_underscore:
print('Hidden: true,')
print('})')
gopts, ac = go_options_for_kitten(kitten)
for opt in gopts:
print(opt.as_option('ans'))
od.append(opt.struct_declaration())
if ac is not None:
print(''.join(ac.as_go_code('ans.ArgCompleter', ' = ')))
if has_underscore:
print("clone := root.AddClone(ans.Group, ans)")
print('clone.Hidden = false')
print(f'clone.Name = "{serialize_as_go_string(kitten.replace("_", "-"))}"')
if not kcd:
print('specialize_command(ans)')
print('}')
print('type Options struct {')
print('\n'.join(od))
print('}')
# }}}
# Constants {{{
def generate_spinners() -> str:
ans = ['package tui', 'import "time"', 'func NewSpinner(name string) *Spinner {', 'var ans *Spinner', 'switch name {']
a = ans.append
for name, spinner in spinners.items():
a(f'case "{serialize_as_go_string(name)}":')
a('ans = &Spinner{')
a(f'Name: "{serialize_as_go_string(name)}",')
a(f'interval: {spinner["interval"]},')
frames = ', '.join(f'"{serialize_as_go_string(x)}"' for x in spinner['frames'])
a(f'frames: []string{{{frames}}},')
a('}')
a('}')
a('if ans != nil {')
a('ans.interval *= time.Millisecond')
a('ans.current_frame = -1')
a('ans.last_change_at = time.Now().Add(-ans.interval)')
a('}')
a('return ans}')
return '\n'.join(ans)
def generate_color_names() -> str:
selfg = "" if Options.selection_foreground is None else Options.selection_foreground.as_sharp
selbg = "" if Options.selection_background is None else Options.selection_background.as_sharp
cursor = "" if Options.cursor is None else Options.cursor.as_sharp
return 'package style\n\nvar ColorNames = map[string]RGBA{' + '\n'.join(
f'\t"{name}": RGBA{{ Red:{val.red}, Green:{val.green}, Blue:{val.blue} }},'
for name, val in color_names.items()
) + '\n}' + '\n\nvar ColorTable = [256]uint32{' + ', '.join(
f'{x}' for x in Options.color_table) + '}\n' + f'''
var DefaultColors = struct {{
Foreground, Background, Cursor, SelectionFg, SelectionBg string
}}{{
Foreground: "{Options.foreground.as_sharp}",
Background: "{Options.background.as_sharp}",
Cursor: "{cursor}",
SelectionFg: "{selfg}",
SelectionBg: "{selbg}",
}}
'''
def load_ref_map() -> Dict[str, Dict[str, str]]:
with open('kitty/docs_ref_map_generated.h') as f:
raw = f.read()
raw = raw.split('{', 1)[1].split('}', 1)[0]
data = json.loads(bytes(bytearray(json.loads(f'[{raw}]'))))
return data # type: ignore
def generate_constants() -> str:
from kittens.hints.main import DEFAULT_REGEX
from kitty.options.types import Options
from kitty.options.utils import allowed_shell_integration_values
del sys.modules['kittens.hints.main']
ref_map = load_ref_map()
with open('kitty/data-types.h') as dt:
m = re.search(r'^#define IMAGE_PLACEHOLDER_CHAR (\S+)', dt.read(), flags=re.M)
assert m is not None
placeholder_char = int(m.group(1), 16)
dp = ", ".join(map(lambda x: f'"{serialize_as_go_string(x)}"', kc.default_pager_for_help))
url_prefixes = ','.join(f'"{x}"' for x in Options.url_prefixes)
return f'''\
package kitty
type VersionType struct {{
Major, Minor, Patch int
}}
const VersionString string = "{kc.str_version}"
const WebsiteBaseURL string = "{kc.website_base_url}"
const ImagePlaceholderChar rune = {placeholder_char}
const VCSRevision string = ""
const SSHControlMasterTemplate = "{kc.ssh_control_master_template}"
const RC_ENCRYPTION_PROTOCOL_VERSION string = "{kc.RC_ENCRYPTION_PROTOCOL_VERSION}"
const IsFrozenBuild bool = false
const IsStandaloneBuild bool = false
const HandleTermiosSignals = {Mode.HANDLE_TERMIOS_SIGNALS.value[0]}
const HintsDefaultRegex = `{DEFAULT_REGEX}`
var Version VersionType = VersionType{{Major: {kc.version.major}, Minor: {kc.version.minor}, Patch: {kc.version.patch},}}
var DefaultPager []string = []string{{ {dp} }}
var FunctionalKeyNameAliases = map[string]string{serialize_go_dict(functional_key_name_aliases)}
var CharacterKeyNameAliases = map[string]string{serialize_go_dict(character_key_name_aliases)}
var ConfigModMap = map[string]uint16{serialize_go_dict(config_mod_map)}
var RefMap = map[string]string{serialize_go_dict(ref_map['ref'])}
var DocTitleMap = map[string]string{serialize_go_dict(ref_map['doc'])}
var AllowedShellIntegrationValues = []string{{ {str(sorted(allowed_shell_integration_values))[1:-1].replace("'", '"')} }}
var KittyConfigDefaults = struct {{
Term, Shell_integration, Select_by_word_characters string
Wheel_scroll_multiplier int
Url_prefixes []string
}}{{
Term: "{Options.term}", Shell_integration: "{' '.join(Options.shell_integration)}", Url_prefixes: []string{{ {url_prefixes} }},
Select_by_word_characters: `{Options.select_by_word_characters}`, Wheel_scroll_multiplier: {Options.wheel_scroll_multiplier},
}}
''' # }}}
# Boilerplate {{{
@contextmanager
def replace_if_needed(path: str, show_diff: bool = False) -> Iterator[io.StringIO]:
buf = io.StringIO()
origb = sys.stdout
sys.stdout = buf
try:
yield buf
finally:
sys.stdout = origb
orig = ''
with suppress(FileNotFoundError), open(path, 'r') as f:
orig = f.read()
new = buf.getvalue()
new = f'// Code generated by {os.path.basename(__file__)}; DO NOT EDIT.\n\n' + new
if orig != new:
changed.append(path)
if show_diff:
with open(path + '.new', 'w') as f:
f.write(new)
subprocess.run(['diff', '-Naurp', path, f.name], stdout=open('/dev/tty', 'w'))
os.remove(f.name)
with open(path, 'w') as f:
f.write(new)
@lru_cache(maxsize=256)
def rc_command_options(name: str) -> Tuple[GoOption, ...]:
cmd = command_for_name(name)
return tuple(go_options_for_seq(parse_option_spec(cmd.options_spec or '\n\n')[0]))
def update_at_commands() -> None:
with open('tools/cmd/at/template.go') as f:
template = f.read()
for name in all_command_names():
cmd = command_for_name(name)
code = go_code_for_remote_command(name, cmd, template)
dest = f'tools/cmd/at/cmd_{name}_generated.go'
with replace_if_needed(dest) as f:
f.write(code)
struct_def = []
opt_def = []
for o in go_options_for_seq(parse_option_spec(global_options_spec())[0]):
struct_def.append(o.struct_declaration())
opt_def.append(o.as_option(depth=1, group="Global options"))
sdef = '\n'.join(struct_def)
odef = '\n'.join(opt_def)
code = f'''
package at
import "kitty/tools/cli"
type rc_global_options struct {{
{sdef}
}}
var rc_global_opts rc_global_options
func add_rc_global_opts(cmd *cli.Command) {{
{odef}
}}
'''
with replace_if_needed('tools/cmd/at/global_opts_generated.go') as f:
f.write(code)
def update_completion() -> None:
with replace_if_needed('tools/cmd/completion/kitty_generated.go'):
generate_completions_for_kitty()
with replace_if_needed('tools/cmd/edit_in_kitty/launch_generated.go'):
print('package edit_in_kitty')
print('import "kitty/tools/cli"')
print('func AddCloneSafeOpts(cmd *cli.Command) {')
completion_for_launch_wrappers('cmd')
print(''.join(CompletionSpec.from_string('type:file mime:text/* group:"Text files"').as_go_code('cmd.ArgCompleter', ' = ')))
print('}')
def define_enum(package_name: str, type_name: str, items: str, underlying_type: str = 'uint') -> str:
actions = []
for x in items.splitlines():
x = x.strip()
if x:
actions.append(x)
ans = [f'package {package_name}', 'import "strconv"', f'type {type_name} {underlying_type}', 'const (']
stringer = [f'func (ac {type_name}) String() string ''{', 'switch(ac) {']
for i, ac in enumerate(actions):
stringer.append(f'case {ac}: return "{ac}"')
if i == 0:
ac = ac + f' {type_name} = iota'
ans.append(ac)
ans.append(')')
stringer.append('}\nreturn strconv.Itoa(int(ac)) }')
return '\n'.join(ans + stringer)
def generate_readline_actions() -> str:
return define_enum('readline', 'Action', '''\
ActionNil
ActionBackspace
ActionDelete
ActionMoveToStartOfLine
ActionMoveToEndOfLine
ActionMoveToStartOfDocument
ActionMoveToEndOfDocument
ActionMoveToEndOfWord
ActionMoveToStartOfWord
ActionCursorLeft
ActionCursorRight
ActionEndInput
ActionAcceptInput
ActionCursorUp
ActionHistoryPreviousOrCursorUp
ActionCursorDown
ActionHistoryNextOrCursorDown
ActionHistoryNext
ActionHistoryPrevious
ActionHistoryFirst
ActionHistoryLast
ActionHistoryIncrementalSearchBackwards
ActionHistoryIncrementalSearchForwards
ActionTerminateHistorySearchAndApply
ActionTerminateHistorySearchAndRestore
ActionClearScreen
ActionAddText
ActionAbortCurrentLine
ActionStartKillActions
ActionKillToEndOfLine
ActionKillToStartOfLine
ActionKillNextWord
ActionKillPreviousWord
ActionKillPreviousSpaceDelimitedWord
ActionEndKillActions
ActionYank
ActionPopYank
ActionNumericArgumentDigit0
ActionNumericArgumentDigit1
ActionNumericArgumentDigit2
ActionNumericArgumentDigit3
ActionNumericArgumentDigit4
ActionNumericArgumentDigit5
ActionNumericArgumentDigit6
ActionNumericArgumentDigit7
ActionNumericArgumentDigit8
ActionNumericArgumentDigit9
ActionNumericArgumentDigitMinus
ActionCompleteForward
ActionCompleteBackward
''')
def generate_mimetypes() -> str:
import mimetypes
if not mimetypes.inited:
mimetypes.init()
ans = ['package utils', 'import "sync"', 'var only_once sync.Once', 'var builtin_types_map map[string]string',
'func set_builtins() {', 'builtin_types_map = map[string]string{',]
for k, v in mimetypes.types_map.items():
ans.append(f' "{serialize_as_go_string(k)}": "{serialize_as_go_string(v)}",')
ans.append('}}')
return '\n'.join(ans)
def generate_textual_mimetypes() -> str:
ans = ['package utils', 'var KnownTextualMimes = map[string]bool{',]
for k in text_mimes:
ans.append(f' "{serialize_as_go_string(k)}": true,')
ans.append('}')
ans.append('var KnownExtensions = map[string]string{')
for k, v in known_extensions.items():
ans.append(f' ".{serialize_as_go_string(k)}": "{serialize_as_go_string(v)}",')
ans.append('}')
return '\n'.join(ans)
def write_compressed_data(data: bytes, d: BinaryIO) -> None:
d.write(struct.pack('<I', len(data)))
d.write(bz2.compress(data))
def generate_unicode_names(src: TextIO, dest: BinaryIO) -> None:
num_names, num_of_words = map(int, next(src).split())
gob = io.BytesIO()
gob.write(struct.pack('<II', num_names, num_of_words))
for line in src:
line = line.strip()
if line:
a, aliases = line.partition('\t')[::2]
cp, name = a.partition(' ')[::2]
ename = name.encode()
record = struct.pack('<IH', int(cp), len(ename)) + ename
if aliases:
record += aliases.encode()
gob.write(struct.pack('<H', len(record)) + record)
write_compressed_data(gob.getvalue(), dest)
def generate_ssh_kitten_data() -> None:
files = {
'terminfo/kitty.terminfo', 'terminfo/x/xterm-kitty',
}
for dirpath, dirnames, filenames in os.walk('shell-integration'):
for f in filenames:
path = os.path.join(dirpath, f)
files.add(path.replace(os.sep, '/'))
dest = 'kittens/ssh/data_generated.bin'
def normalize(t: tarfile.TarInfo) -> tarfile.TarInfo:
t.uid = t.gid = 0
t.uname = t.gname = ''
return t
if newer(dest, *files):
buf = io.BytesIO()
with tarfile.open(fileobj=buf, mode='w') as tf:
for f in sorted(files):
tf.add(f, filter=normalize)
with open(dest, 'wb') as d:
write_compressed_data(buf.getvalue(), d)
def main() -> None:
with replace_if_needed('constants_generated.go') as f:
f.write(generate_constants())
with replace_if_needed('tools/utils/style/color-names_generated.go') as f:
f.write(generate_color_names())
with replace_if_needed('tools/tui/readline/actions_generated.go') as f:
f.write(generate_readline_actions())
with replace_if_needed('tools/tui/spinners_generated.go') as f:
f.write(generate_spinners())
with replace_if_needed('tools/utils/mimetypes_generated.go') as f:
f.write(generate_mimetypes())
with replace_if_needed('tools/utils/mimetypes_textual_generated.go') as f:
f.write(generate_textual_mimetypes())
if newer('tools/unicode_names/data_generated.bin', 'tools/unicode_names/names.txt'):
with open('tools/unicode_names/data_generated.bin', 'wb') as dest, open('tools/unicode_names/names.txt') as src:
generate_unicode_names(src, dest)
generate_ssh_kitten_data()
update_completion()
update_at_commands()
kitten_clis()
print(json.dumps(changed, indent=2))
if __name__ == '__main__':
main() # }}}

View File

@@ -2,8 +2,8 @@
# License: GPLv3 Copyright: 2021, Kovid Goyal <kovid at kovidgoyal.net>
import string
from typing import Dict, List, Any
from pprint import pformat
from typing import Any, Dict, List, Union
functional_key_defs = '''# {{{
# kitty XKB macVK macU
@@ -130,7 +130,7 @@ functional_encoding_overrides = {
}
different_trailer_functionals = {
'up': 'A', 'down': 'B', 'right': 'C', 'left': 'D', 'kp_begin': 'E', 'end': 'F', 'home': 'H',
'f1': 'P', 'f2': 'Q', 'f3': 'R', 'f4': 'S', 'enter': 'u', 'tab': 'u',
'f1': 'P', 'f2': 'Q', 'f3': '~', 'f4': 'S', 'enter': 'u', 'tab': 'u',
'backspace': 'u', 'escape': 'u'
}
@@ -248,6 +248,19 @@ def serialize_dict(x: Dict[Any, Any]) -> str:
return pformat(x, indent=4).replace('{', '{\n ', 1)
def serialize_go_dict(x: Union[Dict[str, int], Dict[int, str], Dict[int, int]]) -> str:
ans = []
def s(x: Union[int, str]) -> str:
if isinstance(x, int):
return str(x)
return f'"{x}"'
for k, v in x.items():
ans.append(f'{s(k)}: {s(v)}')
return '{' + ', '.join(ans) + '}'
def generate_glfw_header() -> None:
lines = [
'typedef enum {',
@@ -309,14 +322,20 @@ def generate_functional_table() -> None:
patch_file('kitty/key_encoding.c', 'special numbers', '\n'.join(enc_lines))
code_to_name = {v: k.upper() for k, v in name_to_code.items()}
csi_map = {v: name_to_code[k] for k, v in functional_encoding_overrides.items()}
letter_trailer_codes = {
v: functional_encoding_overrides.get(k, name_to_code.get(k))
letter_trailer_codes: Dict[str, int] = {
v: functional_encoding_overrides.get(k, name_to_code.get(k, 0))
for k, v in different_trailer_functionals.items() if v in 'ABCDEHFPQRSZ'}
text = f'functional_key_number_to_name_map = {serialize_dict(code_to_name)}'
text += f'\ncsi_number_to_functional_number_map = {serialize_dict(csi_map)}'
text += f'\nletter_trailer_to_csi_number_map = {letter_trailer_codes!r}'
text += f'\ntilde_trailers = {tilde_trailers!r}'
patch_file('kitty/key_encoding.py', 'csi mapping', text, start_marker='# ', end_marker='')
text = f'var functional_key_number_to_name_map = map[int]string{serialize_go_dict(code_to_name)}\n'
text += f'\nvar csi_number_to_functional_number_map = map[int]int{serialize_go_dict(csi_map)}\n'
text += f'\nvar letter_trailer_to_csi_number_map = map[string]int{serialize_go_dict(letter_trailer_codes)}\n'
tt = ', '.join(f'{x}: true' for x in tilde_trailers)
text += '\nvar tilde_trailers = map[int]bool{' + f'{tt}' + '}\n'
patch_file('tools/tui/loop/key-encoding.go', 'csi mapping', text, start_marker='// ', end_marker='')
def generate_legacy_text_key_maps() -> None:

48
gen-srgb-lut.py Executable file
View File

@@ -0,0 +1,48 @@
#!/usr/bin/env python3
# vim:fileencoding=utf-8
import os
from typing import List
def to_linear(a: float) -> float:
if a <= 0.04045:
return a / 12.92
else:
return float(pow((a + 0.055) / 1.055, 2.4))
def generate_srgb_lut(line_prefix: str = '') -> List[str]:
values: List[str] = []
lines: List[str] = []
for i in range(256):
values.append('{:1.5f}f'.format(to_linear(i / 255.0)))
for i in range(16):
lines.append(line_prefix + ', '.join(values[i * 16:(i + 1) * 16]) + ',')
return lines
def generate_srgb_gamma_c() -> str:
lines: List[str] = []
lines.append('// Generated by gen-srgb-lut.py DO NOT edit')
lines.append('#include "srgb_gamma.h"')
lines.append('')
lines.append('const GLfloat srgb_lut[256] = {')
lines += generate_srgb_lut(' ')
lines.append('};')
return "\n".join(lines)
def main() -> None:
c = generate_srgb_gamma_c()
with open(os.path.join('kitty', 'srgb_gamma.c'), 'w') as f:
f.write(f'{c}\n')
if __name__ == '__main__':
main()

View File

@@ -3,17 +3,26 @@
import os
import re
import subprocess
import sys
from collections import defaultdict
from contextlib import contextmanager
from datetime import date
from functools import partial
from functools import lru_cache, partial
from html.entities import html5
from itertools import groupby
from operator import itemgetter
from typing import (
Callable, DefaultDict, Dict, FrozenSet, Generator, Iterable, List,
Optional, Set, Tuple, Union
Callable,
DefaultDict,
Dict,
FrozenSet,
Generator,
Iterable,
List,
Optional,
Set,
Tuple,
Union,
)
from urllib.request import urlopen
@@ -44,6 +53,15 @@ def get_data(fname: str, folder: str = 'UCD') -> Iterable[str]:
yield line
@lru_cache(maxsize=2)
def unicode_version() -> Tuple[int, int, int]:
for line in get_data("ReadMe.txt"):
m = re.search(r'Version\s+(\d+)\.(\d+)\.(\d+)', line)
if m is not None:
return int(m.group(1)), int(m.group(2)), int(m.group(3))
raise ValueError('Could not find Unicode Version')
# Map of class names to set of codepoints in class
class_maps: Dict[str, Set[int]] = {}
all_symbols: Set[int] = set()
@@ -254,9 +272,13 @@ def get_ranges(items: List[int]) -> Generator[Union[int, Tuple[int, int]], None,
yield a, b
def write_case(spec: Union[Tuple[int, ...], int], p: Callable[..., None]) -> None:
def write_case(spec: Union[Tuple[int, ...], int], p: Callable[..., None], for_go: bool = False) -> None:
if isinstance(spec, tuple):
p('\t\tcase 0x{:x} ... 0x{:x}:'.format(*spec))
if for_go:
v = ', '.join(f'0x{x:x}' for x in range(spec[0], spec[1] + 1))
p(f'\t\tcase {v}:')
else:
p('\t\tcase 0x{:x} ... 0x{:x}:'.format(*spec))
else:
p(f'\t\tcase 0x{spec:x}:')
@@ -265,8 +287,8 @@ def write_case(spec: Union[Tuple[int, ...], int], p: Callable[..., None]) -> Non
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())
p('// see gen-wcwidth.py')
p('// Unicode data, built from the Unicode Standard', '.'.join(map(str, unicode_version())))
p(f'// Code generated by {os.path.basename(__file__)}, DO NOT EDIT.', end='\n\n')
if path.endswith('.h'):
p('#pragma once')
if include_data_types:
@@ -347,19 +369,25 @@ def codepoint_to_mark_map(p: Callable[..., None], mark_map: List[int]) -> Dict[i
return rmap
def classes_to_regex(classes: Iterable[str], exclude: str = '') -> Iterable[str]:
def classes_to_regex(classes: Iterable[str], exclude: str = '', for_go: bool = True) -> Iterable[str]:
chars: Set[int] = set()
for c in classes:
chars |= class_maps[c]
for x in map(ord, exclude):
chars.discard(x)
def as_string(codepoint: int) -> str:
if codepoint < 256:
return fr'\x{codepoint:02x}'
if codepoint <= 0xffff:
return fr'\u{codepoint:04x}'
return fr'\U{codepoint:08x}'
if for_go:
def as_string(codepoint: int) -> str:
if codepoint < 256:
return fr'\x{codepoint:02x}'
return fr'\x{{{codepoint:x}}}'
else:
def as_string(codepoint: int) -> str:
if codepoint < 256:
return fr'\x{codepoint:02x}'
if codepoint <= 0xffff:
return fr'\u{codepoint:04x}'
return fr'\U{codepoint:08x}'
for spec in get_ranges(list(chars)):
if isinstance(spec, tuple):
@@ -416,153 +444,144 @@ def gen_ucd() -> None:
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'))))
chars = ''.join(classes_to_regex(cz, exclude='\n\r'))
with open('tools/cmd/hints/url_regex.go', 'w') as f:
f.write('// generated by gen-wcwidth.py, do not edit\n\n')
f.write('package hints\n\n')
f.write(f'const URL_DELIMITERS = `{chars}`\n')
def gen_names() -> None:
with create_header('kittens/unicode_input/names.h') as p:
mark_to_cp = list(sorted(name_map))
cp_to_mark = {cp: m for m, cp in enumerate(mark_to_cp)}
# Mapping of mark to codepoint name
p(f'static const char* name_map[{len(mark_to_cp)}] = {{' ' // {{{')
for cp in mark_to_cp:
w = name_map[cp].replace('"', '\\"')
p(f'\t"{w}",')
p("}; // }}}\n")
# Mapping of mark to codepoint
p(f'static const char_type mark_to_cp[{len(mark_to_cp)}] = {{' ' // {{{')
p(', '.join(map(str, mark_to_cp)))
p('}; // }}}\n')
# Function to get mark number for codepoint
p('static char_type mark_for_codepoint(char_type c) {')
codepoint_to_mark_map(p, mark_to_cp)
p('}\n')
p('static inline const char* name_for_codepoint(char_type cp) {')
p('\tchar_type m = mark_for_codepoint(cp); if (m == 0) return NULL;')
p('\treturn name_map[m];')
p('}\n')
# Array of all words
word_map = tuple(sorted(word_search_map))
word_rmap = {w: i for i, w in enumerate(word_map)}
p(f'static const char* all_words_map[{len(word_map)}] = {{' ' // {{{')
cwords = (w.replace('"', '\\"') for w in word_map)
p(', '.join(f'"{w}"' for w in cwords))
p('}; // }}}\n')
# Array of sets of marks for each word
word_to_marks = {word_rmap[w]: frozenset(map(cp_to_mark.__getitem__, cps)) for w, cps in word_search_map.items()}
all_mark_groups = frozenset(word_to_marks.values())
array = [0]
mg_to_offset = {}
for mg in all_mark_groups:
mg_to_offset[mg] = len(array)
array.append(len(mg))
array.extend(sorted(mg))
p(f'static const char_type mark_groups[{len(array)}] = {{' ' // {{{')
p(', '.join(map(str, array)))
p('}; // }}}\n')
offsets_array = []
for wi, w in enumerate(word_map):
mg = word_to_marks[wi]
offsets_array.append(mg_to_offset[mg])
p(f'static const char_type mark_to_offset[{len(offsets_array)}] = {{' ' // {{{')
p(', '.join(map(str, offsets_array)))
p('}; // }}}\n')
# The trie
p('typedef struct { uint32_t children_offset; uint32_t match_offset; } word_trie;\n')
all_trie_nodes: List['TrieNode'] = [] # noqa
class TrieNode:
def __init__(self) -> None:
self.match_offset = 0
self.children_offset = 0
self.children: Dict[int, int] = {}
def add_letter(self, letter: int) -> int:
if letter not in self.children:
self.children[letter] = len(all_trie_nodes)
all_trie_nodes.append(TrieNode())
return self.children[letter]
def __str__(self) -> str:
return f'{{ .children_offset={self.children_offset}, .match_offset={self.match_offset} }}'
root = TrieNode()
all_trie_nodes.append(root)
def add_word(word_idx: int, word: str) -> None:
parent = root
for letter in map(ord, word):
idx = parent.add_letter(letter)
parent = all_trie_nodes[idx]
parent.match_offset = offsets_array[word_idx]
for i, word in enumerate(word_map):
add_word(i, word)
children_array = [0]
for node in all_trie_nodes:
if node.children:
node.children_offset = len(children_array)
children_array.append(len(node.children))
for letter, child_offset in node.children.items():
children_array.append((child_offset << 8) | (letter & 0xff))
p(f'static const word_trie all_trie_nodes[{len(all_trie_nodes)}] = {{' ' // {{{')
p(',\n'.join(map(str, all_trie_nodes)))
p('\n}; // }}}\n')
p(f'static const uint32_t children_array[{len(children_array)}] = {{' ' // {{{')
p(', '.join(map(str, children_array)))
p('}; // }}}\n')
aliases_map: Dict[int, Set[str]] = {}
for word, codepoints in word_search_map.items():
for cp in codepoints:
aliases_map.setdefault(cp, set()).add(word)
if len(name_map) > 0xffff:
raise Exception('Too many named codepoints')
with open('tools/unicode_names/names.txt', 'w') as f:
print(len(name_map), len(word_search_map), file=f)
for cp in sorted(name_map):
name = name_map[cp]
words = name.lower().split()
aliases = aliases_map.get(cp, set()) - set(words)
end = '\n'
if aliases:
end = '\t' + ' '.join(sorted(aliases)) + end
print(cp, *words, end=end, file=f)
def gen_wcwidth() -> None:
seen: Set[int] = set()
non_printing = class_maps['Cc'] | class_maps['Cf'] | class_maps['Cs']
def add(p: Callable[..., None], 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, for_go: bool = False) -> None:
chars = chars_ - seen
seen.update(chars)
p(f'\t\t// {comment} ({len(chars)} codepoints)' + ' {{' '{')
for spec in get_ranges(list(chars)):
write_case(spec, p)
write_case(spec, p, for_go)
p(f'\t\t\treturn {ret};')
p('\t\t// }}}\n')
with create_header('kitty/wcwidth-std.h') as p:
p('static inline int\nwcwidth_std(int32_t code) {')
p('\tif (LIKELY(0x20 <= code && code <= 0x7e)) return 1;')
p('\tswitch(code) {')
def add_all(p: Callable[..., None], for_go: bool = False) -> None:
seen.clear()
add(p, 'Flags', flag_codepoints, 2, for_go)
add(p, 'Marks', marks | {0}, 0, for_go)
add(p, 'Non-printing characters', non_printing, -1, for_go)
add(p, 'Private use', class_maps['Co'], -3, for_go)
add(p, 'Text Presentation', narrow_emoji, 1, for_go)
add(p, 'East Asian ambiguous width', ambiguous, -2, for_go)
add(p, 'East Asian double width', doublewidth, 2, for_go)
add(p, 'Emoji Presentation', wide_emoji, 2, for_go)
non_printing = class_maps['Cc'] | class_maps['Cf'] | class_maps['Cs']
add(p, 'Flags', flag_codepoints, 2)
add(p, 'Marks', marks | {0}, 0)
add(p, 'Non-printing characters', non_printing, -1)
add(p, 'Private use', class_maps['Co'], -3)
add(p, 'Text Presentation', narrow_emoji, 1)
add(p, 'East Asian ambiguous width', ambiguous, -2)
add(p, 'East Asian double width', doublewidth, 2)
add(p, 'Emoji Presentation', wide_emoji, 2)
add(p, 'Not assigned in the unicode character database', not_assigned, -4, for_go)
add(p, 'Not assigned in the unicode character database', not_assigned, -4)
p('\t\tdefault: return 1;')
p('\t\tdefault:\n\t\t\treturn 1;')
p('\t}')
p('\treturn 1;\n}')
if for_go:
p('\t}')
else:
p('\treturn 1;\n}')
with create_header('kitty/wcwidth-std.h') as p, open('tools/wcswidth/std.go', 'w') as gof:
gop = partial(print, file=gof)
gop('package wcswidth\n\n')
gop('func Runewidth(code rune) int {')
p('static inline int\nwcwidth_std(int32_t code) {')
p('\tif (LIKELY(0x20 <= code && code <= 0x7e)) { return 1; }')
p('\tswitch(code) {')
gop('\tswitch(code) {')
add_all(p)
add_all(gop, True)
p('static inline bool\nis_emoji_presentation_base(uint32_t code) {')
gop('func IsEmojiPresentationBase(code rune) bool {')
p('\tswitch(code) {')
gop('\tswitch(code) {')
for spec in get_ranges(list(emoji_presentation_bases)):
write_case(spec, p)
write_case(spec, gop, for_go=True)
p('\t\t\treturn true;')
gop('\t\t\treturn true;')
p('\t\tdefault: return false;')
p('\t}')
p('\treturn 1;\n}')
gop('\t\tdefault:\n\t\t\treturn false')
gop('\t}')
p('\treturn true;\n}')
gop('\n}')
uv = unicode_version()
p(f'#define UNICODE_MAJOR_VERSION {uv[0]}')
p(f'#define UNICODE_MINOR_VERSION {uv[1]}')
p(f'#define UNICODE_PATCH_VERSION {uv[2]}')
gop('var UnicodeDatabaseVersion [3]int = [3]int{' f'{uv[0]}, {uv[1]}, {uv[2]}' + '}')
subprocess.check_call(['gofmt', '-w', '-s', gof.name])
def gen_rowcolumn_diacritics() -> None:
# codes of all row/column diacritics
codes = []
with open("./rowcolumn-diacritics.txt") as file:
for line in file.readlines():
if line.startswith('#'):
continue
code = int(line.split(";")[0], 16)
codes.append(code)
go_file = 'tools/utils/images/rowcolumn_diacritics.go'
with create_header('kitty/rowcolumn-diacritics.c') as p, create_header(go_file, include_data_types=False) as g:
p('#include "unicode-data.h"')
p('int diacritic_to_num(char_type code) {')
p('\tswitch (code) {')
g('package images')
g(f'var NumberToDiacritic = [{len(codes)}]rune''{')
g(', '.join(f'0x{x:x}' for x in codes) + ',')
g('}')
range_start_num = 1
range_start = 0
range_end = 0
def print_range() -> None:
if range_start >= range_end:
return
write_case((range_start, range_end), p)
p('\t\treturn code - ' + hex(range_start) + ' + ' +
str(range_start_num) + ';')
for code in codes:
if range_end == code:
range_end += 1
else:
print_range()
range_start_num += range_end - range_start
range_start = code
range_end = code + 1
print_range()
p('\t}')
p('\treturn 0;')
p('}')
subprocess.check_call(['gofmt', '-w', '-s', go_file])
parse_ucd()
@@ -573,3 +592,4 @@ gen_ucd()
gen_wcwidth()
gen_emoji()
gen_names()
gen_rowcolumn_diacritics()

View File

@@ -8,10 +8,9 @@ import shlex
import shutil
import subprocess
cmdline = (
'glad --out-path {dest} --api gl:core=3.3 '
' --extensions GL_ARB_texture_storage,GL_ARB_copy_image,GL_ARB_multisample,GL_ARB_robustness,GL_KHR_debug '
'glad --out-path {dest} --api gl:core=3.1 '
' --extensions GL_ARB_texture_storage,GL_ARB_copy_image,GL_ARB_multisample,GL_ARB_robustness,GL_ARB_instanced_arrays,GL_KHR_debug '
'c --header-only --debug'
)

View File

@@ -358,32 +358,49 @@ static GLFWapplicationwillfinishlaunchingfun finish_launching_callback = NULL;
finish_launching_callback();
}
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename {
(void)theApplication;
if (!filename || !_glfw.ns.file_open_callback) return NO;
const char *path = NULL;
- (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename {
(void)sender;
if (!filename || !_glfw.ns.url_open_callback) return NO;
const char *url = NULL;
@try {
path = [[NSFileManager defaultManager] fileSystemRepresentationWithPath: filename];
url = [[[NSURL fileURLWithPath:filename] absoluteString] UTF8String];
} @catch(NSException *exc) {
NSLog(@"Converting openFile filename: %@ failed with error: %@", filename, exc.reason);
return NO;
}
if (!path) return NO;
return _glfw.ns.file_open_callback(path);
if (!url) return NO;
return _glfw.ns.url_open_callback(url);
}
- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames {
(void)sender;
if (!_glfw.ns.file_open_callback || !filenames) return;
if (!_glfw.ns.url_open_callback || !filenames) return;
for (id x in filenames) {
NSString *filename = x;
const char *path = NULL;
const char *url = NULL;
@try {
path = [[NSFileManager defaultManager] fileSystemRepresentationWithPath: filename];
url = [[[NSURL fileURLWithPath:filename] absoluteString] UTF8String];
} @catch(NSException *exc) {
NSLog(@"Converting openFiles filename: %@ failed with error: %@", filename, exc.reason);
}
if (path) _glfw.ns.file_open_callback(path);
if (url) _glfw.ns.url_open_callback(url);
}
}
// Remove openFile and openFiles when the minimum supported macOS version is 10.13
- (void)application:(NSApplication *)sender openURLs:(NSArray<NSURL *> *)urls
{
(void)sender;
if (!_glfw.ns.url_open_callback || !urls) return;
for (id x in urls) {
NSURL *ns_url = x;
const char *url = NULL;
@try {
url = [[ns_url absoluteString] UTF8String];
} @catch(NSException *exc) {
NSLog(@"Converting openURLs url: %@ failed with error: %@", ns_url, exc.reason);
}
if (url) _glfw.ns.url_open_callback(url);
}
}
@@ -391,7 +408,6 @@ static GLFWapplicationwillfinishlaunchingfun finish_launching_callback = NULL;
{
(void)notification;
[NSApp stop:nil];
if (_glfw.ns.file_open_callback) _glfw.ns.file_open_callback(":cocoa::application launched::");
CGDisplayRegisterReconfigurationCallback(display_reconfigured, NULL);
_glfwCocoaPostEmptyEvent();
@@ -563,7 +579,10 @@ is_shiftable_shortcut(int scv) {
static void
build_global_shortcuts_lookup(void) {
// dump these in a terminal with: defaults read com.apple.symbolichotkeys
NSMutableDictionary<NSString*, NSNumber*> *temp = [NSMutableDictionary dictionaryWithCapacity:128]; // will be autoreleased
NSMutableSet<NSNumber*> *temp_configured = [NSMutableSet setWithCapacity:128]; // will be autoreleased
NSMutableSet<NSNumber*> *temp_missing_value = [NSMutableSet setWithCapacity:128]; // will be autoreleased
NSDictionary *apple_settings = [[NSUserDefaults standardUserDefaults] persistentDomainForName:@"com.apple.symbolichotkeys"];
if (apple_settings) {
NSDictionary<NSString*, id> *symbolic_hotkeys = [apple_settings objectForKey:@"AppleSymbolicHotKeys"];
@@ -574,9 +593,14 @@ build_global_shortcuts_lookup(void) {
NSInteger sc = [key integerValue];
NSDictionary *sc_value = obj;
id enabled = [sc_value objectForKey:@"enabled"];
if (!enabled || ![enabled isKindOfClass:[NSNumber class]] || ![(NSNumber*)enabled boolValue]) continue;
if (!enabled || ![enabled isKindOfClass:[NSNumber class]]) continue;
[temp_configured addObject:@(sc)];
if (![enabled boolValue]) continue;
id v = [sc_value objectForKey:@"value"];
if (!v || ![v isKindOfClass:[NSDictionary class]]) continue;
if (!v || ![v isKindOfClass:[NSDictionary class]]) {
if ([enabled boolValue]) [temp_missing_value addObject:@(sc)];
continue;
}
NSDictionary *value = v;
id t = [value objectForKey:@"type"];
if (!t || ![t isKindOfClass:[NSString class]] || ![t isEqualToString:@"standard"]) continue;
@@ -601,6 +625,39 @@ build_global_shortcuts_lookup(void) {
}
}
}
// Add global shortcut definitions when the default enabled shortcut is not defined,
// or when the default enabled shortcut is not disabled and is missing a value.
// Here are the shortcuts that are enabled by default in the standard ANSI (US) layout.
// macOS provides separate configurations for some languages or keyboards.
// In general, the rules here will not take effect.
static char buf[64];
#define S(i, t, m, k) if ([temp_configured member:@(i)] == nil || [temp_missing_value member:@(i)] != nil) { \
snprintf(buf, sizeof(buf) - 1, #t":%lx:%ld", (unsigned long)m, (long)k); \
temp[@(buf)] = @(i); \
}
// launchpad & dock
S(kSHKTurnDockHidingOnOrOff, c, (NSEventModifierFlagOption | NSEventModifierFlagCommand), 'd'); // Opt, Cmd, D
// mission control
S(kSHKMissionControl, v, NSEventModifierFlagControl, 126); // Ctrl, Arrow Up
S(kSHKApplicationWindows, v, NSEventModifierFlagControl, 125); // Ctrl, Arrow Down
// keyboard
S(kSHKMoveFocusToTheMenuBar, v, NSEventModifierFlagControl, 120); // Ctrl, F2
S(kSHKMoveFocusToTheDock, v, NSEventModifierFlagControl, 99); // Ctrl, F3
S(kSHKMoveFocusToActiveOrNextWindow, v, NSEventModifierFlagControl, 118); // Ctrl, F4
S(kSHKMoveFocusToActiveOrNextWindow, v, (NSEventModifierFlagShift | NSEventModifierFlagControl), 118); // Shift, Ctrl, F4
S(kSHKMoveFocusToNextWindow, c, NSEventModifierFlagCommand, 96); // Cmd, `
S(kSHKMoveFocusToNextWindow, c, (NSEventModifierFlagShift | NSEventModifierFlagCommand), 96); // Shift, Cmd, `
S(kSHKMoveFocusToStatusMenus, v, NSEventModifierFlagControl, 100); // Ctrl, F8
// input sources
S(kSHKSelectThePreviousInputSource, c, NSEventModifierFlagControl, 32); // Ctrl, Space bar
S(kSHKSelectNextSourceInInputMenu, c, (NSEventModifierFlagControl | NSEventModifierFlagOption), 32); // Ctrl, Opt, Space bar
// spotlight
S(kSHKShowSpotlightSearch, c, NSEventModifierFlagCommand, 32); // Cmd, Space bar
S(kSHKShowFinderSearchWindow, c, (NSEventModifierFlagOption | NSEventModifierFlagCommand), 32); // Opt, Cmd, Space bar
#undef S
global_shortcuts = [[NSDictionary dictionaryWithDictionary:temp] retain];
/* NSLog(@"global_shortcuts: %@", global_shortcuts); */
}
@@ -610,11 +667,10 @@ is_active_apple_global_shortcut(NSEvent *event) {
if (global_shortcuts == nil) build_global_shortcuts_lookup();
NSEventModifierFlags modifierFlags = USEFUL_MODS([event modifierFlags]);
static char lookup_key[64];
#define LOOKUP(t, k) \
snprintf(lookup_key, sizeof(lookup_key) - 1, #t":%lx:%ld", (unsigned long)modifierFlags, (long)k); \
NSNumber *sc = global_shortcuts[@(lookup_key)]; \
if (sc != nil) return [sc intValue];
if (sc != nil) return [sc intValue]; \
if ([event.charactersIgnoringModifiers length] == 1) {
if (modifierFlags & NSEventModifierFlagShift) {
@@ -714,6 +770,11 @@ is_useful_apple_global_shortcut(int sc) {
}
}
static bool
is_apple_jis_layout_function_key(NSEvent *event) {
return [event keyCode] == 0x66 /* kVK_JIS_Eisu */ || [event keyCode] == 0x68 /* kVK_JIS_Kana */;
}
GLFWAPI GLFWapplicationshouldhandlereopenfun glfwSetApplicationShouldHandleReopen(GLFWapplicationshouldhandlereopenfun callback) {
GLFWapplicationshouldhandlereopenfun previous = handle_reopen_callback;
handle_reopen_callback = callback;
@@ -752,9 +813,11 @@ int _glfwPlatformInit(void)
[NSApp setDelegate:_glfw.ns.delegate];
static struct {
unsigned short virtual_key_code;
NSEventModifierFlags input_source_switch_modifiers;
NSTimeInterval timestamp;
} last_keydown_shortcut_event;
last_keydown_shortcut_event.virtual_key_code = 0xffff;
last_keydown_shortcut_event.input_source_switch_modifiers = 0;
NSEvent* (^keydown_block)(NSEvent*) = ^ NSEvent* (NSEvent* event)
{
@@ -765,6 +828,7 @@ int _glfwPlatformInit(void)
if ([[NSApp mainMenu] performKeyEquivalent:event]) {
debug_key("keyDown triggerred global menu bar action ignoring\n");
last_keydown_shortcut_event.virtual_key_code = [event keyCode];
last_keydown_shortcut_event.input_source_switch_modifiers = 0;
last_keydown_shortcut_event.timestamp = [event timestamp];
return nil;
}
@@ -773,6 +837,16 @@ int _glfwPlatformInit(void)
if (is_useful_apple_global_shortcut(global_shortcut)) {
debug_key("keyDown triggerred global macOS shortcut ignoring\n");
last_keydown_shortcut_event.virtual_key_code = [event keyCode];
// record the modifier keys if switching to the next input source
last_keydown_shortcut_event.input_source_switch_modifiers = (global_shortcut == kSHKSelectNextSourceInInputMenu) ? USEFUL_MODS([event modifierFlags]) : 0;
last_keydown_shortcut_event.timestamp = [event timestamp];
return event;
}
// check for JIS keyboard layout function keys
if (is_apple_jis_layout_function_key(event)) {
debug_key("keyDown triggerred JIS layout function key ignoring\n");
last_keydown_shortcut_event.virtual_key_code = [event keyCode];
last_keydown_shortcut_event.input_source_switch_modifiers = 0;
last_keydown_shortcut_event.timestamp = [event timestamp];
return event;
}
@@ -805,6 +879,12 @@ int _glfwPlatformInit(void)
debug_key("-------------- flags changed -----------------\n");
debug_key("%s\n", [[event description] UTF8String]);
last_keydown_shortcut_event.virtual_key_code = 0xffff;
// switching to the next input source is only confirmed when all modifier keys are released
if (last_keydown_shortcut_event.input_source_switch_modifiers) {
if (!([event modifierFlags] & last_keydown_shortcut_event.input_source_switch_modifiers))
last_keydown_shortcut_event.input_source_switch_modifiers = 0;
return event;
}
NSWindow *kw = [NSApp keyWindow];
if (kw && kw.contentView) [kw.contentView flagsChanged:event];
else debug_key("flagsChanged ignored as no keyWindow present\n");
@@ -912,8 +992,6 @@ void _glfwPlatformTerminate(void)
_glfw.ns.appleSettings = nil;
}
free(_glfw.ns.clipboardString);
_glfwTerminateNSGL();
if (global_shortcuts != nil) { [global_shortcuts release]; global_shortcuts = nil; }
@@ -936,7 +1014,7 @@ static pthread_t main_thread;
static NSLock *tick_lock = NULL;
void _glfwDispatchTickCallback() {
void _glfwDispatchTickCallback(void) {
if (tick_lock && tick_callback) {
[tick_lock lock];
while(tick_callback_requested) {
@@ -948,7 +1026,7 @@ void _glfwDispatchTickCallback() {
}
static void
request_tick_callback() {
request_tick_callback(void) {
if (!tick_callback_requested) {
tick_callback_requested = true;
[NSApp performSelectorOnMainThread:@selector(tick_callback) withObject:nil waitUntilDone:NO];

View File

@@ -323,7 +323,7 @@ static double getFallbackRefreshRate(CGDirectDisplayID displayID)
////// GLFW internal API //////
//////////////////////////////////////////////////////////////////////////
void _glfwClearDisplayLinks() {
void _glfwClearDisplayLinks(void) {
for (size_t i = 0; i < _glfw.ns.displayLinks.count; i++) {
if (_glfw.ns.displayLinks.entries[i].displayLink) {
CVDisplayLinkStop(_glfw.ns.displayLinks.entries[i].displayLink);

10
glfw/cocoa_platform.h vendored
View File

@@ -68,7 +68,7 @@ typedef void* CVDisplayLinkRef;
typedef int (* GLFWcocoatextinputfilterfun)(int,int,unsigned int, unsigned long);
typedef bool (* GLFWapplicationshouldhandlereopenfun)(int);
typedef bool (* GLFWhandlefileopen)(const char*);
typedef bool (* GLFWhandleurlopen)(const char*);
typedef void (* GLFWapplicationwillfinishlaunchingfun)(void);
typedef bool (* GLFWcocoatogglefullscreenfun)(GLFWwindow*);
typedef void (* GLFWcocoarenderframefun)(GLFWwindow*);
@@ -131,6 +131,7 @@ typedef struct _GLFWwindowNS
bool maximized;
bool retina;
bool in_traditional_fullscreen;
bool in_fullscreen_transition;
bool titlebar_hidden;
unsigned long pre_full_screen_style_mask;
@@ -153,6 +154,8 @@ typedef struct _GLFWwindowNS
// Whether a render frame has been requested for this window
bool renderFrameRequested;
GLFWcocoarenderframefun renderFrameCallback;
// update cursor after switching desktops with Mission Control
bool delayed_cursor_update_requested;
} _GLFWwindowNS;
typedef struct _GLFWDisplayLinkNS
@@ -180,7 +183,6 @@ typedef struct _GLFWlibraryNS
char keyName[64];
char text[256];
char* clipboardString;
CGPoint cascadePoint;
// Where to place the cursor when re-enabled
double restoreCursorPosX, restoreCursorPosY;
@@ -199,8 +201,8 @@ typedef struct _GLFWlibraryNS
_GLFWDisplayLinkNS entries[256];
size_t count;
} displayLinks;
// the callback to handle file open events
GLFWhandlefileopen file_open_callback;
// the callback to handle url open events
GLFWhandleurlopen url_open_callback;
} _GLFWlibraryNS;

View File

@@ -29,6 +29,9 @@
#include "internal.h"
#include "../kitty/monotonic.h"
#include <Availability.h>
#import <CoreServices/CoreServices.h>
#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
#include <float.h>
#include <string.h>
@@ -582,6 +585,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
}
- (instancetype)initWithGlfwWindow:(_GLFWwindow *)initWindow;
- (void)request_delayed_cursor_update:(id)sender;
@end
@@ -692,6 +696,9 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
_glfwPlatformGetCursorPos(window, &x, &y);
_glfwInputCursorPos(window, x, y);
}
// macOS will send a delayed event to update the cursor to arrow after switching desktops.
// So we need to delay and update the cursor once after that.
[self performSelector:@selector(request_delayed_cursor_update:) withObject:nil afterDelay:0.3];
}
- (void)windowDidResignKey:(NSNotification *)notification
@@ -722,6 +729,38 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
}
}
- (void)request_delayed_cursor_update:(id)sender
{
(void)sender;
if (window) window->ns.delayed_cursor_update_requested = true;
}
- (void)windowWillEnterFullScreen:(NSNotification *)notification
{
(void)notification;
if (window) window->ns.in_fullscreen_transition = true;
}
- (void)windowDidEnterFullScreen:(NSNotification *)notification
{
(void)notification;
if (window) window->ns.in_fullscreen_transition = false;
[self performSelector:@selector(request_delayed_cursor_update:) withObject:nil afterDelay:0.3];
}
- (void)windowWillExitFullScreen:(NSNotification *)notification
{
(void)notification;
if (window) window->ns.in_fullscreen_transition = true;
}
- (void)windowDidExitFullScreen:(NSNotification *)notification
{
(void)notification;
if (window) window->ns.in_fullscreen_transition = false;
[self performSelector:@selector(request_delayed_cursor_update:) withObject:nil afterDelay:0.3];
}
@end // }}}
// Text input context class for the GLFW content view {{{
@@ -904,6 +943,11 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
window->ns.cursorWarpDeltaX = 0;
window->ns.cursorWarpDeltaY = 0;
if (window->ns.delayed_cursor_update_requested) {
window->ns.delayed_cursor_update_requested = false;
if (cursorInContentArea(window)) updateCursorImage(window);
}
}
- (void)rightMouseDown:(NSEvent *)event
@@ -966,6 +1010,18 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
_glfwInputCursorEnter(window, true);
}
- (void)viewDidChangeEffectiveAppearance
{
static int appearance = 0;
if (_glfw.callbacks.system_color_theme_change) {
int new_appearance = glfwGetCurrentSystemColorTheme();
if (new_appearance != appearance) {
appearance = new_appearance;
_glfw.callbacks.system_color_theme_change(appearance);
}
}
}
- (void)viewDidChangeBackingProperties
{
if (!window) return;
@@ -1003,6 +1059,8 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
- (void)updateTrackingAreas
{
if (window && [window->ns.object areCursorRectsEnabled])
[window->ns.object disableCursorRects];
if (trackingArea != nil)
{
[self removeTrackingArea:trackingArea];
@@ -1325,14 +1383,17 @@ is_ascii_control_char(char x) {
options:options];
if (!objs) return NO;
const NSUInteger count = [objs count];
NSMutableString *uri_list = [NSMutableString stringWithCapacity:4096]; // auto-released
if (count)
{
for (NSUInteger i = 0; i < count; i++)
{
id obj = objs[i];
if ([obj isKindOfClass:[NSURL class]]) {
const char *path = [obj fileSystemRepresentation];
_glfwInputDrop(window, "text/plain;charset=utf-8", path, strlen(path));
NSURL *url = (NSURL*)obj;
if ([uri_list length] > 0) [uri_list appendString:@("\n")];
if (url.fileURL) [uri_list appendString:url.filePathURL.absoluteString];
else [uri_list appendString:url.absoluteString];
} else if ([obj isKindOfClass:[NSString class]]) {
const char *text = [obj UTF8String];
_glfwInputDrop(window, "text/plain;charset=utf-8", text, strlen(text));
@@ -1342,6 +1403,7 @@ is_ascii_control_char(char x) {
}
}
}
if ([uri_list length] > 0) _glfwInputDrop(window, "text/uri-list", uri_list.UTF8String, strlen(uri_list.UTF8String));
return YES;
}
@@ -1404,15 +1466,11 @@ is_ascii_control_char(char x) {
}
void _glfwPlatformUpdateIMEState(_GLFWwindow *w, const GLFWIMEUpdateEvent *ev) {
[w->ns.view updateIMEStateFor: ev->type focused:(bool)ev->focused left:(CGFloat)ev->cursor.left top:(CGFloat)ev->cursor.top cellWidth:(CGFloat)ev->cursor.width cellHeight:(CGFloat)ev->cursor.height];
[w->ns.view updateIMEStateFor: ev->type focused:(bool)ev->focused];
}
- (void)updateIMEStateFor:(GLFWIMEUpdateType)which
focused:(bool)focused
left:(CGFloat)left
top:(CGFloat)top
cellWidth:(CGFloat)cellWidth
cellHeight:(CGFloat)cellHeight
{
if (which == GLFW_IME_UPDATE_FOCUS && !focused && [self hasMarkedText] && window) {
[input_context discardMarkedText];
@@ -1422,16 +1480,7 @@ void _glfwPlatformUpdateIMEState(_GLFWwindow *w, const GLFWIMEUpdateEvent *ev) {
_glfw.ns.text[0] = 0;
}
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("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];
}
@@ -1457,6 +1506,21 @@ void _glfwPlatformUpdateIMEState(_GLFWwindow *w, const GLFWIMEUpdateEvent *ev) {
actualRange:(NSRangePointer)actualRange
{
(void)range; (void)actualRange;
if (_glfw.callbacks.get_ime_cursor_position) {
GLFWIMEUpdateEvent ev = { .type = GLFW_IME_UPDATE_CURSOR_POSITION };
if (_glfw.callbacks.get_ime_cursor_position((GLFWwindow*)window, &ev)) {
const CGFloat left = (CGFloat)ev.cursor.left / window->ns.xscale;
const CGFloat top = (CGFloat)ev.cursor.top / window->ns.yscale;
const CGFloat cellWidth = (CGFloat)ev.cursor.width / window->ns.xscale;
const CGFloat cellHeight = (CGFloat)ev.cursor.height / window->ns.yscale;
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];
}
}
return markedRect;
}
@@ -1493,6 +1557,104 @@ void _glfwPlatformUpdateIMEState(_GLFWwindow *w, const GLFWIMEUpdateEvent *ev) {
debug_key("\n\tdoCommandBySelector: (%s)\n", [NSStringFromSelector(selector) UTF8String]);
}
- (BOOL)isAccessibilityElement
{
return YES;
}
- (BOOL)isAccessibilitySelectorAllowed:(SEL)selector
{
if (selector == @selector(accessibilityRole) || selector == @selector(accessibilitySelectedText)) return YES;
return NO;
}
#if (TARGET_OS_OSX && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400)
- (NSAccessibilityRole)accessibilityRole
{
return NSAccessibilityTextAreaRole;
}
#endif
- (NSString *)accessibilitySelectedText
{
NSString *text = nil;
if (_glfw.callbacks.get_current_selection) {
char *s = _glfw.callbacks.get_current_selection();
if (s) {
text = [NSString stringWithUTF8String:s];
free(s);
}
}
return text;
}
// <https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/SysServices/Articles/using.html>
// Support services receiving "public.utf8-plain-text" and "NSStringPboardType"
- (id)validRequestorForSendType:(NSString *)sendType returnType:(NSString *)returnType
{
if (
(!sendType || [sendType isEqual:NSPasteboardTypeString] || [sendType isEqual:@"NSStringPboardType"]) &&
(!returnType || [returnType isEqual:NSPasteboardTypeString] || [returnType isEqual:@"NSStringPboardType"])
) {
if (_glfw.callbacks.has_current_selection && _glfw.callbacks.has_current_selection()) return self;
}
return [super validRequestorForSendType:sendType returnType:returnType];
}
// Selected text as input to be sent to Services
// For example, after selecting an absolute path, open the global menu bar kitty->Services and click `Show in Finder`.
- (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pboard types:(NSArray *)types
{
if (!_glfw.callbacks.get_current_selection) return NO;
char *text = _glfw.callbacks.get_current_selection();
if (!text) return NO;
BOOL ans = NO;
if (text[0]) {
if ([types containsObject:NSPasteboardTypeString] == YES) {
[pboard declareTypes:@[NSPasteboardTypeString] owner:self];
ans = [pboard setString:@(text) forType:NSPasteboardTypeString];
} else if ([types containsObject:@"NSStringPboardType"] == YES) {
[pboard declareTypes:@[@"NSStringPboardType"] owner:self];
ans = [pboard setString:@(text) forType:@"NSStringPboardType"];
}
free(text);
}
return ans;
}
// Service output to be handled
// For example, open System Settings->Keyboard->Keyboard Shortcuts->Services->Text, enable `Convert Text to Full Width`, select some text and execute the service.
- (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pboard
{
NSString* text = nil;
NSArray *types = [pboard types];
if ([types containsObject:NSPasteboardTypeString] == YES) {
text = [pboard stringForType:NSPasteboardTypeString]; // public.utf8-plain-text
} else if ([types containsObject:@"NSStringPboardType"] == YES) {
text = [pboard stringForType:@"NSStringPboardType"]; // for older services (need re-encode?)
} else {
return NO;
}
if (text && [text length] > 0) {
// The service wants us to replace the selection, but we can't replace anything but insert text.
const char *utf8 = polymorphic_string_as_utf8(text);
debug_key("Sending text received in readSelectionFromPasteboard as key event\n");
GLFWkeyevent glfw_keyevent = {.text=utf8, .ime_state=GLFW_IME_COMMIT_TEXT};
_glfwInputKeyboard(window, &glfw_keyevent);
// Restore pre-edit text after inserting the received text
if ([self hasMarkedText]) {
glfw_keyevent.text = [[markedText string] UTF8String];
glfw_keyevent.ime_state = GLFW_IME_PREEDIT_CHANGED;
_glfwInputKeyboard(window, &glfw_keyevent);
}
return YES;
}
return NO;
}
@end
// }}}
@@ -1554,8 +1716,11 @@ void _glfwPlatformUpdateIMEState(_GLFWwindow *w, const GLFWIMEUpdateEvent *ev) {
- (void)toggleFullScreen:(nullable id)sender
{
if (glfw_window && glfw_window->ns.toggleFullscreenCallback && glfw_window->ns.toggleFullscreenCallback((GLFWwindow*)glfw_window) == 1)
return;
if (glfw_window) {
if (glfw_window->ns.in_fullscreen_transition) return;
if (glfw_window->ns.toggleFullscreenCallback && glfw_window->ns.toggleFullscreenCallback((GLFWwindow*)glfw_window) == 1) return;
glfw_window->ns.in_fullscreen_transition = true;
}
// 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)];
@@ -1566,6 +1731,18 @@ void _glfwPlatformUpdateIMEState(_GLFWwindow *w, const GLFWIMEUpdateEvent *ev) {
if (glfw_window && !glfw_window->decorated && glfw_window->ns.view) [self makeFirstResponder:glfw_window->ns.view];
}
- (void)zoom:(id)sender
{
if (![self isZoomed]) {
const NSSize original = [self resizeIncrements];
[self setResizeIncrements:NSMakeSize(1.0, 1.0)];
[super zoom:sender];
[self setResizeIncrements:original];
} else {
[super zoom:sender];
}
}
@end
// }}}
@@ -1681,7 +1858,11 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
if (!createNativeWindow(window, wndconfig, fbconfig))
return false;
[window->ns.object setColorSpace:[NSColorSpace sRGBColorSpace]];
switch((GlfwCocoaColorSpaces)wndconfig->ns.color_space) {
case SRGB_COLORSPACE: [window->ns.object setColorSpace:[NSColorSpace sRGBColorSpace]]; break;
case DISPLAY_P3_COLORSPACE: [window->ns.object setColorSpace:[NSColorSpace displayP3ColorSpace]]; break;
case DEFAULT_COLORSPACE: break;
}
if (ctxconfig->client != GLFW_NO_API)
{
@@ -1715,8 +1896,9 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
if (window->monitor)
{
_glfwPlatformShowWindow(window);
_glfwPlatformFocusWindow(window);
// Do not show the window here until after setting the window size, maximized state, and full screen
// _glfwPlatformShowWindow(window);
// _glfwPlatformFocusWindow(window);
acquireMonitor(window);
}
@@ -1908,8 +2090,9 @@ void _glfwPlatformRestoreWindow(_GLFWwindow* window)
void _glfwPlatformMaximizeWindow(_GLFWwindow* window)
{
if (![window->ns.object isZoomed])
if (![window->ns.object isZoomed]) {
[window->ns.object zoom:nil];
}
}
void _glfwPlatformShowWindow(_GLFWwindow* window)
@@ -2415,41 +2598,166 @@ bool _glfwPlatformToggleFullscreen(_GLFWwindow* w, unsigned int flags) {
if (in_fullscreen) made_fullscreen = false;
[window toggleFullScreen: nil];
}
// Update window button visibility
if (w->ns.titlebar_hidden) {
// The hidden buttons might be automatically reset to be visible after going full screen
// to show up in the auto-hide title bar, so they need to be set back to hidden.
BOOL button_hidden = YES;
// When title bar is configured to be hidden, it should be shown with buttons (auto-hide) after going to full screen.
if (!traditional) {
button_hidden = (BOOL) !made_fullscreen;
}
[[window standardWindowButton: NSWindowCloseButton] setHidden:button_hidden];
[[window standardWindowButton: NSWindowMiniaturizeButton] setHidden:button_hidden];
[[window standardWindowButton: NSWindowZoomButton] setHidden:button_hidden];
}
return made_fullscreen;
}
void _glfwPlatformSetClipboardString(const char* string)
{
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
[pasteboard declareTypes:@[NSPasteboardTypeString] owner:nil];
[pasteboard setString:@(string) forType:NSPasteboardTypeString];
// Clipboard {{{
#define UTI_ROUNDTRIP_PREFIX @"uti-is-typical-apple-nih."
static NSString*
mime_to_uti(const char *mime) {
if (strcmp(mime, "text/plain") == 0) return NSPasteboardTypeString;
if (@available(macOS 11.0, *)) {
UTType *t = [UTType typeWithMIMEType:@(mime)]; // auto-released
if (t != nil && !t.dynamic) return t.identifier;
}
return [NSString stringWithFormat:@"%@%s", UTI_ROUNDTRIP_PREFIX, mime]; // auto-released
}
const char* _glfwPlatformGetClipboardString(void)
{
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
if (![[pasteboard types] containsObject:NSPasteboardTypeString])
{
_glfwInputError(GLFW_FORMAT_UNAVAILABLE,
"Cocoa: Failed to retrieve string from pasteboard");
return NULL;
static const char*
uti_to_mime(NSString *uti) {
if ([uti isEqualToString:NSPasteboardTypeString]) return "text/plain";
if ([uti hasPrefix:UTI_ROUNDTRIP_PREFIX]) return [[uti substringFromIndex:[UTI_ROUNDTRIP_PREFIX length]] UTF8String];
if (@available(macOS 11.0, *)) {
UTType *t = [UTType typeWithIdentifier:uti]; // auto-released
if (t.preferredMIMEType != nil) return [t.preferredMIMEType UTF8String];
}
NSString* object = [pasteboard stringForType:NSPasteboardTypeString];
if (!object)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Cocoa: Failed to retrieve object from pasteboard");
return NULL;
}
free(_glfw.ns.clipboardString);
_glfw.ns.clipboardString = _glfw_strdup([object UTF8String]);
return _glfw.ns.clipboardString;
return "";
}
static void
list_clipboard_mimetypes(GLFWclipboardwritedatafun write_data, void *object) {
#define w(x) { if (ok) ok = write_data(object, x, strlen(x)); }
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
NSDictionary* options = @{NSPasteboardURLReadingFileURLsOnlyKey:@YES};
BOOL has_file_urls = [pasteboard canReadObjectForClasses:@[[NSURL class]] options:options];
BOOL has_strings = [pasteboard canReadObjectForClasses:@[[NSString class]] options:nil];
/* NSLog(@"has_file_urls: %d has_strings: %d", has_file_urls, has_strings); */
bool ok = true;
if (has_strings) w("text/plain");
if (has_file_urls) w("text/local-path-list");
for (NSPasteboardItem * item in pasteboard.pasteboardItems) {
for (NSPasteboardType type in item.types) {
/* NSLog(@"%@", type); */
const char *mime = uti_to_mime(type);
if (mime && mime[0] && ![@(mime) hasPrefix:@"text/plain"]) {
/* NSLog(@"ut: %@ mt: %@ tags: %@", ut, ut.preferredMIMEType, ut.tags); */
w(mime);
}
}
}
#undef w
}
static void
get_text_plain(GLFWclipboardwritedatafun write_data, void *object) {
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
NSDictionary* options = @{NSPasteboardURLReadingFileURLsOnlyKey:@YES};
NSArray* objs = [pasteboard readObjectsForClasses:@[[NSURL class], [NSString class]] options:options];
bool found = false;
if (objs) {
const NSUInteger count = [objs count];
if (count) {
NSMutableData *path_list = [NSMutableData dataWithCapacity:4096]; // auto-released
NSMutableData *text_list = [NSMutableData dataWithCapacity:4096]; // auto-released
for (NSUInteger i = 0; i < count; i++) {
id obj = objs[i];
if ([obj isKindOfClass:[NSURL class]]) {
NSURL *url = (NSURL*)obj;
if (url.fileURL && url.fileSystemRepresentation) {
if ([path_list length] > 0) [path_list appendBytes:"\n" length:1];
[path_list appendBytes:url.fileSystemRepresentation length:strlen(url.fileSystemRepresentation)];
}
} else if ([obj isKindOfClass:[NSString class]]) {
if ([text_list length] > 0) [text_list appendBytes:"\n" length:1];
[text_list appendData:[obj dataUsingEncoding:NSUTF8StringEncoding]];
}
}
const NSMutableData *text = nil;
if (path_list.length > 0) text = path_list;
else if (text_list.length > 0) text = text_list;
if (text) {
found = true;
write_data(object, text.mutableBytes, text.length);
}
}
}
if (!found) _glfwInputError(GLFW_PLATFORM_ERROR, "Cocoa: Failed to retrieve text/plain from pasteboard");
}
void
_glfwPlatformGetClipboard(GLFWClipboardType clipboard_type, const char* mime_type, GLFWclipboardwritedatafun write_data, void *object) {
if (clipboard_type != GLFW_CLIPBOARD) return;
if (mime_type == NULL) {
list_clipboard_mimetypes(write_data, object);
return;
}
if (strcmp(mime_type, "text/plain") == 0) {
get_text_plain(write_data, object);
return;
}
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
/* NSLog(@"mime: %s uti: %@", mime_type, mime_to_uti(mime_type)); */
NSPasteboardType t = [pasteboard availableTypeFromArray:@[mime_to_uti(mime_type)]];
/* NSLog(@"available type: %@", t); */
if (t != nil) {
NSData *data = [pasteboard dataForType:t]; // auto-released
/* NSLog(@"data: %@", data); */
if (data != nil && data.length > 0) {
write_data(object, data.bytes, data.length);
}
}
}
static NSMutableData*
get_clipboard_data(const _GLFWClipboardData *cd, const char *mime) {
NSMutableData *ans = [NSMutableData dataWithCapacity:8192];
if (ans == nil) return nil;
GLFWDataChunk chunk = cd->get_data(mime, NULL, cd->ctype);
void *iter = chunk.iter;
if (!iter) return ans;
while (true) {
chunk = cd->get_data(mime, iter, cd->ctype);
if (!chunk.sz) break;
[ans appendBytes:chunk.data length:chunk.sz];
if (chunk.free) chunk.free((void*)chunk.free_data);
}
cd->get_data(NULL, iter, cd->ctype);
return ans;
}
void
_glfwPlatformSetClipboard(GLFWClipboardType t) {
if (t != GLFW_CLIPBOARD) return;
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
NSMutableArray<NSPasteboardType> *ptypes = [NSMutableArray arrayWithCapacity:_glfw.clipboard.num_mime_types]; // auto-released
for (size_t i = 0; i < _glfw.clipboard.num_mime_types; i++) {
[ptypes addObject:mime_to_uti(_glfw.clipboard.mime_types[i])];
}
[pasteboard declareTypes:ptypes owner:nil];
for (size_t i = 0; i < _glfw.clipboard.num_mime_types; i++) {
NSMutableData *data = get_clipboard_data(&_glfw.clipboard, _glfw.clipboard.mime_types[i]); // auto-released
/* NSLog(@"putting data: %@ for: %s with UTI: %@", data, _glfw.clipboard.mime_types[i], ptypes[i]); */
if (data != nil) [pasteboard setData:data forType:ptypes[i]];
}
}
// }}}
EGLenum _glfwPlatformGetEGLPlatform(EGLint** attribs)
{
if (_glfw.egl.ANGLE_platform_angle)
@@ -2642,10 +2950,10 @@ GLFWAPI GLFWcocoatextinputfilterfun glfwSetCocoaTextInputFilter(GLFWwindow *hand
return previous;
}
GLFWAPI GLFWhandlefileopen glfwSetCocoaFileOpenCallback(GLFWhandlefileopen callback) {
GLFWAPI GLFWhandleurlopen glfwSetCocoaURLOpenCallback(GLFWhandleurlopen callback) {
_GLFW_REQUIRE_INIT_OR_RETURN(nil);
GLFWhandlefileopen prev = _glfw.ns.file_open_callback;
_glfw.ns.file_open_callback = callback;
GLFWhandleurlopen prev = _glfw.ns.url_open_callback;
_glfw.ns.url_open_callback = callback;
return prev;
}
@@ -2661,6 +2969,19 @@ GLFWAPI void glfwCocoaRequestRenderFrame(GLFWwindow *w, GLFWcocoarenderframefun
requestRenderFrame((_GLFWwindow*)w, callback);
}
GLFWAPI int glfwGetCurrentSystemColorTheme(void) {
int theme_type = 0;
NSAppearance *changedAppearance = NSApp.effectiveAppearance;
NSAppearanceName newAppearance = [changedAppearance bestMatchFromAppearancesWithNames:@[NSAppearanceNameAqua, NSAppearanceNameDarkAqua]];
if([newAppearance isEqualToString:NSAppearanceNameDarkAqua]){
theme_type = 1;
} else {
theme_type = 2;
}
return theme_type;
}
GLFWAPI uint32_t
glfwGetCocoaKeyEquivalent(uint32_t glfw_key, int glfw_mods, int *cocoa_mods) {
*cocoa_mods = 0;

12
glfw/context.c vendored
View File

@@ -396,15 +396,6 @@ bool _glfwRefreshContextAttribs(_GLFWwindow* window,
window->context.release = GLFW_RELEASE_BEHAVIOR_FLUSH;
}
// Clearing the front buffer to black to avoid garbage pixels left over from
// previous uses of our bit of VRAM
{
PFNGLCLEARPROC glClear = (PFNGLCLEARPROC)
window->context.getProcAddress("glClear");
glClear(GL_COLOR_BUFFER_BIT);
window->context.swapBuffers(window);
}
glfwMakeContextCurrent((GLFWwindow*) previous);
return true;
}
@@ -487,6 +478,9 @@ GLFWAPI void glfwSwapBuffers(GLFWwindow* handle)
}
window->context.swapBuffers(window);
#ifdef _GLFW_WAYLAND
_glfwWaylandAfterBufferSwap(window);
#endif
}
GLFWAPI void glfwSwapInterval(int interval)

6
glfw/dbus_glfw.c vendored
View File

@@ -174,7 +174,7 @@ glfw_dbus_dispatch(DBusConnection *conn) {
}
void
glfw_dbus_session_bus_dispatch() {
glfw_dbus_session_bus_dispatch(void) {
if (session_bus) glfw_dbus_dispatch(session_bus);
}
@@ -263,7 +263,7 @@ call_method_with_msg(DBusConnection *conn, DBusMessage *msg, int timeout, dbus_p
static bool
call_method(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, int timeout, dbus_pending_callback callback, void *user_data, va_list ap) {
if (!conn) return false;
if (!conn || !path) return false;
DBusMessage *msg = dbus_message_new_method_call(node, path, interface, method);
if (!msg) return false;
bool retval = false;
@@ -344,7 +344,7 @@ glfw_dbus_connect_to_session_bus(void) {
}
DBusConnection *
glfw_dbus_session_bus() {
glfw_dbus_session_bus(void) {
if (!session_bus) glfw_dbus_connect_to_session_bus();
return session_bus;
}

8
glfw/egl_context.c vendored
View File

@@ -326,6 +326,7 @@ bool _glfwInitEGL(void)
glfw_dlsym(_glfw.egl.SwapBuffers, _glfw.egl.handle, "eglSwapBuffers");
glfw_dlsym(_glfw.egl.SwapInterval, _glfw.egl.handle, "eglSwapInterval");
glfw_dlsym(_glfw.egl.QueryString, _glfw.egl.handle, "eglQueryString");
glfw_dlsym(_glfw.egl.QuerySurface, _glfw.egl.handle, "eglQuerySurface");
glfw_dlsym(_glfw.egl.GetProcAddress, _glfw.egl.handle, "eglGetProcAddress");
if (!_glfw.egl.GetConfigAttrib ||
@@ -428,6 +429,8 @@ bool _glfwInitEGL(void)
extensionSupportedEGL("EGL_KHR_get_all_proc_addresses");
_glfw.egl.KHR_context_flush_control =
extensionSupportedEGL("EGL_KHR_context_flush_control");
_glfw.egl.EXT_present_opaque =
extensionSupportedEGL("EGL_EXT_present_opaque");
return true;
}
@@ -598,6 +601,11 @@ bool _glfwCreateContextEGL(_GLFWwindow* window,
if (_glfw.egl.KHR_gl_colorspace)
setAttrib(EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR);
}
// Disabled because it prevents transparency from working on NVIDIA drivers under Wayland
// https://github.com/kovidgoyal/kitty/issues/5479
// We anyway dont use the alpha bits for anything.
/* if (_glfw.egl.EXT_present_opaque) */
/* setAttrib(EGL_PRESENT_OPAQUE_EXT, !fbconfig->transparent); */
setAttrib(EGL_NONE, EGL_NONE);

12
glfw/egl_context.h vendored
View File

@@ -132,6 +132,7 @@ typedef EGLBoolean (EGLAPIENTRY * PFN_eglMakeCurrent)(EGLDisplay,EGLSurface,EGLS
typedef EGLBoolean (EGLAPIENTRY * PFN_eglSwapBuffers)(EGLDisplay,EGLSurface);
typedef EGLBoolean (EGLAPIENTRY * PFN_eglSwapInterval)(EGLDisplay,EGLint);
typedef const char* (EGLAPIENTRY * PFN_eglQueryString)(EGLDisplay,EGLint);
typedef const char* (EGLAPIENTRY * PFN_eglQuerySurface)(EGLDisplay,EGLSurface,EGLint,EGLint*);
typedef GLFWglproc (EGLAPIENTRY * PFN_eglGetProcAddress)(const char*);
#define eglGetConfigAttrib _glfw.egl.GetConfigAttrib
#define eglGetConfigs _glfw.egl.GetConfigs
@@ -149,6 +150,7 @@ typedef GLFWglproc (EGLAPIENTRY * PFN_eglGetProcAddress)(const char*);
#define eglSwapBuffers _glfw.egl.SwapBuffers
#define eglSwapInterval _glfw.egl.SwapInterval
#define eglQueryString _glfw.egl.QueryString
#define eglQuerySurface _glfw.egl.QuerySurface
#define eglGetProcAddress _glfw.egl.GetProcAddress
typedef EGLDisplay (EGLAPIENTRY * PFNEGLGETPLATFORMDISPLAYEXTPROC)(EGLenum,void*,const EGLint*);
@@ -160,11 +162,11 @@ typedef EGLSurface (EGLAPIENTRY * PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC)(EGLD
//
typedef struct _GLFWcontextEGL
{
EGLConfig config;
EGLContext handle;
EGLSurface surface;
EGLConfig config;
EGLContext handle;
EGLSurface surface;
void* client;
void* client;
} _GLFWcontextEGL;
@@ -186,6 +188,7 @@ typedef struct _GLFWlibraryEGL
bool EXT_platform_base;
bool EXT_platform_x11;
bool EXT_platform_wayland;
bool EXT_present_opaque;
bool ANGLE_platform_angle;
bool ANGLE_platform_angle_opengl;
bool ANGLE_platform_angle_d3d;
@@ -210,6 +213,7 @@ typedef struct _GLFWlibraryEGL
PFN_eglSwapBuffers SwapBuffers;
PFN_eglSwapInterval SwapInterval;
PFN_eglQueryString QueryString;
PFN_eglQuerySurface QuerySurface;
PFN_eglGetProcAddress GetProcAddress;
PFNEGLGETPLATFORMDISPLAYEXTPROC GetPlatformDisplayEXT;

View File

@@ -14,6 +14,10 @@ is_openbsd = 'openbsd' in _plat
base = os.path.dirname(os.path.abspath(__file__))
def null_func() -> None:
return None
class CompileKey(NamedTuple):
src: str
dest: str
@@ -23,7 +27,7 @@ class Command(NamedTuple):
desc: str
cmd: Sequence[str]
is_newer_func: Callable[[], bool]
on_success: Callable[[], None] = lambda: None
on_success: Callable[[], None] = null_func
key: Optional[CompileKey] = None
keyfile: Optional[str] = None
@@ -37,6 +41,7 @@ class Env:
library_paths: Dict[str, List[str]] = {}
ldpaths: List[str] = []
ccver: Tuple[int, int]
vcs_rev: str = ''
# glfw stuff
all_headers: List[str] = []
@@ -48,11 +53,13 @@ class Env:
def __init__(
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)
library_paths: Dict[str, List[str]] = {}, ldpaths: Optional[List[str]] = None, ccver: Tuple[int, int] = (0, 0),
vcs_rev: str = ''
):
self.cc, self.cppflags, self.cflags, self.ldflags, self.library_paths = cc, cppflags, cflags, ldflags, library_paths
self.ldpaths = ldpaths or []
self.ccver = ccver
self.vcs_rev = vcs_rev
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)
@@ -62,6 +69,7 @@ class Env:
ans.wayland_scanner = self.wayland_scanner
ans.wayland_scanner_code = self.wayland_scanner_code
ans.wayland_protocols = self.wayland_protocols
ans.vcs_rev = self.vcs_rev
return ans
@@ -111,7 +119,7 @@ def init_env(
elif module == 'cocoa':
ans.cppflags.append('-DGL_SILENCE_DEPRECATION')
for f_ in 'Cocoa IOKit CoreFoundation CoreVideo'.split():
for f_ in 'Cocoa IOKit CoreFoundation CoreVideo UniformTypeIdentifiers'.split():
ans.ldpaths.extend(('-framework', f_))
elif module == 'wayland':
@@ -172,6 +180,8 @@ class Arg:
while self.name.startswith('*'):
self.name = self.name[1:]
self.type = self.type + '*'
if '[' in self.name:
self.type += '[' + self.name.partition('[')[-1]
def __repr__(self) -> str:
return f'Arg({self.type}, {self.name})'
@@ -233,7 +243,7 @@ def generate_wrappers(glfw_header: str) -> None:
void* glfwGetNSGLContext(GLFWwindow *window)
uint32_t glfwGetCocoaMonitor(GLFWmonitor* monitor)
GLFWcocoatextinputfilterfun glfwSetCocoaTextInputFilter(GLFWwindow* window, GLFWcocoatextinputfilterfun callback)
GLFWhandlefileopen glfwSetCocoaFileOpenCallback(GLFWhandlefileopen callback)
GLFWhandleurlopen glfwSetCocoaURLOpenCallback(GLFWhandleurlopen callback)
GLFWcocoatogglefullscreenfun glfwSetCocoaToggleFullscreenIntercept(GLFWwindow *window, GLFWcocoatogglefullscreenfun callback)
GLFWapplicationshouldhandlereopenfun glfwSetApplicationShouldHandleReopen(GLFWapplicationshouldhandlereopenfun callback)
GLFWapplicationwillfinishlaunchingfun glfwSetApplicationWillFinishLaunching(GLFWapplicationwillfinishlaunchingfun callback)
@@ -245,11 +255,15 @@ def generate_wrappers(glfw_header: str) -> None:
const char* glfwGetPrimarySelectionString(GLFWwindow* window, void)
int glfwGetNativeKeyForName(const char* key_name, int case_sensitive)
void glfwRequestWaylandFrameEvent(GLFWwindow *handle, unsigned long long id, GLFWwaylandframecallbackfunc callback)
void glfwWaylandActivateWindow(GLFWwindow *handle, const char *activation_token)
void glfwWaylandRunWithActivationToken(GLFWwindow *handle, GLFWactivationcallback cb, void *cb_data)
bool glfwWaylandSetTitlebarColor(GLFWwindow *handle, uint32_t color, bool use_system_color)
unsigned long long glfwDBusUserNotify(const char *app_name, const char* icon, const char *summary, const char *body, \
const char *action_text, int32_t timeout, GLFWDBusnotificationcreatedfun callback, void *data)
void glfwDBusSetUserNotificationHandler(GLFWDBusnotificationactivatedfun handler)
int glfwSetX11LaunchCommand(GLFWwindow *handle, char **argv, int argc)
void glfwSetX11WindowAsDock(int32_t x11_window_id)
void glfwSetX11WindowStrut(int32_t x11_window_id, uint32_t dimensions[12])
'''.splitlines():
if line:
functions.append(Function(line.strip(), check_fail=False))
@@ -277,7 +291,7 @@ const char *action_text, int32_t timeout, GLFWDBusnotificationcreatedfun callbac
typedef int (* GLFWcocoatextinputfilterfun)(int,int,unsigned int,unsigned long);
typedef bool (* GLFWapplicationshouldhandlereopenfun)(int);
typedef bool (* GLFWhandlefileopen)(const char*);
typedef bool (* GLFWhandleurlopen)(const char*);
typedef void (* GLFWapplicationwillfinishlaunchingfun)(void);
typedef bool (* GLFWcocoatogglefullscreenfun)(GLFWwindow*);
typedef void (* GLFWcocoarenderframefun)(GLFWwindow*);
@@ -292,6 +306,8 @@ const char* load_glfw(const char* path);
f.write(header)
code = '''
// generated by glfw.py DO NOT edit
#define GFW_EXTERN
#include "data-types.h"
#include "glfw-wrapper.h"

112
glfw/glfw3.h vendored
View File

@@ -512,6 +512,7 @@ typedef enum {
* GLFW_LOCK_KEY_MODS input mode is set.
*/
#define GLFW_MOD_NUM_LOCK 0x0080
#define GLFW_MOD_LAST GLFW_MOD_NUM_LOCK
#define GLFW_LOCK_MASK (GLFW_MOD_NUM_LOCK | GLFW_MOD_CAPS_LOCK)
/*! @} */
@@ -1024,6 +1025,16 @@ typedef enum GLFWMouseButton {
* [window hint](@ref GLFW_COCOA_GRAPHICS_SWITCHING_hint).
*/
#define GLFW_COCOA_GRAPHICS_SWITCHING 0x00023003
/*! @brief macOS specific
* [window hint](@ref GLFW_COCOA_COLOR_SPACE_hint).
*/
#define GLFW_COCOA_COLOR_SPACE 0x00023004
typedef enum {
DEFAULT_COLORSPACE = 0,
SRGB_COLORSPACE = 1,
DISPLAY_P3_COLORSPACE = 2,
} GlfwCocoaColorSpaces;
/*! @brief X11 specific
* [window hint](@ref GLFW_X11_CLASS_NAME_hint).
*/
@@ -1206,7 +1217,8 @@ typedef enum {
typedef enum {
GLFW_IME_NONE,
GLFW_IME_PREEDIT_CHANGED,
GLFW_IME_COMMIT_TEXT
GLFW_IME_COMMIT_TEXT,
GLFW_IME_WAYLAND_DONE_EVENT,
} GLFWIMEState;
typedef enum {
@@ -1356,6 +1368,22 @@ typedef void (* GLFWwindowclosefun)(GLFWwindow*);
*/
typedef void (* GLFWapplicationclosefun)(int);
/*! @brief The function pointer type for system color theme change callbacks.
*
* This is the function pointer type for system color theme changes.
* @code
* void function_name(int theme_type)
* @endcode
*
* @param[in] theme_type 0 for unknown, 1 for dark and 2 for light
*
* @sa @ref glfwSetSystemColorThemeChangeCallback
*
* @ingroup window
*/
typedef void (* GLFWsystemcolorthemechangefun)(int);
/*! @brief The function pointer type for window content refresh callbacks.
*
* This is the function pointer type for window content refresh callbacks.
@@ -1704,7 +1732,23 @@ typedef void (* GLFWjoystickfun)(int,int);
typedef void (* GLFWuserdatafun)(unsigned long long, void*);
typedef void (* GLFWtickcallback)(void*);
typedef void (* GLFWactivationcallback)(GLFWwindow *window, const char *token, void *data);
typedef bool (* GLFWdrawtextfun)(GLFWwindow *window, const char *text, uint32_t fg, uint32_t bg, uint8_t *output_buf, size_t width, size_t height, float x_offset, float y_offset, size_t right_margin);
typedef char* (* GLFWcurrentselectionfun)(void);
typedef bool (* GLFWhascurrentselectionfun)(void);
typedef void (* GLFWclipboarddatafreefun)(void* data);
typedef struct GLFWDataChunk {
const char *data;
size_t sz;
GLFWclipboarddatafreefun free;
void *iter, *free_data;
} GLFWDataChunk;
typedef enum {
GLFW_CLIPBOARD, GLFW_PRIMARY_SELECTION
} GLFWClipboardType;
typedef GLFWDataChunk (* GLFWclipboarditerfun)(const char *mime_type, void *iter, GLFWClipboardType ctype);
typedef bool (* GLFWclipboardwritedatafun)(void *object, const char *data, size_t sz);
typedef bool (* GLFWimecursorpositionfun)(GLFWwindow *window, GLFWIMEUpdateEvent *ev);
/*! @brief Video mode type.
*
@@ -1862,6 +1906,9 @@ GLFWAPI unsigned long long glfwAddTimer(monotonic_t interval, bool repeats, GLFW
GLFWAPI void glfwUpdateTimer(unsigned long long timer_id, monotonic_t interval, bool enabled);
GLFWAPI void glfwRemoveTimer(unsigned long long);
GLFWAPI GLFWdrawtextfun glfwSetDrawTextFunction(GLFWdrawtextfun function);
GLFWAPI GLFWcurrentselectionfun glfwSetCurrentSelectionCallback(GLFWcurrentselectionfun callback);
GLFWAPI GLFWhascurrentselectionfun glfwSetHasCurrentSelectionCallback(GLFWhascurrentselectionfun callback);
GLFWAPI GLFWimecursorpositionfun glfwSetIMECursorPositionCallback(GLFWimecursorpositionfun callback);
/*! @brief Terminates the GLFW library.
*
@@ -2757,6 +2804,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);
GLFWAPI bool glfwAreSwapsAllowed(const GLFWwindow* window);
/*! @brief Destroys the specified window and its context.
*
@@ -3874,6 +3922,8 @@ GLFWAPI GLFWwindowsizefun glfwSetWindowSizeCallback(GLFWwindow* window, GLFWwind
*/
GLFWAPI GLFWwindowclosefun glfwSetWindowCloseCallback(GLFWwindow* window, GLFWwindowclosefun callback);
GLFWAPI GLFWapplicationclosefun glfwSetApplicationCloseCallback(GLFWapplicationclosefun callback);
GLFWAPI GLFWsystemcolorthemechangefun glfwSetSystemColorThemeChangeCallback(GLFWsystemcolorthemechangefun callback);
GLFWAPI int glfwGetCurrentSystemColorTheme(void);
/*! @brief Sets the refresh callback for the specified window.
*
@@ -5205,64 +5255,8 @@ GLFWAPI const char* glfwGetGamepadName(int jid);
*/
GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state);
/*! @brief Sets the clipboard to the specified string.
*
* This function sets the system clipboard to the specified, UTF-8 encoded
* string.
*
* @param[in] window Deprecated. Any valid window or `NULL`.
* @param[in] string A UTF-8 encoded string.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR.
*
* @remark @wayland Clipboard is currently unimplemented.
*
* @pointer_lifetime The specified string is copied before this function
* returns.
*
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref clipboard
* @sa @ref glfwGetClipboardString
*
* @since Added in version 3.0.
*
* @ingroup input
*/
GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char* string);
/*! @brief Returns the contents of the clipboard as a string.
*
* This function returns the contents of the system clipboard, if it contains
* or is convertible to a UTF-8 encoded string. If the clipboard is empty or
* if its contents cannot be converted, `NULL` is returned and a @ref
* GLFW_FORMAT_UNAVAILABLE error is generated.
*
* @param[in] window Deprecated. Any valid window or `NULL`.
* @return The contents of the clipboard as a UTF-8 encoded string, or `NULL`
* if an [error](@ref error_handling) occurred.
*
* @errors Possible errors include @ref GLFW_NOT_INITIALIZED and @ref
* GLFW_PLATFORM_ERROR.
*
* @remark @wayland Clipboard is currently unimplemented.
*
* @pointer_lifetime The returned string is allocated and freed by GLFW. You
* should not free it yourself. It is valid until the next call to @ref
* glfwGetClipboardString or @ref glfwSetClipboardString, or until the library
* is terminated.
*
* @thread_safety This function must only be called from the main thread.
*
* @sa @ref clipboard
* @sa @ref glfwSetClipboardString
*
* @since Added in version 3.0.
*
* @ingroup input
*/
GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window);
GLFWAPI void glfwSetClipboardDataTypes(GLFWClipboardType clipboard_type, const char* const *mime_types, size_t num_mime_types, GLFWclipboarditerfun get_iter);
GLFWAPI void glfwGetClipboard(GLFWClipboardType clipboard_type, const char* mime_type, GLFWclipboardwritedatafun write_data, void *object);
/*! @brief Returns the GLFW time.
*

44
glfw/ibus_glfw.c vendored
View File

@@ -283,29 +283,35 @@ static const char*
get_ibus_address_file_name(void) {
const char *addr;
static char ans[PATH_MAX];
static char display[64] = {0};
addr = getenv("IBUS_ADDRESS");
int offset = 0;
if (addr && addr[0]) {
memcpy(ans, addr, GLFW_MIN(strlen(addr), sizeof(ans)));
return ans;
}
const char *de = getenv("DISPLAY");
if (!de || !de[0]) de = ":0.0";
char *display = _glfw_strdup(de);
const char *host = display;
char *disp_num = strrchr(display, ':');
char *screen_num = strrchr(display, '.');
if (!disp_num) {
_glfwInputError(GLFW_PLATFORM_ERROR, "Could not get IBUS address file name as DISPLAY env var has no colon");
free(display);
return NULL;
const char* disp_num = NULL;
const char *host = "unix";
// See https://github.com/ibus/ibus/commit/8ce25208c3f4adfd290a032c6aa739d2b7580eb1 for why we need this dance.
const char *de = getenv("WAYLAND_DISPLAY");
if (de) {
disp_num = de;
} else {
const char *de = getenv("DISPLAY");
if (!de || !de[0]) de = ":0.0";
strncpy(display, de, sizeof(display) - 1);
char *dnum = strrchr(display, ':');
if (!dnum) {
_glfwInputError(GLFW_PLATFORM_ERROR, "Could not get IBUS address file name as DISPLAY env var has no colon");
return NULL;
}
char *screen_num = strrchr(display, '.');
*dnum = 0;
dnum++;
if (screen_num) *screen_num = 0;
if (*display) host = display;
disp_num = dnum;
}
*disp_num = 0;
disp_num++;
if (screen_num) *screen_num = 0;
if (!*host) host = "unix";
memset(ans, 0, sizeof(ans));
const char *conf_env = getenv("XDG_CONFIG_HOME");
@@ -315,7 +321,6 @@ get_ibus_address_file_name(void) {
conf_env = getenv("HOME");
if (!conf_env || !conf_env[0]) {
_glfwInputError(GLFW_PLATFORM_ERROR, "Could not get IBUS address file name as no HOME env var is set");
free(display);
return NULL;
}
offset = snprintf(ans, sizeof(ans), "%s/.config", conf_env);
@@ -323,7 +328,6 @@ get_ibus_address_file_name(void) {
char *key = dbus_get_local_machine_id();
snprintf(ans + offset, sizeof(ans) - offset, "/ibus/bus/%s-%s-%s", key, host, disp_num);
dbus_free(key);
free(display);
return ans;
}
@@ -383,12 +387,12 @@ input_context_created(DBusMessage *msg, const char* errmsg, void *data) {
enum Capabilities caps = IBUS_CAP_FOCUS | IBUS_CAP_PREEDIT_TEXT;
if (!glfw_dbus_call_method_no_reply(ibus->conn, IBUS_SERVICE, ibus->input_ctx_path, IBUS_INPUT_INTERFACE, "SetCapabilities", DBUS_TYPE_UINT32, &caps, DBUS_TYPE_INVALID)) return;
ibus->ok = true;
glfw_ibus_set_focused(ibus, false);
glfw_ibus_set_focused(ibus, _glfwFocusedWindow() != NULL);
glfw_ibus_set_cursor_geometry(ibus, 0, 0, 0, 0);
debug("Connected to IBUS daemon for IME input management\n");
}
bool
static bool
setup_connection(_GLFWIBUSData *ibus) {
const char *client_name = "GLFW_Application";
const char *address_file_name = get_ibus_address_file_name();

31
glfw/init.c vendored
View File

@@ -68,6 +68,8 @@ static void terminate(void)
int i;
memset(&_glfw.callbacks, 0, sizeof(_glfw.callbacks));
_glfw_free_clipboard_data(&_glfw.clipboard);
_glfw_free_clipboard_data(&_glfw.primary);
while (_glfw.windowListHead)
glfwDestroyWindow((GLFWwindow*) _glfw.windowListHead);
@@ -380,9 +382,38 @@ GLFWAPI GLFWapplicationclosefun glfwSetApplicationCloseCallback(GLFWapplicationc
return cbfun;
}
GLFWAPI GLFWapplicationclosefun glfwSetSystemColorThemeChangeCallback(GLFWsystemcolorthemechangefun cbfun)
{
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
_GLFW_SWAP_POINTERS(_glfw.callbacks.system_color_theme_change, cbfun);
return cbfun;
}
GLFWAPI GLFWdrawtextfun glfwSetDrawTextFunction(GLFWdrawtextfun cbfun)
{
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
_GLFW_SWAP_POINTERS(_glfw.callbacks.draw_text, cbfun);
return cbfun;
}
GLFWAPI GLFWcurrentselectionfun glfwSetCurrentSelectionCallback(GLFWcurrentselectionfun cbfun)
{
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
_GLFW_SWAP_POINTERS(_glfw.callbacks.get_current_selection, cbfun);
return cbfun;
}
GLFWAPI GLFWhascurrentselectionfun glfwSetHasCurrentSelectionCallback(GLFWhascurrentselectionfun cbfun)
{
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
_GLFW_SWAP_POINTERS(_glfw.callbacks.has_current_selection, cbfun);
return cbfun;
}
GLFWAPI GLFWimecursorpositionfun glfwSetIMECursorPositionCallback(GLFWimecursorpositionfun cbfun)
{
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
_GLFW_SWAP_POINTERS(_glfw.callbacks.get_ime_cursor_position, cbfun);
return cbfun;
}

51
glfw/input.c vendored
View File

@@ -1526,36 +1526,41 @@ GLFWAPI int glfwGetGamepadState(int jid, GLFWgamepadstate* state)
return true;
}
GLFWAPI void glfwSetClipboardString(GLFWwindow* handle UNUSED, const char* string)
{
assert(string != NULL);
void _glfw_free_clipboard_data(_GLFWClipboardData *cd) {
if (cd->mime_types) {
for (size_t i = 0; i < cd->num_mime_types; i++) free((void*)cd->mime_types[i]);
free((void*)cd->mime_types);
}
memset(cd, 0, sizeof(cd[0]));
}
GLFWAPI void glfwGetClipboard(GLFWClipboardType clipboard_type, const char* mime_type, GLFWclipboardwritedatafun write_data, void *object) {
_GLFW_REQUIRE_INIT();
_glfwPlatformSetClipboardString(string);
_glfwPlatformGetClipboard(clipboard_type, mime_type, write_data, object);
}
GLFWAPI const char* glfwGetClipboardString(GLFWwindow* handle UNUSED)
{
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
return _glfwPlatformGetClipboardString();
}
#if defined(_GLFW_X11) || defined(_GLFW_WAYLAND)
GLFWAPI void glfwSetPrimarySelectionString(GLFWwindow* handle UNUSED, const char* string)
{
assert(string != NULL);
GLFWAPI void glfwSetClipboardDataTypes(GLFWClipboardType clipboard_type, const char* const *mime_types, size_t num_mime_types, GLFWclipboarditerfun get_data) {
assert(mime_types != NULL);
assert(get_data != NULL);
_GLFW_REQUIRE_INIT();
_glfwPlatformSetPrimarySelectionString(string);
_GLFWClipboardData *cd = NULL;
switch(clipboard_type) {
case GLFW_CLIPBOARD: cd = &_glfw.clipboard; break;
case GLFW_PRIMARY_SELECTION: cd = &_glfw.primary; break;
}
_glfw_free_clipboard_data(cd);
cd->get_data = get_data;
cd->mime_types = calloc(num_mime_types, sizeof(char*));
cd->num_mime_types = 0;
cd->ctype = clipboard_type;
for (size_t i = 0; i < num_mime_types; i++) {
if (mime_types[i]) {
cd->mime_types[cd->num_mime_types++] = _glfw_strdup(mime_types[i]);
}
}
_glfwPlatformSetClipboard(clipboard_type);
}
GLFWAPI const char* glfwGetPrimarySelectionString(GLFWwindow* handle UNUSED)
{
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
return _glfwPlatformGetPrimarySelectionString();
}
#endif
GLFWAPI monotonic_t glfwGetTime(void)
{
_GLFW_REQUIRE_INIT_OR_RETURN(0);

35
glfw/internal.h vendored
View File

@@ -34,6 +34,9 @@
#endif
#define arraysz(x) (sizeof(x)/sizeof(x[0]))
#define MAX(x, y) __extension__ ({ \
__typeof__ (x) a = (x); __typeof__ (y) b = (y); \
a > b ? a : b;})
#if defined(GLFW_INCLUDE_GLCOREARB) || \
defined(GLFW_INCLUDE_ES1) || \
@@ -52,6 +55,8 @@
#define GLFW_INCLUDE_NONE
#include "glfw3.h"
#define EGL_PRESENT_OPAQUE_EXT 0x31df
#define _GLFW_INSERT_FIRST 0
#define _GLFW_INSERT_LAST 1
@@ -307,6 +312,7 @@ struct _GLFWwndconfig
bool scaleToMonitor;
struct {
bool retina;
int color_space;
char frameName[256];
} ns;
struct {
@@ -438,6 +444,11 @@ struct _GLFWwindow
bool rawMouseMotion;
_GLFWcontext context;
#ifdef _GLFW_WAYLAND
bool swaps_disallowed;
#else
const bool swaps_disallowed;
#endif
struct {
GLFWwindowposfun pos;
@@ -553,6 +564,13 @@ struct _GLFWmutex
_GLFW_PLATFORM_MUTEX_STATE;
};
typedef struct _GLFWClipboardData {
const char** mime_types;
size_t num_mime_types;
GLFWclipboarditerfun get_data;
GLFWClipboardType ctype;
} _GLFWClipboardData;
// Library global data
//
struct _GLFWlibrary
@@ -567,6 +585,8 @@ struct _GLFWlibrary
int refreshRate;
} hints;
_GLFWClipboardData primary, clipboard;
_GLFWerror* errorListHead;
_GLFWcursor* cursorListHead;
_GLFWwindow* windowListHead;
@@ -612,10 +632,13 @@ struct _GLFWlibrary
GLFWmonitorfun monitor;
GLFWjoystickfun joystick;
GLFWapplicationclosefun application_close;
GLFWsystemcolorthemechangefun system_color_theme_change;
GLFWdrawtextfun draw_text;
GLFWcurrentselectionfun get_current_selection;
GLFWhascurrentselectionfun has_current_selection;
GLFWimecursorpositionfun get_ime_cursor_position;
} callbacks;
// This is defined in the window API's platform.h
_GLFW_PLATFORM_LIBRARY_WINDOW_STATE;
// This is defined in the context API's context.h
@@ -665,12 +688,8 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode);
bool _glfwPlatformGetGammaRamp(_GLFWmonitor* monitor, GLFWgammaramp* ramp);
void _glfwPlatformSetGammaRamp(_GLFWmonitor* monitor, const GLFWgammaramp* ramp);
void _glfwPlatformSetClipboardString(const char* string);
const char* _glfwPlatformGetClipboardString(void);
#if defined(_GLFW_X11) || defined(_GLFW_WAYLAND)
void _glfwPlatformSetPrimarySelectionString(const char* string);
const char* _glfwPlatformGetPrimarySelectionString(void);
#endif
void _glfwPlatformSetClipboard(GLFWClipboardType t);
void _glfwPlatformGetClipboard(GLFWClipboardType clipboard_type, const char* mime_type, GLFWclipboardwritedatafun write_data, void *object);
bool _glfwPlatformInitJoysticks(void);
void _glfwPlatformTerminateJoysticks(void);
@@ -846,3 +865,5 @@ void _glfwPlatformUpdateTimer(unsigned long long timer_id, monotonic_t interval,
void _glfwPlatformRemoveTimer(unsigned long long timer_id);
char* _glfw_strdup(const char* source);
void _glfw_free_clipboard_data(_GLFWClipboardData *cd);

View File

@@ -10,77 +10,123 @@
#include <strings.h>
#include <string.h>
static const char *DESKTOP_SERVICE = "org.freedesktop.portal.Desktop";
static const char *DESKTOP_PATH = "/org/freedesktop/portal/desktop";
static const char *DESKTOP_INTERFACE = "org.freedesktop.portal.Settings";
static const char *GNOME_DESKTOP_NAMESPACE = "org.gnome.desktop.interface";
#define DESKTOP_SERVICE "org.freedesktop.portal.Desktop"
#define DESKTOP_PATH "/org/freedesktop/portal/desktop"
#define DESKTOP_INTERFACE "org.freedesktop.portal.Settings"
#define GNOME_DESKTOP_NAMESPACE "org.gnome.desktop.interface"
#define FDO_DESKTOP_NAMESPACE "org.freedesktop.appearance"
#define FDO_APPEARANCE_KEY "color-scheme"
static char theme_name[64] = {0};
static char theme_name[128] = {0};
static int theme_size = -1;
static bool gnome_cursor_theme_read = false, gnome_cursor_size_read = false;
static uint32_t appearance = 0;
static bool is_gnome = false;
static bool cursor_theme_changed = false;
static bool
parse_dbus_message_for_type(DBusMessage *const reply, const char *errmsg, const int type, void *value) {
DBusMessageIter iter[3];
dbus_message_iter_init(reply, &iter[0]);
#define FAIL { _glfwInputError(GLFW_PLATFORM_ERROR, "%s", errmsg); return false; }
if (dbus_message_iter_get_arg_type(&iter[0]) != DBUS_TYPE_VARIANT) FAIL;
dbus_message_iter_recurse(&iter[0], &iter[1]);
if (dbus_message_iter_get_arg_type(&iter[1]) != DBUS_TYPE_VARIANT) FAIL;
dbus_message_iter_recurse(&iter[1], &iter[2]);
if (dbus_message_iter_get_arg_type(&iter[2]) != type) FAIL;
dbus_message_iter_get_basic(&iter[2], value);
return true;
#undef FAIL
int
glfw_current_system_color_theme(void) {
return appearance;
}
#define HANDLER(name) void name(DBusMessage *msg, const char* errmsg, void *data) { \
#define HANDLER(name) static void name(DBusMessage *msg, const char* errmsg, void *data) { \
(void)data; \
if (errmsg) { \
_glfwInputError(GLFW_PLATFORM_ERROR, "%s: failed with error: %s", #name, errmsg); \
return; \
}
HANDLER(on_gnome_cursor_theme_read)
const char *name;
if (!parse_dbus_message_for_type(msg, "Failed to get cursor theme name from reply", DBUS_TYPE_STRING, &name)) return;
if (name && name[0]) {
gnome_cursor_theme_read = true;
strncpy(theme_name, name, sizeof(theme_name) - 1);
if (gnome_cursor_size_read) _glfwPlatformChangeCursorTheme();
static void
process_fdo_setting(const char *key, DBusMessageIter *value) {
if (strcmp(key, FDO_APPEARANCE_KEY) == 0) {
if (dbus_message_iter_get_arg_type(value) == DBUS_TYPE_UINT32) {
dbus_message_iter_get_basic(value, &appearance);
if (appearance > 2) appearance = 0;
}
}
}
HANDLER(on_gnome_cursor_size_read)
int32_t sz;
if (!parse_dbus_message_for_type(msg, "Failed to get cursor theme size from reply", DBUS_TYPE_INT32, &sz)) return;
gnome_cursor_size_read = true;
theme_size = sz;
if (gnome_cursor_theme_read) _glfwPlatformChangeCursorTheme();
}
#undef HANDLER
static bool
call_read(DBusConnection *session_bus, dbus_pending_callback callback, const char *namespace, const char *key) {
return glfw_dbus_call_method_with_reply(
session_bus, DESKTOP_SERVICE, DESKTOP_PATH, DESKTOP_INTERFACE, "Read", DBUS_TIMEOUT_USE_DEFAULT,
callback, NULL, DBUS_TYPE_STRING, &namespace, DBUS_TYPE_STRING, &key, DBUS_TYPE_INVALID);
}
static void
get_from_gnome(void) {
theme_size = 32;
DBusConnection *session_bus = glfw_dbus_session_bus();
if (session_bus) {
const char *theme_key = "cursor-theme";
call_read(session_bus, on_gnome_cursor_theme_read, GNOME_DESKTOP_NAMESPACE, theme_key);
const char *size_key = "cursor-size";
call_read(session_bus, on_gnome_cursor_size_read, GNOME_DESKTOP_NAMESPACE, size_key);
process_gnome_setting(const char *key, DBusMessageIter *value) {
if (strcmp(key, "cursor-size") == 0) {
if (dbus_message_iter_get_arg_type(value) == DBUS_TYPE_INT32) {
int32_t sz;
dbus_message_iter_get_basic(value, &sz);
if (sz > 0 && sz != theme_size) {
theme_size = sz;
cursor_theme_changed = true;
}
}
} else if (strcmp(key, "cursor-theme") == 0) {
if (dbus_message_iter_get_arg_type(value) == DBUS_TYPE_STRING) {
const char *name;
dbus_message_iter_get_basic(value, &name);
if (name) {
strncpy(theme_name, name, sizeof(theme_name) - 1);
cursor_theme_changed = true;
}
}
}
}
static void
process_settings_dict(DBusMessageIter *array_iter, void(process_setting)(const char *, DBusMessageIter*)) {
DBusMessageIter item_iter, value_iter;
while (dbus_message_iter_get_arg_type(array_iter) == DBUS_TYPE_DICT_ENTRY) {
dbus_message_iter_recurse(array_iter, &item_iter);
if (dbus_message_iter_get_arg_type(&item_iter) == DBUS_TYPE_STRING) {
const char *key;
dbus_message_iter_get_basic(&item_iter, &key);
if (dbus_message_iter_next(&item_iter) && dbus_message_iter_get_arg_type(&item_iter) == DBUS_TYPE_VARIANT) {
dbus_message_iter_recurse(&item_iter, &value_iter);
process_setting(key, &value_iter);
}
}
if (!dbus_message_iter_next(array_iter)) break;
}
}
HANDLER(process_desktop_settings)
cursor_theme_changed = false;
DBusMessageIter root, array, item, settings;
dbus_message_iter_init(msg, &root);
#define die(...) { _glfwInputError(GLFW_PLATFORM_ERROR, __VA_ARGS__); return; }
if (dbus_message_iter_get_arg_type(&root) != DBUS_TYPE_ARRAY) die("Reply to request for desktop settings is not an array");
dbus_message_iter_recurse(&root, &array);
while (dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_DICT_ENTRY) {
dbus_message_iter_recurse(&array, &item);
if (dbus_message_iter_get_arg_type(&item) == DBUS_TYPE_STRING) {
const char *namespace;
dbus_message_iter_get_basic(&item, &namespace);
if (dbus_message_iter_next(&item) && dbus_message_iter_get_arg_type(&item) == DBUS_TYPE_ARRAY) {
dbus_message_iter_recurse(&item, &settings);
if (strcmp(namespace, FDO_DESKTOP_NAMESPACE) == 0) {
process_settings_dict(&settings, process_fdo_setting);
} else if (is_gnome && strcmp(namespace, GNOME_DESKTOP_NAMESPACE) == 0) {
process_settings_dict(&settings, process_gnome_setting);
}
}
}
if (!dbus_message_iter_next(&array)) break;
}
#undef die
if (cursor_theme_changed) _glfwPlatformChangeCursorTheme();
}
#undef HANDLER
static bool
read_desktop_settings(DBusConnection *session_bus) {
DBusMessage *msg = dbus_message_new_method_call(DESKTOP_SERVICE, DESKTOP_PATH, DESKTOP_INTERFACE, "ReadAll");
if (!msg) return false;
DBusMessageIter iter, array_iter;
dbus_message_iter_init_append(msg, &iter);
if (!dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "s", &array_iter)) { dbus_message_unref(msg); return false; }
if (!dbus_message_iter_close_container(&iter, &array_iter)) { dbus_message_unref(msg); return false; }
bool ok = call_method_with_msg(session_bus, msg, DBUS_TIMEOUT_USE_DEFAULT, process_desktop_settings, NULL);
dbus_message_unref(msg);
return ok;
}
void
glfw_current_cursor_theme(const char **theme, int *size) {
@@ -100,10 +146,58 @@ get_cursor_theme_from_env(void) {
}
}
static void
on_color_scheme_change(DBusMessage *message) {
DBusMessageIter iter[2];
dbus_message_iter_init (message, &iter[0]);
int current_type;
while ((current_type = dbus_message_iter_get_arg_type (&iter[0])) != DBUS_TYPE_INVALID) {
if (current_type == DBUS_TYPE_VARIANT) {
dbus_message_iter_recurse(&iter[0], &iter[1]);
if (dbus_message_iter_get_arg_type(&iter[1]) == DBUS_TYPE_UINT32) {
uint32_t val = 0;
dbus_message_iter_get_basic(&iter[1], &val);
if (val > 2) val = 0;
if (val != appearance) {
appearance = val;
if (_glfw.callbacks.system_color_theme_change) {
_glfw.callbacks.system_color_theme_change(appearance);
}
}
}
break;
}
dbus_message_iter_next(&iter[0]);
}
}
static DBusHandlerResult
setting_changed(DBusConnection *conn UNUSED, DBusMessage *msg, void *user_data UNUSED) {
/* printf("session_bus settings_changed invoked interface: %s member: %s\n", dbus_message_get_interface(msg), dbus_message_get_member(msg)); */
if (dbus_message_is_signal(msg, DESKTOP_INTERFACE, "SettingChanged")) {
const char *namespace = NULL, *key = NULL;
if (glfw_dbus_get_args(msg, "Failed to get namespace and key from SettingChanged notification signal", DBUS_TYPE_STRING, &namespace, DBUS_TYPE_STRING, &key, DBUS_TYPE_INVALID)) {
if (strcmp(namespace, FDO_DESKTOP_NAMESPACE) == 0) {
if (strcmp(key, FDO_APPEARANCE_KEY) == 0) {
on_color_scheme_change(msg);
}
}
}
}
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
void
glfw_initialize_desktop_settings(void) {
get_cursor_theme_from_env();
const char *desktop = getenv("XDG_CURRENT_DESKTOP");
bool is_gnome = desktop && strncasecmp(desktop, "GNOME", sizeof("GNOME") - 1) == 0;
if (is_gnome) get_from_gnome();
is_gnome = desktop && strstr(desktop, "GNOME");
DBusConnection *session_bus = glfw_dbus_session_bus();
if (session_bus) {
if (!read_desktop_settings(session_bus)) _glfwInputError(GLFW_PLATFORM_ERROR, "Failed to read desktop settings, make sure you have the desktop portal running.");
dbus_bus_add_match(session_bus, "type='signal',interface='" DESKTOP_INTERFACE "',member='SettingChanged'", NULL);
dbus_connection_add_filter(session_bus, setting_changed, NULL, NULL);
}
}

View File

@@ -12,3 +12,4 @@
void glfw_initialize_desktop_settings(void);
void glfw_current_cursor_theme(const char **theme, int *size);
int glfw_current_system_color_theme(void);

View File

@@ -77,7 +77,8 @@
"unstable/idle-inhibit/idle-inhibit-unstable-v1.xml",
"unstable/xdg-decoration/xdg-decoration-unstable-v1.xml",
"unstable/primary-selection/primary-selection-unstable-v1.xml",
"unstable/text-input/text-input-unstable-v3.xml"
"unstable/text-input/text-input-unstable-v3.xml",
"staging/xdg-activation/xdg-activation-v1.xml"
],
"sources": [
"wl_init.c",

11
glfw/window.c vendored
View File

@@ -71,7 +71,7 @@ void _glfwInputWindowFocus(_GLFWwindow* window, bool focused)
_glfw.focusedWindowId = window->id;
}
_GLFWwindow* _glfwFocusedWindow() {
_GLFWwindow* _glfwFocusedWindow(void) {
if (_glfw.focusedWindowId) {
_GLFWwindow *w = _glfw.windowListHead;
while (w) {
@@ -332,6 +332,8 @@ void glfwDefaultWindowHints(void)
// The default is to use full Retina resolution framebuffers
_glfw.hints.window.ns.retina = true;
// use the default colorspace assigned by the system
_glfw.hints.window.ns.color_space = 0;
}
GLFWAPI void glfwWindowHint(int hint, int value)
@@ -412,6 +414,9 @@ GLFWAPI void glfwWindowHint(int hint, int value)
case GLFW_COCOA_RETINA_FRAMEBUFFER:
_glfw.hints.window.ns.retina = value ? true : false;
return;
case GLFW_COCOA_COLOR_SPACE:
_glfw.hints.window.ns.color_space = value;
return;
case GLFW_COCOA_GRAPHICS_SWITCHING:
_glfw.hints.context.nsgl.offline = value ? true : false;
return;
@@ -1062,6 +1067,10 @@ GLFWAPI bool glfwIsFullscreen(GLFWwindow* wh, unsigned int flags) {
return _glfwPlatformIsFullscreen((_GLFWwindow*)wh, flags);
}
GLFWAPI bool glfwAreSwapsAllowed(const GLFWwindow* wh) {
return !(((_GLFWwindow*)wh)->swaps_disallowed);
}
GLFWAPI void glfwSetWindowUserPointer(GLFWwindow* handle, void* pointer)
{
_GLFWwindow* window = (_GLFWwindow*) handle;

View File

@@ -31,13 +31,13 @@ static void
build_blur_kernel(kernel_type *blur_kernel, const size_t size, kernel_type sigma) {
// 1D Normalized Gaussian
const kernel_type half = size / (kernel_type)2;
kernel_type sum = 0;
for (size_t i = 0; i < size; i++) {
kernel_type f = (i - half);
blur_kernel[i] = (kernel_type)exp(- f * f / sigma);
sum += blur_kernel[i];
}
for (size_t i = 0; i < size; i++) blur_kernel[i] /= sum;
kernel_type sum = 0;
for (size_t i = 0; i < size; i++) {
kernel_type f = (i - half);
blur_kernel[i] = (kernel_type)exp(- f * f / sigma);
sum += blur_kernel[i];
}
for (size_t i = 0; i < size; i++) blur_kernel[i] /= sum;
}
static void
@@ -102,13 +102,34 @@ init_buffer_pair(_GLFWWaylandBufferPair *pair, size_t width, size_t height, unsi
return 2 * pair->size_in_bytes;
}
static bool
window_has_buffer(_GLFWwindow *window, struct wl_buffer *q) {
#define Q(which) if (decs.which.buffer.a == q) { decs.which.buffer.a_needs_to_be_destroyed = false; return true; } if (decs.which.buffer.b == q) { decs.which.buffer.b_needs_to_be_destroyed = false; return true; }
Q(left); Q(top); Q(right); Q(bottom);
#undef Q
return false;
}
static void
alloc_buffer_pair(_GLFWWaylandBufferPair *pair, struct wl_shm_pool *pool, uint8_t *data, size_t *offset) {
buffer_release_event(void *data, struct wl_buffer *buffer) {
wl_buffer_destroy(buffer);
_GLFWwindow *window = _glfwWindowForId((uintptr_t)data);
if (window && window_has_buffer(window, buffer)) decs.buffer_destroyed = true;
}
static struct wl_buffer_listener handle_buffer_events = {.release = buffer_release_event};
static void
alloc_buffer_pair(uintptr_t window_id, _GLFWWaylandBufferPair *pair, struct wl_shm_pool *pool, uint8_t *data, size_t *offset) {
pair->data.a = data + *offset;
pair->a = wl_shm_pool_create_buffer(pool, *offset, pair->width, pair->height, pair->stride, WL_SHM_FORMAT_ARGB8888);
pair->a_needs_to_be_destroyed = true;
wl_buffer_add_listener(pair->a, &handle_buffer_events, (void*)window_id);
*offset += pair->size_in_bytes;
pair->data.b = data + *offset;
pair->b = wl_shm_pool_create_buffer(pool, *offset, pair->width, pair->height, pair->stride, WL_SHM_FORMAT_ARGB8888);
pair->b_needs_to_be_destroyed = true;
wl_buffer_add_listener(pair->b, &handle_buffer_events, (void*)window_id);
*offset += pair->size_in_bytes;
pair->front = pair->a; pair->back = pair->b;
pair->data.front = pair->data.a; pair->data.back = pair->data.b;
@@ -287,7 +308,7 @@ create_shm_buffers(_GLFWwindow* window) {
struct wl_shm_pool* pool = wl_shm_create_pool(_glfw.wl.shm, fd, decs.mapping.size);
close(fd);
size_t offset = 0;
#define a(which) alloc_buffer_pair(&decs.which.buffer, pool, decs.mapping.data, &offset)
#define a(which) alloc_buffer_pair(window->id, &decs.which.buffer, pool, decs.mapping.data, &offset)
a(top); a(left); a(bottom); a(right);
#undef a
wl_shm_pool_destroy(pool);
@@ -313,8 +334,8 @@ free_csd_surfaces(_GLFWwindow *window) {
static void
free_csd_buffers(_GLFWwindow *window) {
#define d(which) { \
if (decs.which.buffer.a) wl_buffer_destroy(decs.which.buffer.a); \
if (decs.which.buffer.b) wl_buffer_destroy(decs.which.buffer.b); \
if (decs.which.buffer.a_needs_to_be_destroyed && decs.which.buffer.a) wl_buffer_destroy(decs.which.buffer.a); \
if (decs.which.buffer.b_needs_to_be_destroyed && decs.which.buffer.b) wl_buffer_destroy(decs.which.buffer.b); \
memset(&decs.which.buffer, 0, sizeof(_GLFWWaylandBufferPair)); \
}
d(left); d(top); d(right); d(bottom);
@@ -337,9 +358,10 @@ create_csd_surfaces(_GLFWwindow *window, _GLFWWaylandCSDEdge *s) {
}
#define damage_csd(which, xbuffer) \
wl_surface_attach(decs.which.surface, xbuffer, 0, 0); \
wl_surface_attach(decs.which.surface, (xbuffer), 0, 0); \
wl_surface_damage(decs.which.surface, 0, 0, decs.which.buffer.width, decs.which.buffer.height); \
wl_surface_commit(decs.which.surface)
wl_surface_commit(decs.which.surface); \
if (decs.which.buffer.a == (xbuffer)) { decs.which.buffer.a_needs_to_be_destroyed = false; } else { decs.which.buffer.b_needs_to_be_destroyed = false; }
bool
ensure_csd_resources(_GLFWwindow *window) {
@@ -352,11 +374,14 @@ ensure_csd_resources(_GLFWwindow *window) {
decs.for_window_state.scale != window->wl.scale ||
!decs.mapping.data
);
const bool needs_update = focus_changed || size_changed || !decs.left.surface;
const bool needs_update = focus_changed || size_changed || !decs.left.surface || decs.buffer_destroyed;
debug("CSD: old.size: %dx%d new.size: %dx%d needs_update: %d size_changed: %d buffer_destroyed: %d\n",
decs.for_window_state.width, decs.for_window_state.height, window->wl.width, window->wl.height, needs_update, size_changed, decs.buffer_destroyed);
if (!needs_update) return false;
if (size_changed) {
if (size_changed || decs.buffer_destroyed) {
free_csd_buffers(window);
if (!create_shm_buffers(window)) return false;
decs.buffer_destroyed = false;
}
int32_t x, y, scale = window->wl.scale < 1 ? 1 : window->wl.scale;
@@ -409,7 +434,7 @@ change_csd_title(_GLFWwindow *window) {
void
set_csd_window_geometry(_GLFWwindow *window, int32_t *width, int32_t *height) {
bool has_csd = window->decorated && !window->wl.decorations.serverSide && window->wl.decorations.left.surface && !(window->wl.toplevel_states & TOPLEVEL_STATE_FULLSCREEN);
bool has_csd = window->decorated && !window->wl.decorations.serverSide && window->wl.decorations.left.surface && !(window->wl.current.toplevel_states & TOPLEVEL_STATE_FULLSCREEN);
bool size_specified_by_compositor = *width > 0 && *height > 0;
if (!size_specified_by_compositor) {
*width = window->wl.user_requested_content_size.width;
@@ -431,8 +456,5 @@ set_titlebar_color(_GLFWwindow *window, uint32_t color, bool use_system_color) {
decs.use_custom_titlebar_color = use_custom_color;
decs.titlebar_color = color;
}
if (window->decorated && decs.top.surface) {
update_title_bar(window);
damage_csd(top, decs.top.buffer.front);
}
change_csd_title(window);
}

123
glfw/wl_init.c vendored
View File

@@ -54,6 +54,8 @@
#endif
#define debug(...) if (_glfw.hints.init.debugRendering) fprintf(stderr, __VA_ARGS__);
static int min(int n1, int n2)
{
return n1 < n2 ? n1 : n2;
@@ -96,9 +98,8 @@ static void pointerHandleEnter(void* data UNUSED,
if (!window)
return;
}
window->wl.decorations.focus = focus;
_glfw.wl.serial = serial;
_glfw.wl.serial = serial; _glfw.wl.input_serial = serial;
_glfw.wl.pointerFocus = window;
window->wl.hovered = true;
@@ -142,10 +143,19 @@ static void setCursor(GLFWCursorShape shape, _GLFWwindow* window)
if (!image)
return;
if (image->width % scale || image->height % scale) {
static uint32_t warned_width = 0, warned_height = 0;
if (warned_width != image->width || warned_height != image->height) {
_glfwInputError(GLFW_PLATFORM_ERROR, "WARNING: Cursor image size: %dx%d is not a multiple of window scale: %d. This will"
" cause some compositors such as GNOME to crash. See https://github.com/kovidgoyal/kitty/issues/4878", image->width, image->height, scale);
warned_width = image->width; warned_height = image->height;
}
}
buffer = wl_cursor_image_get_buffer(image);
if (!buffer)
return;
debug("Calling wl_pointer_set_cursor in setCursor with surface: %p\n", (void*)surface);
wl_pointer_set_cursor(_glfw.wl.pointer, _glfw.wl.serial,
surface,
image->hotspot_x / scale,
@@ -243,7 +253,7 @@ static void pointerHandleButton(void* data UNUSED,
window->wl.decorations.last_click_on_top_decoration_at = monotonic();
if (window->wl.decorations.last_click_on_top_decoration_at - last_click_at <= _glfwPlatformGetDoubleClickInterval(window)) {
window->wl.decorations.last_click_on_top_decoration_at = 0;
if (window->wl.toplevel_states & TOPLEVEL_STATE_MAXIMIZED)
if (window->wl.current.toplevel_states & TOPLEVEL_STATE_MAXIMIZED)
xdg_toplevel_unset_maximized(window->wl.xdg.toplevel);
else
xdg_toplevel_set_maximized(window->wl.xdg.toplevel);
@@ -301,7 +311,7 @@ static void pointerHandleButton(void* data UNUSED,
if (window->wl.decorations.focus != CENTRAL_WINDOW)
return;
_glfw.wl.serial = serial;
_glfw.wl.serial = serial; _glfw.wl.input_serial = serial;
/* Makes left, right and middle 0, 1 and 2. Overall order follows evdev
* codes. */
@@ -331,20 +341,83 @@ static void pointerHandleAxis(void* data UNUSED,
assert(axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL ||
axis == WL_POINTER_AXIS_VERTICAL_SCROLL);
if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL)
x = -wl_fixed_to_double(value);
else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL)
y = -wl_fixed_to_double(value);
if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) {
if (window->wl.axis_discrete_count.x) {
window->wl.axis_discrete_count.x--;
return;
}
x = -wl_fixed_to_double(value) * (window->wl.scale);
}
else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL) {
if (window->wl.axis_discrete_count.y) {
window->wl.axis_discrete_count.y--;
return;
}
y = -wl_fixed_to_double(value) * (window->wl.scale);
}
_glfwInputScroll(window, x, y, 1, _glfw.wl.xkb.states.modifiers);
}
static void pointerHandleFrame(void* data UNUSED,
struct wl_pointer* pointer UNUSED)
{
_GLFWwindow* window = _glfw.wl.pointerFocus;
if (window) {
window->wl.axis_discrete_count.x = 0;
window->wl.axis_discrete_count.y = 0;
}
}
static void pointerHandleAxisSource(void* data UNUSED,
struct wl_pointer* pointer UNUSED,
uint32_t source UNUSED)
{
}
static void pointerHandleAxisStop(void *data UNUSED,
struct wl_pointer *wl_pointer UNUSED,
uint32_t time UNUSED,
uint32_t axis UNUSED)
{
}
static void pointerHandleAxisDiscrete(void *data UNUSED,
struct wl_pointer *wl_pointer UNUSED,
uint32_t axis,
int32_t discrete)
{
_GLFWwindow* window = _glfw.wl.pointerFocus;
double x = 0.0, y = 0.0;
if (!window)
return;
assert(axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL ||
axis == WL_POINTER_AXIS_VERTICAL_SCROLL);
if (axis == WL_POINTER_AXIS_HORIZONTAL_SCROLL) {
x = -discrete;
window->wl.axis_discrete_count.x++;
}
else if (axis == WL_POINTER_AXIS_VERTICAL_SCROLL) {
y = -discrete;
window->wl.axis_discrete_count.y++;
}
_glfwInputScroll(window, x, y, 0, _glfw.wl.xkb.states.modifiers);
}
static const struct wl_pointer_listener pointerListener = {
pointerHandleEnter,
pointerHandleLeave,
pointerHandleMotion,
pointerHandleButton,
pointerHandleAxis,
pointerHandleFrame,
pointerHandleAxisSource,
pointerHandleAxisStop,
pointerHandleAxisDiscrete,
};
static void keyboardHandleKeymap(void* data UNUSED,
@@ -390,7 +463,7 @@ static void keyboardHandleEnter(void* data UNUSED,
return;
}
_glfw.wl.serial = serial;
_glfw.wl.serial = serial; _glfw.wl.input_serial = serial;
_glfw.wl.keyboardFocusId = window->id;
_glfwInputWindowFocus(window, true);
uint32_t* key;
@@ -443,7 +516,7 @@ static void keyboardHandleKey(void* data UNUSED,
return;
int action = state == WL_KEYBOARD_KEY_STATE_PRESSED ? GLFW_PRESS : GLFW_RELEASE;
_glfw.wl.serial = serial;
_glfw.wl.serial = serial; _glfw.wl.input_serial = serial;
glfw_xkb_handle_key_event(window, &_glfw.wl.xkb, key, action);
if (action == GLFW_PRESS && _glfw.wl.keyboardRepeatRate > 0 && glfw_xkb_should_repeat(&_glfw.wl.xkb, key))
@@ -466,7 +539,7 @@ static void keyboardHandleModifiers(void* data UNUSED,
uint32_t modsLocked,
uint32_t group)
{
_glfw.wl.serial = serial;
_glfw.wl.serial = serial; _glfw.wl.input_serial = serial;
glfw_xkb_update_modifiers(&_glfw.wl.xkb, modsDepressed, modsLatched, modsLocked, 0, 0, group);
}
@@ -504,6 +577,7 @@ static void seatHandleCapabilities(void* data UNUSED,
{
wl_pointer_destroy(_glfw.wl.pointer);
_glfw.wl.pointer = NULL;
if (_glfw.wl.cursorAnimationTimer) toggleTimer(&_glfw.wl.eventLoopData, _glfw.wl.cursorAnimationTimer, 0);
}
if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !_glfw.wl.keyboard)
@@ -515,6 +589,8 @@ static void seatHandleCapabilities(void* data UNUSED,
{
wl_keyboard_destroy(_glfw.wl.keyboard);
_glfw.wl.keyboard = NULL;
_glfw.wl.keyboardFocusId = 0;
if (_glfw.wl.keyRepeatInfo.keyRepeatTimer) toggleTimer(&_glfw.wl.eventLoopData, _glfw.wl.keyRepeatInfo.keyRepeatTimer, 0);
}
}
@@ -571,7 +647,7 @@ static void registryHandleGlobal(void* data UNUSED,
{
if (!_glfw.wl.seat)
{
_glfw.wl.seatVersion = min(4, version);
_glfw.wl.seatVersion = min(5, version);
_glfw.wl.seat =
wl_registry_bind(registry, name, &wl_seat_interface,
_glfw.wl.seatVersion);
@@ -643,6 +719,9 @@ static void registryHandleGlobal(void* data UNUSED,
_glfwSetupWaylandPrimarySelectionDevice();
}
}
else if (strstr(interface, "xdg_activation_v1") != 0) {
_glfw.wl.xdg_activation_v1 = wl_registry_bind(registry, name, &xdg_activation_v1_interface, 1);
}
}
@@ -710,6 +789,10 @@ glfwWaylandCheckForServerSideDecorations(void) {
return has_ssd ? "YES" : "NO";
}
GLFWAPI int glfwGetCurrentSystemColorTheme(void) {
return glfw_current_system_color_theme();
}
//////////////////////////////////////////////////////////////////////////
////// GLFW platform API //////
//////////////////////////////////////////////////////////////////////////
@@ -806,6 +889,14 @@ int _glfwPlatformInit(void)
void _glfwPlatformTerminate(void)
{
if (_glfw.wl.activation_requests.array) {
for (size_t i=0; i < _glfw.wl.activation_requests.sz; i++) {
glfw_wl_xdg_activation_request *r = _glfw.wl.activation_requests.array + i;
if (r->callback) r->callback(NULL, NULL, r->callback_data);
xdg_activation_token_v1_destroy(r->token);
}
free(_glfw.wl.activation_requests.array);
}
_glfwTerminateEGL();
if (_glfw.wl.egl.handle)
{
@@ -850,6 +941,8 @@ void _glfwPlatformTerminate(void)
zwp_idle_inhibit_manager_v1_destroy(_glfw.wl.idleInhibitManager);
if (_glfw.wl.dataSourceForClipboard)
wl_data_source_destroy(_glfw.wl.dataSourceForClipboard);
if (_glfw.wl.dataSourceForPrimarySelection)
zwp_primary_selection_source_v1_destroy(_glfw.wl.dataSourceForPrimarySelection);
for (size_t doi=0; doi < arraysz(_glfw.wl.dataOffers); doi++) {
if (_glfw.wl.dataOffers[doi].id) {
destroy_data_offer(&_glfw.wl.dataOffers[doi]);
@@ -863,6 +956,8 @@ void _glfwPlatformTerminate(void)
zwp_primary_selection_device_v1_destroy(_glfw.wl.primarySelectionDevice);
if (_glfw.wl.primarySelectionDeviceManager)
zwp_primary_selection_device_manager_v1_destroy(_glfw.wl.primarySelectionDeviceManager);
if (_glfw.wl.xdg_activation_v1)
xdg_activation_v1_destroy(_glfw.wl.xdg_activation_v1);
if (_glfw.wl.registry)
wl_registry_destroy(_glfw.wl.registry);
if (_glfw.wl.display)
@@ -871,10 +966,6 @@ void _glfwPlatformTerminate(void)
wl_display_disconnect(_glfw.wl.display);
}
finalizePollData(&_glfw.wl.eventLoopData);
free(_glfw.wl.clipboardString); _glfw.wl.clipboardString = NULL;
free(_glfw.wl.primarySelectionString); _glfw.wl.primarySelectionString = NULL;
free(_glfw.wl.pasteString); _glfw.wl.pasteString = NULL;
}
const char* _glfwPlatformGetVersionString(void)

55
glfw/wl_platform.h vendored
View File

@@ -58,7 +58,9 @@ typedef VkBool32 (APIENTRY *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR
#include "wayland-pointer-constraints-unstable-v1-client-protocol.h"
#include "wayland-idle-inhibit-unstable-v1-client-protocol.h"
#include "wayland-primary-selection-unstable-v1-client-protocol.h"
#include "wayland-primary-selection-unstable-v1-client-protocol.h"
#include "wl_text_input.h"
#include "wayland-xdg-activation-v1-client-protocol.h"
#define _glfw_dlopen(name) dlopen(name, RTLD_LAZY | RTLD_LOCAL)
#define _glfw_dlclose(handle) dlclose(handle)
@@ -102,6 +104,7 @@ typedef struct _GLFWWaylandBufferPair {
struct { uint8_t *a, *b, *front, *back; } data;
bool has_pending_update;
size_t size_in_bytes, width, height, stride;
bool a_needs_to_be_destroyed, b_needs_to_be_destroyed;
} _GLFWWaylandBufferPair;
typedef struct _GLFWWaylandCSDEdge {
@@ -116,17 +119,29 @@ typedef enum WaylandWindowState {
TOPLEVEL_STATE_NONE = 0,
TOPLEVEL_STATE_MAXIMIZED = 1,
TOPLEVEL_STATE_FULLSCREEN = 2,
TOPLEVEL_STATE_RESIZING = 4,
TOPLEVEL_STATE_ACTIVATED = 8,
TOPLEVEL_STATE_TILED_LEFT = 16,
TOPLEVEL_STATE_TILED_RIGHT = 32,
TOPLEVEL_STATE_TILED_TOP = 64,
TOPLEVEL_STATE_TILED_BOTTOM = 128,
TOPLEVEL_STATE_RESIZING = 4,
TOPLEVEL_STATE_ACTIVATED = 8,
TOPLEVEL_STATE_TILED_LEFT = 16,
TOPLEVEL_STATE_TILED_RIGHT = 32,
TOPLEVEL_STATE_TILED_TOP = 64,
TOPLEVEL_STATE_TILED_BOTTOM = 128,
} WaylandWindowState;
typedef struct glfw_wl_xdg_activation_request {
GLFWid window_id;
GLFWactivationcallback callback;
void *callback_data;
uintptr_t request_id;
void *token;
} glfw_wl_xdg_activation_request;
static const WaylandWindowState TOPLEVEL_STATE_DOCKED = TOPLEVEL_STATE_MAXIMIZED | TOPLEVEL_STATE_FULLSCREEN | TOPLEVEL_STATE_TILED_TOP | TOPLEVEL_STATE_TILED_LEFT | TOPLEVEL_STATE_TILED_RIGHT | TOPLEVEL_STATE_TILED_BOTTOM;
enum WaylandWindowPendingState {
PENDING_STATE_TOPLEVEL = 1,
PENDING_STATE_DECORATION = 2
};
// Wayland-specific per-window data
//
@@ -137,6 +152,7 @@ typedef struct _GLFWwindowWayland
bool hovered;
bool transparent;
struct wl_surface* surface;
bool waiting_for_swap_to_commit;
struct wl_egl_window* native;
struct wl_callback* callback;
@@ -168,7 +184,7 @@ typedef struct _GLFWwindowWayland
struct zwp_idle_inhibitor_v1* idleInhibitor;
struct {
bool serverSide;
bool serverSide, buffer_destroyed;
_GLFWdecorationSideWayland focus;
_GLFWWaylandCSDEdge top, left, right, bottom;
@@ -210,9 +226,20 @@ typedef struct _GLFWwindowWayland
int32_t width, height;
} user_requested_content_size;
uint32_t toplevel_states;
bool maximize_on_first_show;
// counters for ignoring axis events following axis_discrete events in the
// same frame along the same axis
struct {
unsigned int x, y;
} axis_discrete_count;
bool surface_configured_once;
uint32_t pending_state;
struct {
int width, height;
uint32_t toplevel_states;
uint32_t decoration_mode;
} current, pending;
} _GLFWwindowWayland;
typedef enum _GLFWWaylandOfferType
@@ -261,13 +288,14 @@ typedef struct _GLFWlibraryWayland
struct zwp_primary_selection_device_manager_v1* primarySelectionDeviceManager;
struct zwp_primary_selection_device_v1* primarySelectionDevice;
struct zwp_primary_selection_source_v1* dataSourceForPrimarySelection;
struct xdg_activation_v1* xdg_activation_v1;
int compositorVersion;
int seatVersion;
struct wl_surface* cursorSurface;
GLFWCursorShape cursorPreviousShape;
uint32_t serial;
uint32_t serial, input_serial;
int32_t keyboardRepeatRate;
monotonic_t keyboardRepeatDelay;
@@ -301,12 +329,14 @@ typedef struct _GLFWlibraryWayland
PFN_wl_egl_window_resize window_resize;
} egl;
struct {
glfw_wl_xdg_activation_request *array;
size_t capacity, sz;
} activation_requests;
EventLoopData eventLoopData;
char* pasteString;
char* clipboardString;
size_t dataOffersCounter;
_GLFWWaylandDataOffer dataOffers[8];
char* primarySelectionString;
} _GLFWlibraryWayland;
// Wayland-specific per-monitor data
@@ -340,6 +370,7 @@ typedef struct _GLFWcursorWayland
void _glfwAddOutputWayland(uint32_t name, uint32_t version);
void _glfwWaylandAfterBufferSwap(_GLFWwindow *window);
void _glfwSetupWaylandDataDevice(void);
void _glfwSetupWaylandPrimarySelectionDevice(void);
void animateCursorImage(id_type timer_id, void *data);

53
glfw/wl_text_input.c vendored
View File

@@ -9,12 +9,15 @@
#include "internal.h"
#include "wayland-text-input-unstable-v3-client-protocol.h"
#include <stdlib.h>
#include <string.h>
#define debug(...) if (_glfw.hints.init.debugKeyboard) printf(__VA_ARGS__);
static struct zwp_text_input_v3* text_input;
static struct zwp_text_input_manager_v3* text_input_manager;
static char *pending_pre_edit = NULL;
static char *current_pre_edit = NULL;
static char *pending_commit = NULL;
static int last_cursor_left = 0, last_cursor_top = 0, last_cursor_width = 0, last_cursor_height = 0;
uint32_t commit_serial = 0;
static void commit(void) {
@@ -47,7 +50,7 @@ static void
send_text(const char *text, GLFWIMEState ime_state) {
_GLFWwindow *w = _glfwFocusedWindow();
if (w && w->callbacks.keyboard) {
GLFWkeyevent fake_ev = {.action = GLFW_PRESS};
GLFWkeyevent fake_ev = {.action = text ? GLFW_PRESS : GLFW_RELEASE};
fake_ev.text = text;
fake_ev.ime_state = ime_state;
w->callbacks.keyboard((GLFWwindow*) w, &fake_ev);
@@ -84,15 +87,26 @@ text_input_delete_surrounding_text(
}
static void
text_input_done(void *data UNUSED, struct zwp_text_input_v3 *txt_input UNUSED, uint32_t serial UNUSED) {
text_input_done(void *data UNUSED, struct zwp_text_input_v3 *txt_input UNUSED, uint32_t serial) {
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);
if (serial > commit_serial) _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: text_input_done serial mismatch, expected=%u got=%u\n", commit_serial, serial);
return;
}
if (pending_pre_edit) {
send_text(pending_pre_edit, GLFW_IME_PREEDIT_CHANGED);
if ((pending_pre_edit == NULL && current_pre_edit == NULL) ||
(pending_pre_edit && current_pre_edit && strcmp(pending_pre_edit, current_pre_edit) == 0)) {
free(pending_pre_edit); pending_pre_edit = NULL;
} else {
free(current_pre_edit);
current_pre_edit = pending_pre_edit;
pending_pre_edit = NULL;
if (current_pre_edit) {
send_text(current_pre_edit, GLFW_IME_PREEDIT_CHANGED);
} else {
// Clear pre-edit text
send_text(NULL, GLFW_IME_WAYLAND_DONE_EVENT);
}
}
if (pending_commit) {
send_text(pending_commit, GLFW_IME_COMMIT_TEXT);
@@ -130,6 +144,7 @@ _glfwWaylandDestroyTextInput(void) {
if (text_input_manager) zwp_text_input_manager_v3_destroy(text_input_manager);
text_input = NULL; text_input_manager = NULL;
free(pending_pre_edit); pending_pre_edit = NULL;
free(current_pre_edit); current_pre_edit = NULL;
free(pending_commit); pending_commit = NULL;
}
@@ -139,15 +154,35 @@ _glfwPlatformUpdateIMEState(_GLFWwindow *w, const GLFWIMEUpdateEvent *ev) {
switch(ev->type) {
case GLFW_IME_UPDATE_FOCUS:
debug("\ntext-input: updating IME focus state, focused: %d\n", ev->focused);
if (ev->focused) zwp_text_input_v3_enable(text_input); else zwp_text_input_v3_disable(text_input);
if (ev->focused) {
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);
} else {
free(pending_pre_edit); pending_pre_edit = NULL;
if (current_pre_edit) {
// Clear pre-edit text
send_text(NULL, GLFW_IME_PREEDIT_CHANGED);
free(current_pre_edit); current_pre_edit = NULL;
}
if (pending_commit) {
free(pending_commit); pending_commit = NULL;
}
zwp_text_input_v3_disable(text_input);
}
commit();
break;
case GLFW_IME_UPDATE_CURSOR_POSITION: {
const int scale = w->wl.scale;
const int left = ev->cursor.left / scale, top = ev->cursor.top / scale, width = ev->cursor.width / scale, height = ev->cursor.height / scale;
debug("\ntext-input: updating cursor position: left=%d top=%d width=%d height=%d\n", left, top, width, height);
zwp_text_input_v3_set_cursor_rectangle(text_input, left, top, width, height);
commit();
if (left != last_cursor_left || top != last_cursor_top || width != last_cursor_width || height != last_cursor_height) {
last_cursor_left = left;
last_cursor_top = top;
last_cursor_width = width;
last_cursor_height = height;
debug("\ntext-input: updating cursor position: left=%d top=%d width=%d height=%d\n", left, top, width, height);
zwp_text_input_v3_set_cursor_rectangle(text_input, left, top, width, height);
commit();
}
}
break;
}

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