Closed eylles closed 2 years ago
@trappedinspacetime this is some work i had pending but didn't push because i was busy with other stuff.
Hmmm it may be possible to not use bash, apparently modification of stty settings can be used to read answer sequences, but i'm too smooth brained to understand well what is going on.
@eylles I'm not a bash
expert but I like using bash
scripts. I prefer using bash
in scripting. I came across the following bug https://github.com/hackerb9/lsix/issues/54, so I didn't get far. I also have a health issue, so I may lag behind.
I met an image-viewer
script here https://github.com/vifm/vifm/issues/419#issuecomment-485918513
Hmmm it may be possible to not use bash, apparently modification of stty settings can be used to read answer sequences, but i'm too smooth brained to understand well what is going on.
Back in the olden days, before we had bash
to do the heavy lifting, we used extremely ugly kludges via the stty
command in the Bourne shell. However, stty was so brittle that people would often write a custom routine in C to handle the termios ioctl
.
To get a flavour of what we had to do, here's an implementation I wrote in Python:
While it works, I am thankful that bash
exists and I don't have to wrap my brain around such ugliness anymore.
this is a branch i was working on trying to add stuff from lsix to have detection of terminal size in cols and pixels, from looking at how it gets the terminal properties.
the change to bash is since i have not found any way to properly query the properties and parse them in pure posix shell, another important this is the need to check the terminal cells and rows against the X and Y pixels to calculate the X and Y pixel density of each cell for proper sixel sizing, also getting the background to properly display the images with montage on a properly colored background.
the commands to detect the properties along some echos to show them:
a lot of this was taken directly from lsix
ideally some of these could be cached to not have the need for constantly queriying the properties on every image.