lusingander / serie

A rich git commit graph in your terminal, like magic 📚
MIT License
435 stars 13 forks source link

Setting the default image protocol #10

Closed williamdes closed 3 months ago

williamdes commented 3 months ago

Could you use kitty as a default value for non MacOs builds ?

DavidGamba commented 3 months ago

Better if you could auto-detect kitty and use it, even in MacOS. Each kitty window exports the KITTY_WINDOW_ID env var. Using that you can determine you are using a kitty terminal.

lusingander commented 3 months ago

I don't think it's something that should be set on an OS basis.

There are two possible approaches:

I think user config is enough, I don't really like auto detection.

williamdes commented 3 months ago

Automatically detects available protocols

Seems like the best option, rather than having to let the user override it

If iTerm is not available on Linux, then change the default value ? Using something like https://github.com/zed-industries/zed/blob/f6012cd86e1a09715a5bb3056c855fc42dd95814/crates/paths/src/paths.rs#L18

lusingander commented 3 months ago

I don't think the choice of OS and image protocol has anything to do with it. iTerm2 is a Mac application, but applications that use the protocols defined by iTerm2 are not relevant.

uncenter commented 3 months ago

You could use something like https://github.com/sxyazi/yazi/blob/7a380c2f0fdaec87992836e21dc8b6cd251af980/yazi-adapter/src/emulator.rs#L31-L158 to detect the terminal and then use a supported protocol for that terminal?

alerque commented 3 months ago

Better if you could auto-detect kitty and use it, even in MacOS.

As a general rule I don't like auto detection either, but that's because it tends to limit what the user can do explicitly. This is not one of those cases. Of course you have to have a default, this isn't something users can configure at will. It is something that either works or doesn't dependence on the terminal and there is no reason at all not to just detect Kitty and switch if that's what is being used. Of course this would be lower priority than the config or explicit CLI flag, but not working at all out of the box on a supported terminal is a lot less than ideal. Additionally config would not be simple to implement because many users (myself included) use more than one terminal and configuring tools to do different things in different terminals is not something moste tooling config even considers. To do that properly serie would have to allow per-terminal-emulator configs anyway, so changing the default protocol to be 'auto' if not set for a specific term just makes sense.

lusingander commented 3 months ago

I see, that may well be true. Feel free to create a pull request, and it might get merged.

At least for now, it seems like it would be enough to simply detect kitty.