Skip to content

Adding iTerm2 and Kitty protocol via timg, wants idea #53

@Moelf

Description

@Moelf

timg_jll is in the pipeline and should land soon, for the moment being:

import timg_jll
function timgshow(io::IO, img_path::AbstractString; 
        is_kitty = !isnothing(get(ENV, "KITTY_WINDOW_ID", nothing)),
        is_iTerm = !isnothing(get(ENV, "ITERM_PROFILE", nothing))
    )
    @info img_path
    s = if is_kitty
        read(`$(timg_jll.timg()) -p k -W --grid=5 $img_path`, String)
    elseif is_iTerm
        read(`$(timg_jll.timg()) -p i -W --grid=5 $img_path`, String)
    else
        read(`$(timg_jll.timg()) -p q -W --grid=5 $img_path`, String)
    end
    print(io, s)
end

yields:
image

on Linux, left is Alacritty and right is Kitty. The quarter-pixel result is okay but whatever. (sadly Alacritty doesn't support Sixel either), but the point is we could have very convincing result for Kitty and iTerm2.

I'd like to know if people are interested in having this and if so, what's the best way to integrate into the existing interface/dispatch routes.

(video is also possible if we really want it:

Peek.2021-05-23.01-53.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions