-
-
Notifications
You must be signed in to change notification settings - Fork 990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace the deprecated imghdr module #6076
Conversation
On Tue, Feb 28, 2023 at 08:33:06PM -0800, page-down wrote:
When running `. /tests.py mypy`, it shows the following message and fails (exit code 1).
```log
DeprecationWarning: 'imghdr' is deprecated and slated for removal in Python 3.13
```
I noticed that the relevant remote control commands cannot be executed via shortcuts.
```shell
kitty -o 'map f1 remote_control set-window-logo /path/to/png'
```
This is on my TODO list I never got around to porting it after changing
RC to Go.
```log
kitty.rc.base.StreamError: No stream_id in rc payload
```
Since this is related to the remote control protocol, could you update the documentation if you have some time? (And maybe the async part, such as `async_id`)
https://sw.kovidgoyal.net/kitty/rc_protocol/
The detailed traceback is printed before the `Press e to see detailed traceback ...` line. This minor issue is not important.
I see the use of `NamedTemporaryFile` in setting the background image and logo, is it possible to use SHM to avoid higher file system IO (writes) when setting dynamically generated images in high frequency?
It doesn't actually need a file at all, its just there for code re-use.
Is it intentional not to reload the background image after reloading the configuration?
I dont think so would have to look at the code to be sure.
|
On Tue, Feb 28, 2023 at 08:33:06PM -0800, page-down wrote:
When running `. /tests.py mypy`, it shows the following message and fails (exit code 1).
```log
DeprecationWarning: 'imghdr' is deprecated and slated for removal in Python 3.13
```
I noticed that the relevant remote control commands cannot be executed via shortcuts.
```shell
kitty -o 'map f1 remote_control set-window-logo /path/to/png'
```
```log
kitty.rc.base.StreamError: No stream_id in rc payload
```
Since this is related to the remote control protocol, could you update the documentation if you have some time? (And maybe the async part, such as `async_id`)
https://sw.kovidgoyal.net/kitty/rc_protocol/
The detailed traceback is printed before the `Press e to see detailed traceback ...` line. This minor issue is not important.
I see the use of `NamedTemporaryFile` in setting the background image and logo, is it possible to use SHM to avoid higher file system IO (writes) when setting dynamically generated images in high frequency?
Actually NamedTemporaryFile here is a dummy class, it doesnt touch the
filesystem.
|
In fact, in cat image.png | kitten @ set-window-logo /dev/stdin
I noticed the relevant codes.
|
On Tue, Feb 28, 2023 at 09:21:34PM -0800, page-down wrote:
>> ... is it possible to use SHM ...
>
> It doesn't actually need a file at all, its just there for code re-use.
In fact, in `handle_streamed_data` -> `StreamInFlight`, `handle_data` is still writing to the temporary file.
Yes of course, actually changing the image requires a file, since
getting libpng to load data from memory is a huge pain. I meant the code
path for clearing the image. We cant really use SHM as there are lots of
systems where SHM is not turned on or broken, so one would have to write
code to very carefully check and fallback.
|
Although rather than SHM one can use fmemopen assuming it works on macOS |
Thanks for the explanation, it's not easy to create a memory file system under macOS. One use case is to dynamically generate a progress bar or other background task information for the current window. |
When running
. /tests.py mypy
, it shows the following message and fails (exit code 1).I noticed that the relevant remote control commands cannot be executed via shortcuts.
kitty -o 'map f1 remote_control set-window-logo /path/to/png'
Since this is related to the remote control protocol, could you update the documentation if you have some time? (And maybe the async part, such as
async_id
)https://sw.kovidgoyal.net/kitty/rc_protocol/
The detailed traceback is printed before the
Press e to see detailed traceback ...
line. This minor issue is not important.I see the use of
NamedTemporaryFile
in setting the background image and logo, is it possible to use SHM to avoid higher file system IO (writes) when setting dynamically generated images in high frequency?Is it intentional not to reload the background image after reloading the configuration?