Implement SIXEL types with custom option#3092
Implement SIXEL types with custom option#3092SapphirusBeryl wants to merge 5 commits intoranger:masterfrom
Conversation
Modifies the SixelImageDisplayer class to provide multiple processor backends as well as allowing the user to specify their own via setting a command-line option via `sixel_custom` in rc.conf. Implements a new enum type `SixelType(StrEnum)` to define a sixel type.
Symbols example is broken, so demonstrate custom option with colour transformations, instead.
Pass `--passthrough none` to allow chafa to render sixels within ranger under tmux. There's no regression in functionality found in other terminals as a result. e.g. foot
6a8bbf5 to
dc58b5c
Compare
Since chafa moves the cursor around when writing to stdout, obtain the cursor position from curses, then hide the cursor and reset to a proper position. This fixes a bug wherein selecting the last item results in rendering the selection at an arbitrary position in the terminal.
toonn
left a comment
There was a problem hiding this comment.
I like this, though I haven't actually reviewed it yet, just wanted to comment that changing the default is on the table if Chafa actually improves usability considerably.
80ca63f to
eda3789
Compare
I've noticed a considerable difference in usability with chafa, though I wouldn't want to necessarily impose a one-size-fits-all solution for SIXEL, since there tends to be a lot of variability in implementation between different terminal emulators and multiplexers as well as the processor libraries/applications. |
eda3789 to
2bb78d9
Compare
Workaround for deadlock regression with chafa 1.16.0-1.16.1
Modifies the SixelImageDisplayer class to provide multiple processor backends as well as allowing the user to specify their own via setting a command-line option via sixel_custom in rc.conf.
ISSUE TYPE
RUNTIME ENVIRONMENT
CHECKLIST
CONTRIBUTINGdocument has been read [REQUIRED]DESCRIPTION
Provides the ability to set multiple different SIXEL processor types, as well as two new processor types in addition to imagemagick.
A user may specify one of the following option types:
imagemagickchafacustomimagemagickis set as the default to preserve the current behaviour.Custom option in particular allows the user to set a custom command-line to utilize
their own SIXEL processor to output into the terminal. That can be set with
sixel_custom.String substitution options are provided to allow the user to specify a path, width&height, etc..
MOTIVATION AND CONTEXT
The inability to set a different SIXEL processor for use with ranger.
Since imagemagick is noticeably slow when navigating through directories of large images (e.g. background wallpapers, photographs, etc.), I decided to implement support for multiple processor types.
chafais noticeably faster by comparison and doesn't require OpenCL acceleration to work.Since a custom option is also desirable, I decided to take a shot at that. Input is very much welcome on the approach I've taken. Not exactly sure if string substitution with
str.format(..)is the appropriate way to approach this problem. It's simple, however, and takes up almost no footprint.Solves and fixes these issues with #2466 having been merged:
TESTING
Doesn't affect anything other than the SIXEL image preview functionality.
Both
imagemagick,chafa, and thecustomoptions have been tested as working.