Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ターミナルマルチプレクサのtmuxでSixel

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers.

 ターミナルマルチプレクサのtmuxでSixel

Avatar for Kenichiro MATOHARA

Kenichiro MATOHARA

November 19, 2023
Tweet

More Decks by Kenichiro MATOHARA

Other Decks in Technology

Transcript

  1. follow up 1 の でOBS Studio のDraft 版WHIP plugin を利用.

    先週リリースの でサポート 🎉 「鹿児島Linux勉強会 2023.06(オンライン開催)」 「WHIP を試 す」 OBS Studio 30.0 Added WHIP/WebRTC output [Sean- Der / kc5nra / DDRBoxman / tt2468] With the introduction of WHIP, FTL is slated for removal in a release after May 2024 3
  2. follow up 2 で を発表 scrcpy v2.2 でカメラサポート 🎥 v2.0

    でマイクサポートしていたので合わせてAndroid端末を WebCamとして使えるように DroidCam などの類似アプリと比べると手動でAndroidアプリ を導入する必要がないのがメリット? 「鹿児島Linux勉強会 2023.05(オンライン開催)」 「Scrcpyで Android画面転送&操作」 Release scrcpy v2.2 · Genymobile/scrcpy 4
  3. tmux でもSixel tmux GNU screen などのターミナルマルチプレクサの一つ(おそらく いま一番メジャー) デタッチ,アタッチ機能で作業の続きを別の端末,回線, 画面縦横分 割, ステータス表示等々

    Byobu や mosh/ssh と組み合わせるととても便利 Sixel DEC発の端末でグラフックを表示する形式 最近?様々な環境にサポートされていっている https://github.com/tmux/tmux 5
  4. その他の端末で画像を表示する 実装 Kitty, iTerm2 等独自?実装で画像を表示できるよう(未検証) w3m には以前からX やframebuffer を利用した画像表示が可能 だった.現在はSixel

    もサポート( $ w3m -sixel http://.. ) 前者はtmux の画面分割を無視した場所に画像が配置される,後 者はtmux 上だとうまく描画されない? 16
  5. Sixel に対応した端末が必要 今回はmlterm,Microsoft Visual Studio Code でも設定変更 で対応可能(らしい) "Are We

    Sixel Yet?" などが参考になる X無しの場合は やmterm-fb( ./configure --with- gui=fb ) がある https://www.arewesixelyet.com/ yaft 18
  6. tmux のSixel 対応 8月の Git commit 以降で ./configure --enable- sixel

    することで対応 まだリリースはされていない( 2022-06-22 の tmux 3.3a が最 新リリース ) dfbc6b1 20
  7. Debian のtmux パッケージバージョン unstable(sid) 以前は非対応バージョン experimental は対応バージョン $ rmadison tmux

    tmux | 2.8-3 | oldoldstable | source, amd64, arm64, armel, armhf tmux | 3.1c-1~bpo10+1 | buster-backports | source, amd64, arm64, armel, armhf tmux | 3.1c-1~bpo10+1 | buster-backports-debug | source tmux | 3.1c-1+deb11u1 | oldstable | source, amd64, arm64, armel, armhf tmux | 3.1c-1+deb11u1 | oldstable-debug | source tmux | 3.3a-3~bpo11+1 | bullseye-backports | source, amd64, arm64, armel, armhf tmux | 3.3a-3~bpo11+1 | bullseye-backports-debug | source tmux | 3.3a-3 | stable | source, amd64, arm64, armel, armhf tmux | 3.3a-5 | testing | source, amd64, arm64, armel, armhf tmux | 3.3a-5 | unstable | source, amd64, arm64, armel, armhf tmux | 3.3a-5 | unstable-debug | source tmux | 3.4~git20230924-1 | experimental | source, amd64, arm64, armel, armhf tmux | 3.4~git20230924-1 | experimental-debug | source 21
  8. Debian experimental のtmux はSixel 対応 $ wget http://deb.debian.org/debian/pool/main/t/tmux/tmux_3.4~git20230924-1.debian.tar.xz $ tar

    xvf ./tmux_3.4~git20230924-1.debian.tar.xz $ grep sixel debian/rules dh_auto_configure -- --enable-utempter --enable-systemd --enable-sixel $ grep -A5 3.4~git20230924-1 debian/changelog tmux (3.4~git20230924-1) experimental; urgency=medium * New upstream snapshot, from Git commit b777780720. * Enable Sixel support. -- Romain Francoise <[email protected]> Sun, 24 Sep 2023 13:12:42 +0200 1 2 22
  9. Debian 12 bookworm / sid でのSixel 対応tmux build 例 1

    tmux build 依存パッケージ導入 2 関連パッケージ導入 3 tmux source 入手 4 sixel を有効にして( --enable-sixel ) configure && make $ sudo apt build-dep tmux $ sudo apt install vlock build-essential git $ git clone https://github.com/tmux/tmux $ cd tmux $ ./configure --enable-sixel $ make 1 2 3 4 23
  10. tmux でSixel が使えるのを確認  Sixel 非対応の場合lsix で Error: Your terminal

    does not report having sixel graphics support. $ ./tmux -V tmux next-3.4 $ ./tmux $ echo ${TERM_PROGRAM} tmux $ sudo apt install imagemagick $ wget https://github.com/hackerb9/lsix//releases/latest/download/lsix $ chmod u+x ./lsix $ ./lsix 24
  11. lsix hackerb9/lsix: Like "ls", but for images. Shows thumbnails in

    terminal using sixel graphics. $ wget https://github.com/hackerb9/lsix//releases/latest/download/lsix $ chmod u+x ./lsix $ lsix 26
  12. img2sixel( libsixel-bin package) $ img2sixel IMAGEFILE $ img2sixel IMAGEFILE >

    SIXELFILE $ cat SIXELFILE $ curl -s https://upload.wikimedia.org/wikipedia/commons/thumb/8/80/Wikipedia-logo-v2.svg/103px img2sixel 28
  13. ウェブサイトのスクリーンショ ットを表示 川の防災情報の雨雲レーダーを定期的に表示 $ while true; do chromium --headless --hide-scrollbars

    --window-size=800,500 --screenshot=/tmp 'https://www.river.go.jp/kawabou/mb?zm=11&fld=0&clat=31.24891059083941&clon=130.67756652832034 2>/dev/null ;img2sixel /tmp/myscreenshot.png ;sleep 600; done 31
  14. misskey クライアント sayaka ちゃん Misskey のLHT を垂れ流しできる $ git clone

    https://github.com/isaki68k/sayaka $ cd sayaka $ sudo apt install libbsd-dev libwebp-dev libgif-dev libwslay1 libwslay-dev libmbedtls-dev lib $ ./configure $ bmake -DRELEASE sayaka $ ./src/sayaka --local misskey.io $ ./src/sayaka --show-nsfw --show-cw --local misskey.io 32
  15. tui mastoton クライアントのtoot 現時点では画像非対応 image branch でAsciiArt で画像表示可能 Kitty, iTerm2

    向けの画像表示PR あり(未検証) Sixel 対応は検討中?(POC) https://github.com/ihabunek/toot/pull/319 33
  16. まとめ tmux がグラフックを扱えるSixel に対応 Sixel が使えると端末上で画像確認ができて便利 リモートの画像をコピーせずに端末で表示して確認したり(サーバリ ソースに気をつけよう) Sixel 対応tmux

    で端末で画面分割したりしながら画像を扱えて楽し い 実用度もそこそこある……と思う 見たい情報をリモートでtmux 経由で表示しておいて,回線や電源 が不安定な災害時や外出時にattach して閲覧など( ssh -C / ssh_config → Compression はしておきたい) 35