カテゴリー
【シェルコマンド】iTerm2/Kitty/Sixel graphic protocolを使ってWezTermからSSH経由での画像表示を試す
※ 当ページには【広告/PR】を含む場合があります。
2024/06/12
Sixel
WezTerm組込のiTerm2プロトコルを使った画像描画
$ wezterm imgcat cat.jpg
Kittyグラフィックプロトコルを利用する
$ curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin
/Applications/kitty.app
~/.local/kitty.app
$ . ~/.local/kitty.app/bin/kitty
$ sudo ln -sf ~/.local/kitty.app/bin/kitty ~/.local/kitty.app/bin/kitten /usr/bin/
$ kitty +kitten icat cat.jpg
icat
Raspberry PiにFlatPakからWezTermをインストール(現状は失敗!)
FlatPakからラズパイにWezTermをインストールできる?
$ sudo apt install flatpak
$ sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
$ flatpak install flathub org.wezfurlong.wezterm
Note that the directories
'/var/lib/flatpak/exports/share'
'/home/*********/.local/share/flatpak/exports/share'
are not in the search path set by the XDG_DATA_DIRS environment variable, so
applications installed by Flatpak may not appear on your desktop until the
session is restarted.
Looking for matches…
error: Nothing matches org.wezfurlong.wezterm in remote flathub
Important note: As of March 2021, Raspberry Pi computers still ship with the 32-bit version of Raspberry Pi OS.
However Flathub started phasing out support for that architecture.
If you consider Flathub as an important source of applications, it is recommended to use Raspberry Pi OS 64-bit as newer applications are more likely to be available for that platform.
$ flatpak install flathub org.wezfurlong.wezterm
Note that the directories
'/var/lib/flatpak/exports/share'
'/home/**********/.local/share/flatpak/exports/share'
are not in the search path set by the XDG_DATA_DIRS environment variable, so
applications installed by Flatpak may not appear on your desktop until the
session is restarted.
Looking for matches?
error: Nothing matches org.wezfurlong.wezterm in remote flathub
$ curl -fsSL https://apt.fury.io/wez/gpg.key | sudo gpg --yes --dearmor -o /usr/share/keyrings/wezterm-fury.gpg
$ echo 'deb [signed-by=/usr/share/keyrings/wezterm-fury.gpg] https://apt.fury.io/wez/ * *' | sudo tee /etc/apt/sources.list.d/wezterm.list
$ sudo apt update
#...中略
N: Skipping acquire of configured file '*/binary-armhf/Packages' as repository 'https://apt.fury.io/wez * InRelease' doesn't support architecture 'armhf'
#...
$ sudo apt install wezterm
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package wezterm
armhf
dpkg
Raspberry PiにKittyを導入しSSH越しに画像をターミナル表示させる
Kitty
$ curl -L https://sw.kovidgoyal.net/kitty/installer.sh | sh /dev/stdin
$ sudo ln -sf ~/.local/kitty.app/bin/kitty ~/.local/kitty.app/bin/kitten /usr/bin/
$ kitten
-bash: /usr/bin/kitten: No such file or directory
$ kitty
-bash: /usr/bin/kitty: No such file or directory
$ file kitty
kitty: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=30223e137a4e1427a05d857d5fce6cccc61cd922, for GNU/Linux 3.7.0, stripped
aarch64
$ uname -a
Linux raspberrypi 6.1.21-v8+ #1642 SMP PREEMPT Mon Apr 3 17:24:16 BST 2023 aarch64 GNU/Linux
$ arch
aarch64
$ ldd kitty
not a dynamic executable
$ dpkg --print-architecture
armhf
aarch64
armhf
$ file /usr/bin/bash
/usr/bin/bash: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, BuildID[sha1]=f12e6d40fb262ad0037b6ec43162208b76d4da71, for GNU/Linux 3.2.0, stripped
$ ldd /usr/bin/bash
/usr/lib/arm-linux-gnueabihf/libarmmem-${PLATFORM}.so => /usr/lib/arm-linux-gnueabihf/libarmmem-v8l.so (0xf7a86000)
libtinfo.so.6 => /lib/arm-linux-gnueabihf/libtinfo.so.6 (0xf7a41000)
libdl.so.2 => /lib/arm-linux-gnueabihf/libdl.so.2 (0xf7a2d000)
libc.so.6 => /lib/arm-linux-gnueabihf/libc.so.6 (0xf78da000)
/lib/ld-linux-armhf.so.3 (0xf7a9b000)
aptからKittyをパッケージインストールする
$ sudo apt install kitty
$ sudo apt install imagemagick
kitty/kitten
$ kitty +kitten icat test-2.jpg
#👇何も起こらない...
$ DISPLAY=:0.0 kitty +kitten icat test-2.jpg
#👇何も起こらない...
$ DISPLAY=:0.0 kitty +kitten icat --transfer-mode=file test-2.jpg
#👇何も起こらない...
kitten icat
img2sixelコマンドでSSH接続中のRaspberry PIからターミナルに画像表示
libsixel
$ sudo apt install libsixel*
img2sixel
Sixel graphic protocol
$ img2sixel <表示させたい画像ファイル>
まとめ
記事を書いた人
ナンデモ系エンジニア
主にAngularでフロントエンド開発することが多いです。 開発環境はLinuxメインで進めているので、シェルコマンドも多用しております。 コツコツとプログラミングするのが好きな人間です。
カテゴリー