hackerb9 / lsix

Like "ls", but for images. Shows thumbnails in terminal using sixel graphics.
GNU General Public License v3.0
3.97k stars 129 forks source link

xterm not being recognised as sixel supported. #33

Closed pfr-dev closed 4 years ago

pfr-dev commented 4 years ago

Using xterm on NetBSD 9.0_STABLE. I've set .Xresources to read XTerm*decTerminalID: vt340 lsix was placed in /usr/bin as there is no /usr/local on this system. ImageMagick is also installed.

xterm recognized the script and outputs the error Error: Your terminal does not report having sixel graphics support

lsix

hackerb9 commented 4 years ago

Thank you for the bug report.

Most likely, NetBSD does not build Xterm with sixel support enabled. You will need to recompile it yourself. (I believe the magic incantation you need is './configure --with-sixel-graphics'). You could also ask the NetBSD pkgsrc folks if they'd be willing to add an alternate Xterm which has all the optional bells and whistles enabled.

You didn't mention if you used 'xterm -ti vt340' or 'xrdb -merge', but I'm going to presume, if you're using NetBSD, you know what you're doing.

pfr-dev commented 4 years ago

Ahh you are right. The Xterm that ships with NetBSD is the base xorg version xterm-330 whereas the latest version xterm-344 is in pkgsrc. However I've looked at the pkgsrc version and it doesn't appear to have --enable-sixeloptions enabled in the MakeFile.

I will try ./configure --with-sixel-graphics and see how we go but.... "I'm going to presume, if you're using NetBSD, you know what you're doing." ...Hardly. I did however read the README.md and yes I launched xterm with the correct flags.

hackerb9 commented 4 years ago

Were you able to make it work from pkgsrc?

pfr-dev commented 4 years ago

Hey, sorry, I haven't had time to try all the possible solutions.

I've been lucky enough to have an internet friend and NetBSD dev/contributor have a look at it for me. This is what he said:

"I installed libsixel libX11 libXt luit ImageMagick bash I've modified the Makefile and built xterm with --enable-sixel. It builds, installs and runs but, lsix still fails with the same error."

I will try with --enable-sixel-graphics

Here is the MakeFile he used:

$NetBSD: Makefile,v 1.121 2019/11/03 09:14:21 rillig Exp $

DISTNAME=   xterm-344
CATEGORIES= x11
MASTER_SITES=   ftp://ftp.invisible-island.net/xterm/
EXTRACT_SUFX=   .tgz

MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE=   https://invisible-island.net/xterm/xterm.html
COMMENT=    Latest terminal emulator for the X Window System
LICENSE=    x11

GNU_CONFIGURE=      yes
USE_TOOLS+=     tbl pkg-config

WRKSRC=         ${WRKDIR}/${PKGNAME_NOREV}

CONFIGURE_ARGS+=    --enable-88-color
CONFIGURE_ARGS+=    --enable-256-color
CONFIGURE_ARGS+=    --enable-paste64
CONFIGURE_ARGS+=    --enable-readline-mouse
CONFIGURE_ARGS+=    --enable-sixel

CONFIGURE_ARGS.standard=    # empty
CONFIGURE_ARGS.3d=      --with-Xaw3d
CONFIGURE_ARGS.xpm=     --with-Xaw3d
CONFIGURE_ARGS.neXtaw=      --with-neXtaw
CONFIGURE_ARGS+=        ${${CONFIGURE_ARGS.${XAW_TYPE}}:L}

INSTALLATION_DIRS=  share/applications

.include "../../mk/bsd.prefs.mk"

.if ${X11_TYPE} == "modular"
CONFIGURE_ARGS+=    --disable-imake
CONFIGURE_ARGS+=    --enable-narrowproto
.endif

.if exists(/usr/include/wchar.h)
CONFIGURE_ARGS+=    --enable-wide-chars
.endif

.include "../../x11/libX11/buildlink3.mk"
.include "../../x11/libXt/buildlink3.mk"
###
### For detection of XKB bell extension.
###
BUILDLINK_DEPMETHOD.libxkbfile?=    build
.include "../../x11/libxkbfile/buildlink3.mk"

post-install:
    ${INSTALL_DATA} ${WRKSRC}/xterm.desktop \
        ${DESTDIR}${PREFIX}/share/applications && \
    ${INSTALL_DATA} ${WRKSRC}/uxterm.desktop \
        ${DESTDIR}${PREFIX}/share/applications
    cd ${DESTDIR}${PREFIX}/${PKGMANDIR}/man1 && tbl xterm.1 \
        > xterm.1.tbl && mv xterm.1.tbl xterm.1

.include "options.mk"

.include "../../mk/curses.buildlink3.mk"
.include "../../mk/termcap.buildlink3.mk"
.include "../../sysutils/desktop-file-utils/desktopdb.mk"
.include "../../mk/xaw.buildlink3.mk"
.include "../../graphics/libsixel/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

I'm going to keep trying.. just time poor at the moment. Feel free to close the issue and if I still fail once I get to try build with --enable-sixel-graphics I'll reopen it.

Cheers

hackerb9 commented 4 years ago

According to xterm's ./configure --help, the correct syntax is --enable-sixel-graphics .

If you get it working, do please let me know. And maybe ask the NetBSD pkgsrc folks about maybe building with sixel support by default.

pfr-dev commented 4 years ago

So compiling xterm with --enable-sixel-graphics did the trick.

close_but_no_cigar

However, how can I avoid this montage/font error?

hackerb9 commented 4 years ago

That's a new one on me! I notice you don't have titles under the images, so I'm guessing ImageMagick (montage) was compiled with a default font that doesn't exist. I think you can work around it by changing the font. You'll see that option at the top of lsix.

However, you should try 'montage' on the command line. If it gives the same error, then you should let the NetBSD folks know there's a bug in the ImageMagick package.

pfr-dev commented 4 years ago

I tried changing the font to my system font inside the lsix script (and other installed fonts) but I get the same error. Same if I just run montage on its own.

I'll log an issue with the ImageMagick pkgsrc devs.

hackerb9 commented 4 years ago

Thanks for reporting the bug to pkgsrc. It doesn't even work with the fonts returned by convert -list font?

pfr-dev commented 4 years ago

Ahh THANK YOU! finally got it working :) You've even stated that in the script itself and I completely overlooked it..

it_finally_works_im_happy_now

hackerb9 commented 4 years ago

Hooray!