terminal – matoken's blog https://matoken.org/blog Is there no plan B? Mon, 26 Jan 2026 20:48:10 +0000 ja hourly 1 https://wordpress.org/?v=7.0 https://matoken.org/blog/wp-content/uploads/2025/03/cropped-1865f695c4eecc844385acef2f078255036adccd42c254580ea3844543ab56d9-32x32.jpeg terminal – matoken's blog https://matoken.org/blog 32 32 懐かしい感じのターミナルスクリーンセーバーのmystify-term https://matoken.org/blog/2026/01/27/mystify-term/ https://matoken.org/blog/2026/01/27/mystify-term/#respond Mon, 26 Jan 2026 20:48:08 +0000 https://matoken.org/blog/?p=5191

古いWindows を使っていた方は懐かしく感じるかもしれないターミナルスクリーンセーバーのmystify-term というものを見かけたので試してみました.

install

c製で依存も少ないのでmake 一発な感じです.Debian sind amd64/Raspberry Pi bookworm armhf ともに問題なく動きました.

$ git clone https://github.com/adsr/mystify-term
$ cd mystify-term
$ install mystify-term ~/bin/
$ which mystify-term
/home/matoken/bin/mystify-term
$ mystify-term --help
Usage:
  mystify-term [options]

Options:
  -h, --help                  Show this help
  -v, --version               Show program version
  -q, --polys=<int>           Set number of polygons (default=2, max=16)
  -p, --points=<int>          Set number of points per polygon (default=4, max=16)
  -t, --trails=<int>          Set number of trails lines (default=20, max=64)
  -f, --fps=<int>             Set frames per second (default=60)
  -e, --max-velocity=<float>  Set max velocity per point (default=1.00, min=0.01, max=10.00)
  -s, --no-status             Hide status text
  -i, --trail-incr=<int>      Render every nth trail (default=4, max=64)
$ mystify-term --version
mystify-term v0.1.0

実行例

とりあえずオプション無しで起動します.懐かしい感じのスクリーンセーバーが起動します.

スクリーンショットはこんな感じです.

mystify term01

UTF-8 の四角を使っているので,UTF-8 が使えないとこんな感じになったりします.まあこれはこれで.

mystify term02

動いている様子は以下のasciinema を.

キーバインド

下の方にあるとおり以下のキーバインドで操作ができます.

p=pause, s=step, r=reinit, w=status, q=quit

p

一時停止/再開

s

停止/コマ送り(pで再開)

r

再初期化

w

ステータス表示/非表示

q

終了

コマンドラインオプション

スタータスをいじれますが, -s, --no-status くらいであとは既定値でいいかなと言う感じ.

-h, --help                  Show this help

このヘルプを表示

-v, --version               Show program version

バージョン表示

-q, --polys=<int>           Set number of polygons (default=2, max=16)

ポリゴン数

-p, --points=<int>          Set number of points per polygon (default=4, max=16)

ポイント数(例えば3で三角形,4で四角形)

-t, --trails=<int>          Set number of trails lines (default=20, max=64)

トレイルラインの数

-f, --fps=<int>             Set frames per second (default=60)

1秒あたりのフレーム数

-e, --max-velocity=<float>  Set max velocity per point (default=1.00, min=0.01, max=10.00)

最大速度

-s, --no-status             Hide status text

ステータスを隠す

-i, --trail-incr=<int>      Render every nth trail (default=4, max=64)

n番目のトレイルごとに描画

tmux のスクリーンセーバーに設定

ターミナルマルチプレクサのtmux のスクリーンセーバーに設定してみます.

まずは設定ファイルに以下を記述します.

set -g lock-after-time 900 #スクリーンセーバーが起動するまでの秒数
set -g lock-command "mystify-term -s" #スクリーンセーバーコマンド
Note

tmux の設定ファイルは

       ~/.tmux.conf
       $XDG_CONFIG_HOME/tmux/tmux.conf
       ~/.config/tmux/tmux.conf

byobu から起動している場合は

       ~/.byobu/.tmux.conf

次回起動時から反映されますが,現在のtmux セッションに反映したい場合は以下のように tmux source 設定ファイル として反映できます.

$ tmux source ~/.byobu/.tmux.conf
]]>
https://matoken.org/blog/2026/01/27/mystify-term/feed/ 0
tmux 3.6 リリース https://matoken.org/blog/2025/11/27/tmux-3-6-release/ https://matoken.org/blog/2025/11/27/tmux-3-6-release/#respond Thu, 27 Nov 2025 10:05:18 +0000 https://matoken.org/blog/?p=4741

ターミナルマルチプレクサのtmux 3.6 が出ていました.

早速ビルドしてみます.今回はgit リポジトリから導入します.
$ git pull
$ git checkout 3.6
$ ./autogen.sh
$ ./configure --enable-sixel --prefix=$HOME/usr/local (1)
$ make
$ ./tmux -V
tmux 3.6
  1. sixel を有効にし,$HOME/usr/local 以下に導入

tmux が起動しない?旧tmux が生きていたせいでした.
$ ./tmux
open terminal failed: not a terminal
$ pgrep tmux
14030
$ tmux kill-server
$ ./tmux
$ ./tmux kill-server
intall
$ make install
$ which tmux
/home/matoken/local/bin/tmux
$ tmux -V
tmux 3.6

tmux 3.6

環境
$ tmux -V
tmux 3.6
$ dpkg-query -W autoconf automake pkg-config libevent-dev ncurses-bin
autoconf        2.72-3.1
automake        1:1.18.1-3
libevent-dev    2.1.12-stable-10+b1
ncurses-bin     6.5+20251123-1
pkg-config:amd64        1.8.1-4
$ lsb_release -dr
Description:    Debian GNU/Linux forky/sid
Release:        n/a
$ arch
x86_64
追記

Debian sid にtmux 3.6 が降りてきました.sixel も有効になっています.パッケージ名にaがつくのはなんでだろう?tmux 3.5a が存在したようにtmux 3.6a がリリースされたら当たりそうだなとも.

$ /usr/bin/tmux -V
tmux 3.6
$ zgrep -B99 -m1 — – /usr/share/doc/tmux/NEWS.Debian.gz
tmux (3.6a-1) unstable; urgency=medium

Please restart tmux entirely after upgrading to 3.6: an old server and
a new client will not be fully compatible with each other and the new
client may hang.
Note: if necessary the old client can be used via /proc/pid/exe to
talk to the old server, e.g. `/proc/$(pgrep "tmux: server")/exe attach'.
 -- Sébastien Delafond <seb@debian.org>  Mon, 01 Dec 2025 16:44:38 +0100
$ rmadison tmux
tmux       | 3.1c-1+deb11u1 | oldoldstable              | source, amd64, arm64, armhf, i386
tmux       | 3.1c-1+deb11u1 | oldoldstable-debug        | source
tmux       | 3.3a-3         | oldstable                 | source, amd64, arm64, armel, armhf, i386, mips64el, mipsel, ppc64el, s390x
tmux       | 3.5a-2~bpo12+1 | oldstable-backports       | source, amd64, arm64, armel, armhf, i386, mips64el, mipsel, ppc64el, s390x
tmux       | 3.5a-2~bpo12+1 | oldstable-backports-debug | source
tmux       | 3.5a-3         | stable                    | source, amd64, arm64, armel, armhf, i386, ppc64el, riscv64, s390x
tmux       | 3.5a-3         | testing                   | source, amd64, arm64, armhf, i386, ppc64el, riscv64, s390x
tmux       | 3.6a-2         | unstable                  | source, amd64, arm64, armhf, i386, ppc64el, riscv64, s390x
tmux       | 3.6a-2         | unstable-debug            | source
]]>
https://matoken.org/blog/2025/11/27/tmux-3-6-release/feed/ 0
Zellijのウェブ共有機能を少し試す https://matoken.org/blog/2025/08/12/try-zellijs-web-sharing-feature/ https://matoken.org/blog/2025/08/12/try-zellijs-web-sharing-feature/#respond Tue, 12 Aug 2025 11:26:22 +0000 https://matoken.org/blog/?p=4683

zellij logo small

ターミナルマルチプレクサ,ワークスペースのZellij 0.43.0が2025-08-05にリリースされていました.

気になる新機能としてウェブブラウザでZellijセッションを共有できるようになったようです.Tmateのような感じでしょうか?

Zellij 0.43.0のビルド

$ cargo install --locked zellij

でいいはずですが,sourceからも

$ git clone https://github.com/zellij-org/zellij (1)
$ cd zellij
$ git checkout v0.43.0 (2)
$ cargo xtask make -r (3)
  :
Could not find `protoc` installation and this build crate cannot proceed without (4)
Contthis knowledge. If `protoc` is installed and this crate had trouble finding
    it, you can set the `PROTOC` environment variable with the specific path to your11 [1,328 kB]
  :
$ sudo apt install protobuf-compiler (5)
$ cargo xtask make -r (6)
$ ./target/release/zellij --version (7)
zellij 0.43.0
  1. git でsourceをもらってくる

  2. v0.43.0 branchへ

  3. build

  4. protocが見つからないエラーで失敗

  5. protocはDebian sidではprotobuf-compilerなので導入

  6. 再度build

  7. バージョンの確認

Webサーバ機能を無効にするビルド例

ウェブサーバ機能が必要ない場合は –no-web を付けてビルドする
$ cargo xtask make -r --no-web
$ ./target/release/zellij web
This version of Zellij was compiled without web server support, cannot run web server!

CLIでWebサーバを起動

ウェブサーバ用トークンの作成
$ ./target/release/zellij web --create-token
Created token successfully

token_1: f964e7a4-0c8d-4652-b92f-23168161b3b4
トークンの一覧表示
$ ./target/release/zellij web --list-tokens
token_1: created at 2025-08-11 21:19:18
token_2: created at 2025-08-12 10:35:47
トークンの削除
$ ./target/release/zellij web --revoke-token token_1
Successfully revoked token.
Zellijウェブサーバ起動
$ ./target/release/zellij web
Web Server started on 127.0.0.1 port 8082

ウェブブラウザで http://127.0.0.1:8082/ に接続してトークンを入力してウェブブラウザでZellijが利用可能.

zellij web token
zellij web init
zellij web

結構普通に使えそうです.Zellijでは対応しているSixelはWeb版では未対応のようです.
ngrok経由でAndroidのFirefoxでも試してみるとモバイルブラウザでも動作するようです.でもキーボードとの相性がありそう.
sourceを見るとXterm.jsを利用しているようです.

Zellij上でウェブサーバを起動

Zellij起動中に Ctrl+o s で起動できます.
zellij share

設定でZellij起動時にいつもウェブサーバを起動するようにする

設定ファイルがない場合はディレクトリを作成して書き出し
$ mkdir ~/.config/zellij
$ zellij setup --dump-config > ~/.config/zellij/config.kdl
設定ファイルに web_server true を追記
5$ echo '// WebServer
> web_server true' | tee -a ~/.config/zellij/config.kdl

トンネリングサービスで外部から利用

トンネリングサービスのngrokでZellijのportを指定することで外部仮利用することもできました.

$ ngrok http 8082

好みの類似サービスでもきっと大丈夫です.

おわりに

TmuxフォークのTmateにも同じような機能がありますが,こちらはトンネリングサービスも含まれていたりhttpdだけでなくsshdも使えたり読み取り用セッション,読み書きセッションが選べたりと便利です.
でもUnux哲学的にはバラけていたほうがいいかなとか.それならZellij-nowebにWeb共有アプリ+トンネリングサービスのほうがいいのかなとか思ったりも.
何にせよ選択肢が増えたのは嬉しいですね.

環境
$ ./target/release/zellij --version
zellij 0.43.0
$ dpkg-query -W rustup
rustup  1.27.1-4
$ lsb_release -dr
Description:    Debian GNU/Linux forky/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2025/08/12/try-zellijs-web-sharing-feature/feed/ 0
画像,JavaScript/CSSなどに対応するターミナルウェブブラウザのChawanを試す https://matoken.org/blog/2025/06/20/try-chawan-a-terminal-web-browser-that-supports-images-javascript-css-etc/ https://matoken.org/blog/2025/06/20/try-chawan-a-terminal-web-browser-that-supports-images-javascript-css-etc/#respond Thu, 19 Jun 2025 20:52:39 +0000 https://matoken.org/blog/?p=4613

Chawanというターミナルウェブブラウザを知りました.
メモリセーフなNimで実装されていてライセンスはパブリックドメインです.

同じようにターミナル上で動作するw3mやLynx系との大きな違いはJavaScriptやCSSに対応している辺りでしょうか.SixelやKittyのターミナル画像形式にも対応しています.
少し試してみました.

Note

少し用途が違いますが,v8エンジンを使ったスクレイピング向けのヘッドレスブラウザのLightpandaなんてものもあります.

Chawanのインストール

現在のChawan: 0.2.0Linux amd64の静的バイナリtarballDebian amd64の.debがあります.
不安定のパッケージとしてAUR/NixOS/AppImageがあるようです.(こちらは今回未確認)

他の環境ではセルフビルドが必要そうです.

Debianパッケージ利用(amd64のみ)

Debian sid amd64環境に.debパッケージで導入してみました.

$ wget -c https://chawan.net/dl/chawan-0-2-0-amd64.deb (1)
$ sha256sum ./chawan-0-2-0-amd64.deb
ba3ff4e24a5bf09919caba1cdc4f50b0cbf862f8433f5ea43d5391c1e04eceda  ./chawan-0-2-0-amd64.deb
$ sha512sum ./chawan-0-2-0-amd64.deb
e941b880c179df8da7eb4cf7a8050c75ef8a1cdfe629aff8287893f4308071454bf7fb54b4054a5ab99330610b17eca12e7f23a71ffc956d613329365d3c7e17  ./chawan-0-2-0-amd64.deb
$ sudo apt install ./chawan-0-2-0-amd64.deb (2)
$ chawan (3)
bash: chawan: command not found
$ dpkg -L chawan | grep /bin/ (4)
/usr/bin/cha
/usr/bin/mancha
$ cha
Chawan browser v0.2.0 (release, sandboxed)
Usage: cha [options] [URL(s) or file(s)...]
Options:
    --                          Interpret all following arguments as URLs
    -c, --css <stylesheet>      Pass stylesheet (e.g. -c 'a{color: blue}')
    -d, --dump                  Print page to stdout
    -h, --help                  Print this usage message
    -o, --opt <config>          Pass config options (e.g. -o 'page.q="quit()"')
    -r, --run <script/file>     Run passed script or file
    -v, --version               Print version information
    -C, --config <file>         Override config path
    -I, --input-charset <enc>   Specify document charset
    -M, --monochrome            Set color-mode to 'monochrome'
    -O, --display-charset <enc> Specify display charset
    -T, --type <type>           Specify content mime type
    -V, --visual                Visual startup mode
$ cha --version
Chawan browser v0.2.0 (release, sandboxed by seccomp-bpf)
$ mancha
Usage:
mancha [-M path] [[-s] section] -k keyword
mancha [-M path] [[-s] section] name
mancha -l file
$ mancha cha
    :
  1. .debを入手

  2. インストール

  3. chwanコマンドはなかった

  4. バイナリを探すと chamancha が見つかった

Debian sid amd64でsourceからbuild

sourceからのbuildも試してみます.

パッケージで導入したNimはちょっと古そうです.

$ /usr/bin/nim -V
Nim Compiler Version 1.6.14 [Linux: amd64]
Compiled at 2024-04-25
Copyright (c) 2006-2023 by Andreas Rumpf

active boot switches: -d:release

Nim 2.2.4を貰ってきてPATHを通しておきます.

$ wget -c https://nim-lang.org/download/nim-2.2.4-linux_x64.tar.xz https://nim-lang.org/download/nim-2.2.4-linux_x64.tar.xz.sha256
$ sha256sum -c nim-2.2.4-linux_x64.tar.xz.sha256
nim-2.2.4-linux_x64.tar.xz: OK
$ fuse-archive nim-2.2.4-linux_x64.tar.xz
fuse-archive: Created mount point 'nim-2.2.4-linux_x64'
$ export PATH=`pwd`/nim-2.2.4-linux_x64/nim-2.2.4/bin:$PATH
$ which nim
/home/matoken/Downloads/nim-2.2.4-linux_x64/nim-2.2.4/bin/nim
$ nim -V
Nim Compiler Version 2.2.4 [Linux: amd64]
Compiled at 2025-04-22
Copyright (c) 2006-2025 by Andreas Rumpf

git hash: f7145dd26efeeeb6eeae6fff649db244d81b212d
active boot switches: -d:release

適当なディレクトリに移動してChawanのsourceを貰ってきてbuildします.

$ cd ~/src
$ git clone https://git.sr.ht/~bptato/chawan && cd chawan
$ sudo apt install libssh2-1-dev libssl-dev libbrotli-dev pkg-config make
$ make
$ ./cha
Chawan browser v0.3 (release, sandboxed)
Usage: cha [options] [URL(s) or file(s)...]
Options:
    --                          Interpret all following arguments as URLs
    -c, --css <stylesheet>      Pass stylesheet (e.g. -c 'a{color: blue}')
    -d, --dump                  Print page to stdout
    -h, --help                  Print this usage message
    -o, --opt <config>          Pass config options (e.g. -o 'page.q="quit()"')
    -r, --run <script/file>     Run passed script or file
    -v, --version               Print version information
    -C, --config <file>         Override config path
    -I, --input-charset <enc>   Specify document charset
    -M, --monochrome            Set color-mode to 'monochrome'
    -O, --display-charset <enc> Specify display charset
    -T, --type <type>           Specify content mime type
    -V, --visual                Visual startup mode
$ ./cha -v
Chawan browser v0.3 (release, sandboxed by seccomp-bpf)

Raspberry Pi OS bookworm armhf

Single-Board ComputerのRaspberry Piでも試したいのでこちらでもbuildを試します.

Linux armhfのNimバイナリは公式に見当たらないのでこちらのNightlyのものを使いました.

$ wget -c https://github.com/nim-lang/nightlies/releases/download/2025-04-22-version-2-2-f7145dd26efeeeb6eeae6fff649db244d81b212d/nim-2.2.4-linux_armv7l.tar.xz
$ tar tvf nim-2.2.4-linux_armv7l.tar.xz
$ tar xvf nim-2.2.4-linux_armv7l.tar.xz
$ export PATH=$PATH:`pwd`/nim-2.2.4/bin
$ which nim
/home/matoken/Downloads/nim-2.2.4/bin/nim
$ cd ~/src
$ git clone https://git.sr.ht/~bptato/chawan && cd chawan
$ sudo apt install libssh2-1-dev libssl-dev libbrotli-dev pkg-config make
$ make
$ ./cha --version
Chawan browser v0.3 (release, sandboxed by seccomp-bpf)
Note

手元の環境ではパッケージ導入時に以下のような依存関係のエラーとなりました.

The following packages have unmet dependencies:
 zlib1g-dev : Depends: zlib1g (= 1:1.2.13.dfsg-1) but 1:1.2.13.dfsg-1+rpt1 is to be installed
E: Unable to correct problems, you have held broken packages.

とりあえずバージョンを指定して入れ直して回避できました.

$ sudo apt install zlib1g=1:1.2.13.dfsg-1

Chawanを試す

$ cha
Chawan browser v0.2.0 (release, sandboxed)
Usage: cha [options] [URL(s) or file(s)...]
Options:
    --                          Interpret all following arguments as URLs
    -c, --css <stylesheet>      Pass stylesheet (e.g. -c 'a{color: blue}')
    -d, --dump                  Print page to stdout
    -h, --help                  Print this usage message
    -o, --opt <config>          Pass config options (e.g. -o 'page.q="quit()"')
    -r, --run <script/file>     Run passed script or file
    -v, --version               Print version information
    -C, --config <file>         Override config path
    -I, --input-charset <enc>   Specify document charset
    -M, --monochrome            Set color-mode to 'monochrome'
    -O, --display-charset <enc> Specify display charset
    -T, --type <type>           Specify content mime type
    -V, --visual                Visual startup mode

とりあえず cha $URL という感じでurlを指定して起動するとウェブページが表示できます.
既定値ではCSSは認識しますが,JavaScriptや画像は使えません.

右クリックからのメーニューやショートカットで有効にすることも出来ますが面倒なので設定ファイルで設定します.

右クリックのメニュー
┌──────────────────────────────┐
│ Select text              (v) │
│ Copy selection           (y) │
│ Previous buffer          (,) │
│ Next buffer              (.) │
│ Discard buffer           (D) │
│ ──────────────────────────── │
│ View image               (I) │
│ Peek                     (u) │
│ Copy link               (yu) │
│ Copy image link         (yI) │
│ Paste link             (M-p) │
│ Reload                   (U) │
│ ──────────────────────────── │
│ Save link             (sC-m) │
│ View source              (\) │
│ Edit source             (sE) │
│ Save source             (sS) │
│ ──────────────────────────── │
│ Linkify URLs             (:) │
│ Toggle images          (M-i) │
│ Toggle JS & reload     (M-j) │
│ Toggle cookie & reload (M-k) │
│ ──────────────────────────── │
│ Bookmark page          (M-a) │
│ Open bookmarks         (M-b) │
│ Open history           (C-h) │
└──────────────────────────────┘

設定ファイルは
~/.chawan/config.toml 若しくは ~/.config/chawan/config.toml が使えるようです.
cha-config(5) を見ながら設定すると良さそうです.

とりあえず画像とJavaScriptを有効にする最低限の設定はこんな感じのようです.

[buffer]
images = true
scripting = true

ただ,JavaScriptの設定の scripting はここではなくsiteごとの設定の [siteconf] 内で有効にするのを強く勧めますとのことなのでちゃんと必要なsiteだけ有効にしたほうが良さそうです.

この状態でSixelやKittyに対応したXTermなどの端末でアクセスするとこんな感じで表示されます.

about:chawan キーバインドなども確認できます

chawan about

https://tenki.jp/forecast/9/49/8820/46490/10days.html JavaScriptをOnにした状態で2週間天気を見ようとするとコケます.JavaScript offだと表示できました.

chawan tenki ng

MastodonやMisskeyはJavaScriptを有効にしてもダメそうです.この辺りはサードパーティのアプリケーションを使ったほうが良さそうです.と思ったけど fedibird.com は大丈夫そう.インスタンスの設定が違うのでしょうか?

chawan mastodon ng
chawan fedibird

GithubのReleasesのAssetsも今はJavaScriptが必須になってしまっているのでこれはどうだろうと思いましたが駄目でした.

chawan github

という感じで少し試した感じではCSSを認識するので見た目がw3mなどと比べて大分いい感じです.カーソルが背景と同じになり場所がわからなくなってしまったりしますが,ポインティングデバイスが使える場合はクリックでカーソルがその場所に移動するのでアンカ部分をクリック&Enterでリンク先に移動できます.画像が一部しか表示されないとき key:[M-i] で画像をoff → 再度 key:[M-i] で画像を再度on とすると読み込まれることがあります.

回線が細い場合リモートのVPSでChawanを動かして結果だけをもらうようにするとダウンロード時間が短縮されていい感じです.ただし加増が多いサイトでスクロールを多用する場合はもたつきます.

Sixelで画像が利用できる時にSixel対応tmux経由でChawanを起動するとChawanのSixel画像が表示されないようです.同じ端末でimg2sixelなどは問題ないのでChawan側の問題でしょうか?

JavaScriptは思ったより動かないなという感じですがCSSが思ったより助かります.JavaScriptについてはQuickJS-NGを使っているのでこちらに期待です.ECMAScriptの機能準拠の進捗状況はこちら

ただ,現時点ではChawanはLinux amd64環境でJavaScript/画像有効でもメモリ利用量10MB前後.色々と動くようになるとこの辺も増えていってしまうでしょうね…….

という感じで軽量で見た目もいいのでこれからにも期待しつつw3mなどと併用していこうと思います.

]]>
https://matoken.org/blog/2025/06/20/try-chawan-a-terminal-web-browser-that-supports-images-javascript-css-etc/feed/ 0
terminal衛星追跡アプリのtrackerに衛星を追加 https://matoken.org/blog/2025/06/07/add-satellites-to-the-tracker/ https://matoken.org/blog/2025/06/07/add-satellites-to-the-tracker/#respond Fri, 06 Jun 2025 23:10:48 +0000 https://matoken.org/blog/?p=4594

ターミナル上で動作する衛星追跡,軌道予測ソフトウェアのtrackerが楽しくて色々な衛星の軌道を見たりして楽しんでいます.

しかし設定された衛星しか見ることができません.
任意の衛星を登録してみました.

sourceを眺めると衛星はsource内にハードコードされていて,それを元にCelesTrakから軌道データを取得しているようです.
衛星のタイプは2種類の方法で登録してあり,ISSなどは任意のYYYY-NNNAAA形式の(例えば1994-029AAB)国際識別子で個別の衛星を設定,若しくはCelesTrakでGROUPで検索できるgroup名でそのグループの衛星群(例えばWeatherで様々な気象衛星)が登録してあります.

個別の衛星を追加

時別の衛星を登録してみます.

まず対象の衛星の国際識別子を調べます.
先ずはCelesTrakの以下のページで衛星を検索します.

検索結果から「International Designator」をメモします.

例えば「あらせ」を登録したい場合,「ARASE」で検索,検索結果を見ると国際識別子は「2016-080A」なのでこれをメモしておきます.

次にtrackerのsourceを編集します.
衛星の情報は src/satellite_group.rs に書かれているのでこれを編集します.
pub enum SatelliteGroup { の適当な場所に衛星名を登録します.
fn cospar_id(&self) → Option<&str> { の中に国際識別子を登録します.

今回は以下のようにしました.

$ git diff
diff --git a/src/satellite_group.rs b/src/satellite_group.rs
index 88bbce8..b895b54 100644
--- a/src/satellite_group.rs
+++ b/src/satellite_group.rs
@@ -51,6 +51,7 @@ pub enum SatelliteGroup {
     #[strum(to_string = "Radar calibration")]
     RadarCalibration,
     CubeSats,
+    Arase,
 }

 impl SatelliteGroup {
@@ -124,6 +125,7 @@ impl SatelliteGroup {
             Self::Iss => Some("1998-067A"),
             Self::Css => Some("2021-035A"),
             Self::Dfh1 => Some("1970-034A"),
+            Self::Arase => Some("2016-080A"),
             _ => None,
         }
     }

buildして実行して動作確認をします.

$ cargo build
$ target/debug/tracker

あらせの楕円軌道が表示できるようになりました :)

tracker arase

衛星グループを登録

一つ一つ衛星を登録してくのは面倒です.CelesTrakの以下のページから好みのグループを探したり,

以下のページから該当の衛星のCatalog Numberから検索します.groupに存在する場合表示されます.

group名がわかったらsourceをいじります.
今回は最近第1弾の衛星群の打ち上げのあったAmazonの低軌道通信衛星サービスのProject Kuiperだと思われるkuiperで試してみます.

わかりやすいように一旦元に戻します.

$ git reset --hard

今夏も src/satellite_group.rs を編集します.

$ git diff src/satellite_group.rs
diff --git a/src/satellite_group.rs b/src/satellite_group.rs
index 88bbce8..33c5d0b 100644
--- a/src/satellite_group.rs
+++ b/src/satellite_group.rs
@@ -37,6 +37,9 @@ pub enum SatelliteGroup {
     Galileo,
     Beidou,

+    // Communications Satellites
+    Kuiper,
+
     // Scientific satellites
     #[strum(to_string = "Space & Earth Science")]
     SpaceEarthScience,
@@ -141,6 +144,7 @@ impl SatelliteGroup {
             Self::Glonass => Some("glo-ops"),
             Self::Galileo => Some("galileo"),
             Self::Beidou => Some("beidou"),
+            Self::Kuiper => Some("kuiper"),
             Self::SpaceEarthScience => Some("science"),
             Self::Geodetic => Some("geodetic"),
             Self::Engineering => Some("engineering"),

buildして実行して動作確認をします.

$ cargo build
$ target/debug/tracker

まだ1回の打ち上げしか無いので1つの軌道しかなさそうです.

tracker kuiper

Note

Project Kuiperの次の打ち上げ予定日は6/13.その後今年だけで48回予定がされていそうで追い上げがすごいですね.FCCとの兼ね合いなんでしょうが.
https://nextspaceflight.com/launches/?search=kuiper

Note

ちなみにStarlinkも試したところ7500機以上あるので極以外の地図が埋もれてしまいました…….

View on Mastodon

後はCelesTrakのgroupに無い自分で選んだ衛星群(みちびき群とか)も登録できるといいなと思うのですが少しロジックをいじらないといけなそうです.

]]>
https://matoken.org/blog/2025/06/07/add-satellites-to-the-tracker/feed/ 0
terminal衛星追跡アプリのtracker https://matoken.org/blog/2025/05/31/terminal-based-real-time-satellite-tracking/ https://matoken.org/blog/2025/05/31/terminal-based-real-time-satellite-tracking/#comments Fri, 30 May 2025 22:11:21 +0000 https://matoken.org/blog/?p=4576

ターミナル上で動作する衛星追跡,軌道予測アプリケーションを見つけたので試してみました.

導入はcargoコマンドで行いました.

$ cargo install --git https://github.com/ShenMian/tracker
$ which tracker
/home/matoken/.cargo/bin/tracker
Note

Raspberry Pi OS bookworm armhfではcargoのバージョンの問題でうまく行きませんでした.

Caused by:
  failed to parse the `edition` key

Caused by:
  this version of Cargo is older than the `2024` edition, and only supports `2015`, `2018`, and `2021` editions.

若しくはいくつかの環境向けにはreleasesページにバイナリがおいてあるようです.(未確認)

tracker-linux-x86_64.tar.gz
tracker-macos-aarch64.tar.gz
tracker-macos-x86_64.tar.gz
tracker-windows-x86_64.zip

起動します.もしbuildは成功したのにコマンドが見当たらない場合はPATHが通っていないと思うのでPATHを通すか ~/.cargo/bin/tracker で起動するかもしれません.

$ tracker

操作はマウスのみのようです.
まず右下の「Satellite groups」から好みのグループをクリックで選びます.(複数選択可)
すると少し経ってからマップに衛星(群)がプロットされるので好みの衛星をクリックすると予測軌道が(おそらくこの後の地球1周分)マップ上に,それと右上の「Object information」が表示されます.
以下の画像ではISSの予想軌道が表示されています.

tracker

以下はWratherとEarth resourcesグループを表示して日本のALOS-2(だいち2号)の軌道を表示しています.

tracker alos2

静止衛星のひまわりなどを選ぶと予想軌道は見えません.

色々と衛星を眺めつつその衛星について調べたりすると楽しいです.
この衛星はもう運用終わって墓場軌道でこんな動きなのかとか.

若しくは少し実用的にだと上の画像だと右上のPeriodが90分ほどなのでしばらくするとISSが日本上空を通過するので晴れていれば見えそうとかがわかります.

リアルタイムで衛星は遷移していくので眺めているだけでも楽しいです.

ターミナルで動作する天文ソフトウェアだと星図のastrotermもおすすめです.

]]>
https://matoken.org/blog/2025/05/31/terminal-based-real-time-satellite-tracking/feed/ 4
astrotermで端末上で星図を楽しむ https://matoken.org/blog/2025/01/25/astroterm/ https://matoken.org/blog/2025/01/25/astroterm/#comments Fri, 24 Jan 2025 23:20:27 +0000 https://matoken.org/blog/?p=4415

端末で動作する星図盤アプリケーションを見つけました.端末でどのくらい使い物になるだろうかと思いつつ試してみました.

Releasesのバイナリを導入

GitHubのRelseasesからLinux x86_64版を利用しました.

$ wget2 -c -v \ (1)
https://github.com/da-luce/astroterm/releases/download/v1.0.5/astroterm-linux-x86_64 \
https://github.com/da-luce/astroterm/releases/download/v1.0.5/astroterm-linux-x86_64.sha256
$ sha256sum -c ./astroterm-linux-x86_64.sha256 (2)
sha256sum: build/astroterm: No such file or directory
build/astroterm: FAILED open or read
sha256sum: WARNING: 1 listed file could not be read
$ cat ./astroterm-linux-x86_64.sha256 (3)
ae1ce946d9da27f97e26de9ef6df8d068feb971a5aa7a76d4972b2673cddb495  build/astroterm
$ cat ./astroterm-linux-x86_64.sha256 | sed -e 's/build\/astroterm/astroterm-linux-x86_64/' | sha256sum -c (4)
astroterm-linux-x86_64: OK
$ chmod u+x ./astroterm-linux-x86_64 (5)
$ ./astroterm-linux-x86_64 -v (6)
astroterm 1.0.5
  1. 実行ファイルと,対応したhashファイルの入手

  2. ハッシュの確認に失敗

  3. ハッシュファイルの中を見るとファイル名が間違っている

  4. ファイル名部分を差し替えてハッシュの確認

  5. 実行権の付与

  6. バージョンの確認

Raspberry Pi OS bookworm armhfへのsourceからの導入

$ wget -c https://github.com/da-luce/astroterm/archive/refs/tags/v1.0.6.tar.gz (1)
$ tar tvf v1.0.6.tar.gz
$ tar xvf v1.0.6.tar.gz (2)
$ cd astroterm-1.0.6
$ meson setup build (3)
$ meson compile -C build
$ build/astroterm -v
astroterm 1.0.6
$ install build/astroterm ~/bin/ (4)
  1. sourceの入手

  2. source展開

  3. build※(mesonは1.4.0以上が必要)

  4. 好みの場所にinstall

利用例

help
$ ./astroterm-linux-x86_64 -h
View stars, planets, and more, right in your terminal! ✨🪐

Usage: astroterm [OPTION]...

  -a, --latitude=<degrees>  Observer latitude [-90°, 90°] (default: 0.0)
  -o, --longitude=<degrees> Observer longitude [-180°, 180°] (default: 0.0)
  -d, --datetime=<yyyy-mm-ddThh:mm:ss>
                            Observation datetime in UTC
  -t, --threshold=<float>   Only render stars brighter than this magnitude (def
                            ault: 5.0)
  -l, --label-thresh=<float>
                            Label stars brighter than this magnitude (default:
                            0.25)
  -f, --fps=<int>           Frames per second (default: 24)
  -s, --speed=<float>       Animation speed multiplier (default: 1.0)
  -c, --color               Enable terminal colors
  -C, --constellations      Draw constellation stick figures. Note: a constella
                            tion is only drawn if all stars in the figure are o
                            ver the threshold
  -g, --grid                Draw an azimuthal grid
  -u, --unicode             Use unicode characters
  -q, --quit-on-any         Quit on any keypress (default is to quit on 'q' or
                            'ESC' only)
  -m, --metadata            Display metadata
  -r, --aspect-ratio=<float>
                            Override the calculated terminal cell aspect ratio.
                            Use this if your projection is not 'square.' A valu
                            e around 2.0 works well for most cases
  -h, --help                Print this help message
  -i, --city=<city_name>    Use the latitude and longitude of the provided city
                            . If the name contains multiple words, enclose the
                            name in single or double quotes. For a list of avai
                            lable cities, see: https://github.com/da-luce/astro
                            term/blob/v1.0.5/data/cities.csv
  -v, --version             Display version info and exit

既定値

オプション無しの既定値で実行すると現在時刻の経度0,緯度0の所謂Null Island(実際はブイが浮かんでいるだけで存在しない島)での星図が表示されます.リアルタイムに星図は変化していきます.
解像度により情報量は変わります.以下のスクリーンショットは49×107です.

$ stty size
49 107

astroterm 01

任意の場所

任意の場所を指定したい場合は緯度経度をオプションで指定,もしくは都市を指定できます.

緯度経度の指定
  -a, --latitude=<degrees>  Observer latitude [-90°, 90°] (default: 0.0)
  -o, --longitude=<degrees> Observer longitude [-180°, 180°] (default: 0.0)
USCのKSセンター(取り壊し中)からの星図
$ ./astroterm-linux-x86_64 -a 31.252232 -o 131.078439
都市の指定
-i, --city=<city_name>    Use the latitude and longitude of the provided city
                            . If the name contains multiple words, enclose the
                            name in single or double quotes. For a list of avai
                            lable cities, see: https://github.com/da-luce/astro
                            term/blob/v1.0.5/data/cities.csv
鹿児島からの星図
$ ./astroterm-linux-x86_64 -i kagoshima

都市はsource内の data/cities.csv にあります.2733地点が登録されています.内日本は117地点のようです.

$ wc -l data/cities.csv
2733 data/cities.csv
$ grep ',JP,' data/cities.csv | wc -l
117

csvファイルだけではよくわからないのでuMapを使い地図(OpenStreetMap)にプロットしてみました.利用したい地点の近くにあれば便利です.

フルスクリーン表示

メタデータ

  -m, --metadata            Display metadata

左上にメタデータが表示されます.

astroterm 02

日時の指定

特定の年月日を指定できます.UTCで指定する必要があります.

  -d, --datetime=<yyyy-mm-ddThh:mm:ss>
                            Observation datetime in UTC
皆既日食のときの位置や時間を指定してシミュレーションしてみる
$ ./astroterm-linux-x86_64 -a -22.05 -o -4.07 -d 2006-03-29T08:38:00 -s 10 -m -cu

速度

  -s, --speed=<float>       Animation speed multiplier (default: 1.0)

-s で大きな値を指定することで星図盤のアニメーション速度が速くなります.-も指定できます.

カラー

端末カラーを有効にします.

  -c, --color               Enable terminal colors

Unicode

Unicodeを有効にします.点字フォントで星や絵文字で太陽や月,惑星などの表示がされるので解りやすくなります.

  -u, --unicode             Use unicode characters
$ ./astroterm-linux-x86_64 -i kagoshima -m -s 100 -cu

astroterm 03

Note

端末がUnicodeや絵文字に対応している必要があります.
例えば LC_ALL=C にすると文字化けしてしまいます.C.UTF-8, en_US.UTF-8, ja_JP.UTF-8 などだとOK.

星座

星座を表現します.Unicodeの有無で大分見た目が変わります.

  -C, --constellations      Draw constellation stick figures. Note: a constella
                            tion is only drawn if all stars in the figure are o
                            ver the threshold
Unicode無しの星座

astroterm 04

Unicodeありの星座

astroterm 05

等級

指定した等級よりも明るい星のみを表示します.

  -t, --threshold=<float>   Only render stars brighter than this magnitude (def
                            ault: 5.0)

グリッド

方位角グリッドを表示します.今回試した解像度だと星が大分消えてしまうので邪魔な感じがします.

  -g, --grid                Draw an azimuthal grid

demo

鹿児島での現在からの星図を10000倍の速度で.

$ ./astroterm-linux-x86_64 -i kagoshima -m -s 10000 -c -u -C -t 4

案外表現が豊かで等級の大きな星のある星座や惑星などの観測には使えそうな感じです.

とはいえGUI環境であればStellariumやKstarsなど色々なものがあり使い勝手もよいのでそちらのほうが実用的だと思います.
Debianであれば以下のblendsが天文向けで興味深いソフトウェアがたくさんあります.

GNUにもGNU Astronomy Utilitiesなんてものがあります.

環境

Debian sid amd64

$ ./astroterm-linux-x86_64 -v
astroterm 1.0.5
$ lsb_release -dr
Description:    Debian GNU/Linux trixie/sid
Release:        n/a
$ arch
x86_64

Raspberry Pi OS bookworm armhf

$ astroterm -v
astroterm 1.0.6
$ dpkg-query -W meson gcc python libargtable2-dev libncurses-dev
gcc     4:12.2.0-3+rpi1
libargtable2-dev        13-1.1
libncurses-dev:armhf    6.4-4
meson   1.6.1-1
python  2.7.16-1
$ lsb_release -dr
No LSB modules are available.
Description:    Raspbian GNU/Linux 12 (bookworm)
Release:        12
$ arch
armv7l
]]>
https://matoken.org/blog/2025/01/25/astroterm/feed/ 2
Debian sid環境でGhosttyをbuild https://matoken.org/blog/2025/01/02/ghostty-build-in-debian-sid/ https://matoken.org/blog/2025/01/02/ghostty-build-in-debian-sid/#respond Wed, 01 Jan 2025 22:08:00 +0000 https://matoken.org/blog/?p=4336

com.mitchellh.ghostty

最近1.0.0がリリースされ話題になっているGhosttyというターミナルエミュレータがあります.最近Debian sid amd64環境のAlacrittyの上でNeovim+iBus Mozcで日本語入力時に遅延して?日本語が入力されて使い物にならないのもあり試してみようと思いました.(mltermだと大丈夫)

Debianで次回に動くバイナリは提供されていません.Ubuntuについては第三者がパッケージを提供されています.(apt sourcesは無い)

恐らくUbuntu版はDebianでも動作すると思いますがsourceからBuildしてみました.少し嵌ったのでメモしておきます.

手順は以下に書かれています.

関連パッケージの導入
$ sudo apt install libgtk-4-dev libadwaita-1-dev git
zigの導入
$ wget2 -c -v https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz \
              https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz.minisig
zig-linux-x86_64-0.1 100% [============================================================================================================================================>]     325     --.-KB/s
zig-linux-x86_64-0.1 100% [============================================================================================================================================>]   44.90M  761.78KB/s
                          [Files: 2  Bytes: 44.90M [553.07KB/s] Redirects: 0  Todo: 0  Errors: 0
$ minisign -Vm ./zig-linux-x86_64-0.13.0.tar.xz -P 'RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U'
Signature and comment signature verified
Trusted comment: timestamp:1717729444   file:zig-linux-x86_64-0.13.0.tar.xz     hashed
zigをfuse-archiveでmount(もしくはtar xfで展開)
$ fuse-archive ./zig-linux-x86_64-0.13.0.tar.xz
Ghosttyのsource入手
$ git clone https://github.com/ghostty-org/ghostty
$ cd ghostty
Note

fontなんかも同梱されていて結構サイズが大きく --depth=1 でもcloneに失敗するのでリモートでcloneしてrsyncしました.releasesのsource archiveから入手してもいいかもしれません.

zigにPATHを通してGhosttyのbuild
$ PATH=~/Downloads/zig-linux-x86_64-0.13.0/zig-linux-x86_64-0.13.0/:$PATH \
  zig build -Doptimize=ReleaseFast
$ ls zig-out/bin/ghostty
zig-out/bin/ghostty
Note

build時に以下のメッセージで数時間経っても進まなくなりました.Ctrl+cで中断して再度実行することで進みました.恐らく回線の問題.

Compile Build Script
└─ [53/46] Fetch Packages
   ├─ wuffs
   └─ iterm2_themes
Ghosttyを実行…… Segmentation fault
$ zig-out/bin/ghostty
info: ghostty version=1.0.2-main+60611b8
info: ghostty build optimize=ReleaseFast
info: runtime=apprt.Runtime.gtk
info: font_backend=font.main.Backend.fontconfig_freetype
info: dependency harfbuzz=8.4.0
info: dependency fontconfig=21402
info: renderer=renderer.OpenGL
info: libxev backend=main.Backend.io_uring
info(os): setlocale from env result=ja_JP.UTF-8
info(gtk): GTK version build=4.16.7 runtime=4.16.7
info(config): creating template config file: path=/home/matoken/.config/ghostty/config
warning(config): error creating template config file err=error.FileNotFound
info(config): default shell source=env value=/bin/bash
warning(sentry): crash report written to disk path=/home/matoken/.local/state/ghostty/crash/68ce5038-f588-4d61-ef88-4217099bbfc4.ghosttycrash
EGL API version 1.5 found
 - Vendor: Mesa Project
 - Version: 1.5
 - Device: /dev/dri/renderD128, 226 128
 - Client APIs: OpenGL OpenGL_ES
 - Extensions:
        EGL_ANDROID_blob_cache
        EGL_ANDROID_native_fence_sync
        EGL_ANGLE_sync_control_rate
        EGL_CHROMIUM_sync_control
        EGL_EXT_buffer_age
        EGL_EXT_config_select_group
        EGL_EXT_create_context_robustness
        EGL_EXT_image_dma_buf_import
        EGL_EXT_image_dma_buf_import_modifiers
        EGL_EXT_pixel_format_float
        EGL_EXT_query_reset_notification_strategy
        EGL_EXT_surface_compression
        EGL_EXT_swap_buffers_with_damage
        EGL_IMG_context_priority
        EGL_KHR_cl_event2
        EGL_KHR_config_attribs
        EGL_KHR_context_flush_control
        EGL_KHR_create_context
        EGL_KHR_create_context_no_error
        EGL_KHR_fence_sync
        EGL_KHR_get_all_proc_addresses
        EGL_KHR_gl_colorspace
        EGL_KHR_gl_renderbuffer_image
        EGL_KHR_gl_texture_2D_image
        EGL_KHR_gl_texture_3D_image
        EGL_KHR_gl_texture_cubemap_image
        EGL_KHR_image
        EGL_KHR_image_base
        EGL_KHR_image_pixmap
        EGL_KHR_no_config_context
        EGL_KHR_reusable_sync
        EGL_KHR_surfaceless_context
        EGL_KHR_swap_buffers_with_damage
        EGL_KHR_wait_sync
        EGL_MESA_configless_context
        EGL_MESA_drm_image
        EGL_MESA_gl_interop
        EGL_MESA_image_dma_buf_export
        EGL_MESA_query_driver
        EGL_MESA_x11_native_visual_id
        EGL_NOK_texture_from_pixmap
        EGL_WL_bind_wayland_display
 - Selected fbconfig: R8G8B8A8, depth 0, stencil 0
          high depth: none
Creating EGL context version 3.2 (debug:no, forward:no, legacy:no, es:no)
Using OpenGL backend EGL
info(gtk): libadwaita version build=1.6.2 runtime=1.6.2
error(gtk): Read method failed: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.Settings” on object at path /org/freedesktop/portal/desktop
Creating EGL context version 3.2 (debug:no, forward:no, legacy:no, es:no)
OpenGL version: 4.6 (core)
GLSL version: 4.60
Max texture size: 16384
Enabled features (use GDK_GL_DISABLE env var to disable):
    debug: ✓
    unpack-subimage: ✓
    half-float: ✓
    sync: ✓
    base-instance: ✓
    buffer-storage: ✓
OpenGL version: 4.6 (core)
GLSL version: 4.60
Max texture size: 16384
Enabled features (use GDK_GL_DISABLE env var to disable):
    debug: ✓
    unpack-subimage: ✓
    half-float: ✓
    sync: ✓
    base-instance: ✓
    buffer-storage: ✓

(ghostty:3475525): Gtk-WARNING **: 02:44:03.441: GtkImage 0x31a0b830 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.441: GtkImage 0x31a09b60 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.441: GtkImage 0x319c7740 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.442: GtkImage 0x31a79170 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.442: GtkImage 0x31a754f0 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.442: GtkImage 0x31a7b370 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.443: GtkImage 0x318aed70 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.443: GtkImage 0x31a812a0 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.443: GtkImage 0x31a80400 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.444: GtkImage 0x31a83150 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.444: GtkImage 0x319bb340 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.455: GtkImage 0x33e3da10 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.
Creating EGL context version 3.3 (debug:no, forward:no, legacy:no, es:no)
OpenGL version: 4.6 (core)
GLSL version: 4.60
Max texture size: 16384
Enabled features (use GDK_GL_DISABLE env var to disable):
    debug: ✓
    unpack-subimage: ✓
    half-float: ✓
    sync: ✓
    base-instance: ✓
    buffer-storage: ✓
info(grid): loaded OpenGL 4.6
info(io_exec): found Ghostty resources dir: /home/matoken/src/ghostty/zig-out/share/ghostty
info(io_exec): shell integration automatically injected shell=termio.shell_integration.Shell.bash
warning(gtk): unimplemented action=apprt.action.Action.Key.cell_size
warning(gtk): unimplemented action=apprt.action.Action.Key.size_limit
info(io_exec): started subcommand path=/bin/sh pid=3475569
info(io_exec): subcommand cgroup=-
error(gtk): Read method failed: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.Settings” on object at path /org/freedesktop/portal/desktop

(ghostty:3475525): Gtk-WARNING **: 02:44:03.490: GtkImage 0x33e52760 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.498: GtkImage 0x31a7b370 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.498: GtkImage 0x342b77c0 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.498: GtkImage 0x342b84c0 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.498: GtkImage 0x31a7f490 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.498: GtkImage 0x31a80400 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.499: GtkImage 0x31a821f0 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.506: GtkImage 0x31a7b370 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.506: GtkImage 0x342b77c0 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.506: GtkImage 0x342b84c0 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.506: GtkImage 0x33e52760 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.506: GtkImage 0x31a7f490 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.506: GtkImage 0x31a80400 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.506: GtkImage 0x31a821f0 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.506: GtkImage 0x33e3da10 reported baselines of minimum -2147483648 and natural -2147483648, but sizes of minimum 16 and natural 16. Baselines must be inside the widget size.

(ghostty:3475525): Gtk-WARNING **: 02:44:03.509: fb setup not supported (8cd6)

(ghostty:3475525): Gtk-WARNING **: 02:44:03.524: fb setup not supported (8cd6)

(ghostty:3475525): Gtk-WARNING **: 02:44:03.550: fb setup not supported (8cd6)

(ghostty:3475525): GLib-GObject-CRITICAL **: 02:44:03.634: g_object_ref: assertion 'G_IS_OBJECT (object)' failed

(ghostty:3475525): GLib-GObject-CRITICAL **: 02:44:03.634: g_object_ref: assertion 'G_IS_OBJECT (object)' failed
Segmentation fault

Segmentation faultになってしまいます.エラーメッセージで検索して以下のIssueを見つけました.

Dupe, best guess currently is a GTK bug. Please search to find similar discussions (not issues).

GTKのbugではとのことですがUbuntu版があるのでそちらではどうなってるのだろうと.debを入手して試してみます.

Ubuntu向けGhosttyの.debを入手してarchiveをmountして実行
$ wget2 -c -v https://github.com/mkasberg/ghostty-ubuntu/releases/download/1.0.1-0-ppa1/ghostty_1.0.1-0.ppa1_amd64_24.10.deb (1)
0 files                0% [<=>                                                                                                                                                                                          ]       0          B/s
                          [Files: 0  Bytes: 0  [0 B/s] Redirects: 1  Todo: 0  Errors: 1
$ fuse-archive ghostty_1.0.1-0.ppa1_amd64_24.10.deb (2)
fuse-archive: Created mount point 'ghostty_1.0.1-0.ppa1_amd64_24.10'
$ fuse-archive ghostty_1.0.1-0.ppa1_amd64_24.10/data.tar.zst ~/fuse/tmp (3)
fuse-archive: Using existing mount point '/home/matoken/fuse/tmp'
$ /home/matoken/fuse/tmp/usr/bin/ghostty (4)
  1. 一番環境の近そうなUbuntu 22.10 amd64版を入手

  2. fuse-archiveでmount(もしくはunarコマンドなどで展開)

  3. fuse-archiveで適当な場所にdata.tarをmount(もしくはtar xfなどで展開)

  4. Ghosttyを実行

Ubuntu向けGhosttyは起動しました.
debian/patchesを覗くと1つpatchがありますが関係が無さそう.試しに 000-libbz2.patch を適用してみましたがやはり起動できません.
https://github.com/mkasberg/ghostty-ubuntu/tree/main/debian/patches

resetしてもとに戻して今度は debian/rules を参考に zig build を試しましたがこれも動作変わらず.
https://github.com/mkasberg/ghostty-ubuntu/blob/main/debian/rules

GhosttyのIssueを探すとまさにDebian sid amd64での回答がありました.
最近のpangoの更新で引っかかるようになったようです.以下のbuild optionを指定することで回避できるようです.

Upd: just build with -fsys=fontconfig parameter

-fsys=fontconfig を付与してbuildし直し
$ PATH=~/Downloads/zig-linux-x86_64-0.13.0/zig-linux-x86_64-0.13.0/:$PATH \
  zig build -Doptimize=ReleaseFast -fsys=fontconfig
$ zig-out/bin/ghostty

動作するようになりました :)

ghostty debian sid

適当なPATHの通っている場所にcpしておく
$ rsync -av zig-out/* ~/usr/
$ which ghostty
/home/matoken/usr/bin/ghostty

ということで最近のDebian sid amd64環境などではしばらくはbuildオプションに -fsys=fontconfig を付けてあげる必要がありそうです.

$ zig build -Doptimize=ReleaseFast

$ zig build -Doptimize=ReleaseFast -fsys=fontconfig
環境
$ zig-out/bin/ghostty --version
Ghostty 1.0.2-main+60611b8

Version
  - version: 1.0.2-main+60611b8
  - channel: tip
Build Config
  - Zig version: 0.13.0
  - build mode : builtin.OptimizeMode.ReleaseFast
  - app runtime: apprt.Runtime.gtk
  - font engine: font.main.Backend.fontconfig_freetype
  - renderer   : renderer.OpenGL
  - libxev     : main.Backend.io_uring
  - GTK version:
    build      : 4.16.7
    runtime    : 4.16.7
  - libadwaita : enabled
    build      : 1.6.2
    runtime    : 1.6.2
  - libX11     : enabled
$ dpkg-query -W libgtk-4-dev libadwaita-1-dev git
git     1:2.45.2-1.3
libadwaita-1-dev:amd64  1.6.2-1
libgtk-4-dev:amd64      4.16.7+ds-1
$ dpkg-query -W libpango* gir1.2-pango-1.0 | grep -v i386
gir1.2-pango-1.0:amd64  1.55.0+ds-3
libpango-1.0-0:amd64    1.55.0+ds-3
libpango1.0-dev:amd64   1.55.0+ds-3
libpango1.0-doc
libpangocairo-1.0-0:amd64       1.55.0+ds-3
libpangoft2-1.0-0:amd64 1.55.0+ds-3
libpangomm-1.4-1
libpangomm-1.4-1v5:amd64        2.46.4-1+b2
libpangomm-1.4-dev:amd64        2.46.4-1+b2
libpangomm-2.48-1
libpangomm-2.48-1t64:amd64      2.54.0-1
libpangoxft-1.0-0:amd64 1.55.0+ds-3
$ lsb_release -dr
Description:    Debian GNU/Linux trixie/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2025/01/02/ghostty-build-in-debian-sid/feed/ 0
terminal-to-htmlコマンドで端末の結果をHTMLに変換する https://matoken.org/blog/2024/10/22/convert-terminal-results-to-html-with-terminal-to-html-command/ https://matoken.org/blog/2024/10/22/convert-terminal-results-to-html-with-terminal-to-html-command/#respond Mon, 21 Oct 2024 22:33:58 +0000 https://matoken.org/blog/?p=4170

先日 aha というコマンドを試しましたが,今回 terminal-to-html という似たコマンドを試してみました.

導入とhelp
$ go install github.com/buildkite/terminal-to-html/v3/cmd/terminal-to-html@latest
$ which terminal-to-html
/home/matoken/go/bin/terminal-to-html
$ terminal-to-html --help
terminal-to-html - turn ANSI in to HTML

STDIN/STDOUT USAGE:
  cat input.raw | terminal-to-html [arguments...] > out.html

WEBSERVICE USAGE:
  terminal-to-html --http :6060 &
  curl --data-binary "@input.raw" http://localhost:6060/terminal > out.html

OPTIONS:
  --http value              HTTP service mode (eg --http :6060), endpoint is /terminal
  --preview                 wrap output in HTML & CSS so it can be easily viewed directly in a browser (default: false)
  --log-stats-to-stderr     Logs a JSON object to stderr containing resource and processing statistics after successfully processing (default: false)
  --buffer-max-lines value  Sets a limit on the number of lines to hold in the screen buffer (and also limits the possible window height), allowing the renderer to operate in a streaming fashion and enabling the processing of large inputs. Setting to 0 disables the limit, causing the renderer to buffer the entire screen before producing any output (default: 300)
  --window-max-cols value   Sets an upper bound on the window width (which may change based on input). Window size mainly affects cursor movement sequences (default: 400)
  --window-cols value       Sets the initial window width. Window size mainly affects cursor movement sequences (default: 160)
  --window-lines value      Sets the initial window height. Window size mainly affects cursor movement sequences (default: 100)
  --help, -h                show help
  --version, -v             print the version

早速実行してみます.既定値ではヘッダーやフッターは付かないようです.

$ cowsay hello terminal | terminal-to-html
 ________________
&lt; hello terminal &gt;
 ----------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\&#47;\
                ||----w |
                ||     ||

次に --preview option を試します.HTML と CSS でラップしてくれます.aha コマンドでは表現されなかった cow のしっぽの点滅も再現できています.
しかしここに HTML を貼り付けたら WprdPress と干渉して色コードが下部のタグになったり改行が入ってしまったりとひどいことになったのでとりあえず静止画です.ちなみに Asciidoctor Reveal.js へは綺麗に貼り付けできました.

$ unbuffer apt moo moo | terminal-to-html --preview | xsel

terminal to html apt moo2

次にウェブサービスとして動かしてみます.http 経由で変換ができます.

$ terminal-to-html --http :6060 &
$ cowsay hello > input.raw
$ curl --data-binary "@input.raw" http://localhost:6060/terminal
 _______
&lt; hello &gt;
 -------
        \   ^__^
         \  (oo)\_______
            (__)\       )\&#47;\
                ||----w |
                ||     ||
$ kill %1
$ terminal-to-html --preview --http :6060 &
$ curl --data-binary "@input.raw" http://localhost:6060/terminal | head
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
1<!DOCTYPE html>
0<html>
1       <head>
5               <meta charset="UTF-8">
6               <title>terminal-to-html Preview</title>
                <style>.term-container {
   background: #171717;
1  border-radius: 5px;
0  color: white;
0 10005  100   151  6211k  95994 --:--:-- --:--:-- --:--:-- 9917k
curl: Failed writing body

aha の方が HTML 変換のオプションが多いけど,terminal-to-html は http server 昨日が合ったりとユニークな部分も.好みで使い分けると良さそうです.

環境
$ terminal-to-html --version
terminal-to-html version 3.16.3
$ dpkg-query -W golang curl
curl    8.10.1-2
golang:amd64    2:1.23~2
$ lsb_release -dr
Description:    Debian GNU/Linux trixie/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2024/10/22/convert-terminal-results-to-html-with-terminal-to-html-command/feed/ 0
tmux 3.5 release https://matoken.org/blog/2024/10/05/tmux-3-5-release/ https://matoken.org/blog/2024/10/05/tmux-3-5-release/#respond Fri, 04 Oct 2024 20:51:00 +0000 https://matoken.org/blog/?p=4107

tmux 3.5 がリリースされました。

早速build します。

$ sudo apt build-dep tmux (1)
$ sudo apt install libjemalloc-dev (2)
$ git clone https://github.com/tmux/tmux
$ cd tmux
$ git checkout 3.5
$ ./configure --enable-sixel \ (3)
              --enable-jemalloc \ (4)
              --prefix=$HOME/local (5)
$ make
$ make install
$ which tmux
/home/matoken/local/bin/tmux
$ tmux -V
tmux 3.5
  1. tmux の build に必要なパッケージを導入

  2. tmux 3.5 で新しく利用できるようになった --enable-jemalloc のためのパッケージ導入

  3. sixel を有効にする

  4. jemalloc を有効にする

  5. インストール場所を指定

数日使っていますが問題無さそうです。

しかし、tmux 3.5 は早かったですね。そういえば GNU screen 5.0.0 も最近出ました。

Note

tmux 3.3a: 2022-01-09
tmux 3.4: 2024-02-13
GNU screen 5.0.0: 2024-08-29
tmux 3.5: 2024-09-27

環境
$ tmux -V
tmux 3.5
$ lsb_release -dr
Description:    Debian GNU/Linux trixie/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2024/10/05/tmux-3-5-release/feed/ 0
ttyd でSixel https://matoken.org/blog/2024/01/05/sixel-with-ttyd/ https://matoken.org/blog/2024/01/05/sixel-with-ttyd/#respond Thu, 04 Jan 2024 20:28:20 +0000 https://matoken.org/blog/?p=3954

以前試したターミナルをWebで共有できるttyd のSixel の対応状況を確認してみると1つ前のリリースの 1,7.3 で対応しているようなので少し試してみました.

Sixel support is off by default now, use -t enableSixel=true to enable it.

以前試した時の記事.
* 端末をWeb共有できるttyd – matoken’s meme

オンラインでttyd を使いプレゼンテーションを試みた時のスライド.
* Terminalとウェブブラウザでプレゼンテーションの試み – Speaker Deck

GitHub のRelease にbinary があるけどsource からBuild してみました.

build
$ sudo apt install build-essential cmake git libjson-c-dev libwebsockets-dev
$ git clone https://github.com/tsl0922/ttyd.git
$ cd ttyd && mkdir build && cd build
$ cmake ..
$ make && make install
$ ./ttyd --version
ttyd version 1.7.4-fd280fe
$ ./ttyd
ttyd is a tool for sharing terminal over the web

USAGE:
    ttyd [options] <command> [<arguments...>]

VERSION:
    1.7.4-fd280fe

OPTIONS:
    -p, --port              Port to listen (default: 7681, use `0` for random port)
    -i, --interface         Network interface to bind (eg: eth0), or UNIX domain socket path (eg: /var/run/ttyd.sock)
    -U, --socket-owner      User owner of the UNIX domain socket file, when enabled (eg: user:group)
    -c, --credential        Credential for basic authentication (format: username:password)
    -H, --auth-header       HTTP Header name for auth proxy, this will configure ttyd to let a HTTP reverse proxy handle authentication
    -u, --uid               User id to run with
    -g, --gid               Group id to run with
    -s, --signal            Signal to send to the command when exit it (default: 1, SIGHUP)
    -w, --cwd               Working directory to be set for the child program
    -a, --url-arg           Allow client to send command line arguments in URL (eg: http://localhost:7681?arg=foo&arg=bar)
    -W, --writable          Allow clients to write to the TTY (readonly by default)
    -t, --client-option     Send option to client (format: key=value), repeat to add more options
    -T, --terminal-type     Terminal type to report, default: xterm-256color
    -O, --check-origin      Do not allow websocket connection from different origin
    -m, --max-clients       Maximum clients to support (default: 0, no limit)
    -o, --once              Accept only one client and exit on disconnection
    -B, --browser           Open terminal with the default system browser
    -I, --index             Custom index.html path
    -b, --base-path         Expected base path for requests coming from a reverse proxy (eg: /mounted/here, max length: 128)
    -P, --ping-interval     Websocket ping interval(sec) (default: 5)
    -6, --ipv6              Enable IPv6 support
    -S, --ssl               Enable SSL
    -C, --ssl-cert          SSL certificate file path
    -K, --ssl-key           SSL key file path
    -A, --ssl-ca            SSL CA file path for client certificate verification
    -d, --debug             Set log level (default: 7)
    -v, --version           Print the version and exit
    -h, --help              Print this text and exit

Visit https://github.com/tsl0922/ttyd to get more information and report bugs.
ttyd でbash を起動
$ ttyd -p 8080 --writable -t enableSixel=true /bin/bash
Note
  • 1.7.4 から --readonly オプションが --writable に変更になっています.
  • -t enableSixel=true でSixel を有効に出来ます.
Sixel で画像表示

ttyd sixel

sayaka ちゃんを起動

ttyd sayaka

環境
$ ./ttyd -v
ttyd version 1.7.4-fd280fe
$ dpkg-query -W build-essential cmake git libjson-c-dev libwebsockets-dev
build-essential 12.10
cmake   3.28.1-1
git     1:2.43.0-1
libjson-c-dev:amd64     0.17-1
libwebsockets-dev:amd64 4.3.3-1
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux trixie/sid
Release:        n/a
Codename:       trixie
$ arch
x86_64
]]>
https://matoken.org/blog/2024/01/05/sixel-with-ttyd/feed/ 0
VSCodium でもSixel https://matoken.org/blog/2023/11/14/sixel-in-vscodium/ https://matoken.org/blog/2023/11/14/sixel-in-vscodium/#respond Tue, 14 Nov 2023 08:52:19 +0000 https://matoken.org/blog/?p=3940

Microsoft VS Code も設定を有効にすることでSixel が使えるということで,Codium で試してみました.

こちらを見るとV1.79 以降で terminal.integrated.experimentalImageSupporttrue にすることで動くようです.

Visual Studio Code
Status: Supported
Must be enabled with “terminal.integrated.experimentalImageSupport”: true.

Uses xterm.js with xterm-addon-image, related PR: https://github.com/microsoft/vscode/pull/182442

— https://www.arewesixelyet.com/#visual-studio-code

チェックを付けて true にします.

terminal.integrated.enableImages

Integrated: Enable Images
ターミナルでイメージのサポートを有効にします。これは、 Terminal › Integrated: Gpu Acceleration が有効になっている場合にのみ機能します。Linux と macOS では、sixel と iTerm の両方のインライン イメージ プロトコルがサポートされています。ConPTY がシーケンスを通過すると、Windows のサポートが自動的に点灯します。現在、ウィンドウの再読み込み/再接続の間にイメージは復元されません。

Note

`これは、 Terminal › Integrated: Gpu Acceleration が有効になっている場合にのみ機能します。 ということで確認すると `auto になっていました.

terminal.integrated.gpuAcceleration

Integrated: Gpu Acceleration
ターミナルで GPU を利用してレンダリングを行うかどうかを制御します。

ちなみに,手元の環境はiGPUのHD Graphics 620 です.

$ lspci|grep VGA
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 620 (rev 02)

動きました :)

codium sixel

今環境がないので未確認ですが,VSCode でも同じ手順でSixel を試せそうです.

環境
$ codium --version
1.84.2
5a21cd9bd26def06f1b56c50933f812884617855
x64
$ lsb_release -dr
No LSB modules are available.
Description:    Debian GNU/Linux trixie/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2023/11/14/sixel-in-vscodium/feed/ 0
misskey クライアント sayaka ちゃん https://matoken.org/blog/2023/10/31/sayaka-chang_which_supports_misskey/ https://matoken.org/blog/2023/10/31/sayaka-chang_which_supports_misskey/#comments Tue, 31 Oct 2023 10:28:22 +0000 https://matoken.org/blog/?p=3921

「twitter クライアント sayaka ちゃん」が,「misskey クライアント sayaka ちゃん」 になっていたので試してみました.

sayaka ちゃんはターミナルに特化したクライアントで,SIXEL にも対応しているのでアイコンや画像つきでタイムラインを流すことができて便利です.
以前はTwitter クライアントですが,3.7.0 (2023/10/09) からTwitter への接続機能を廃止してMisskey 対応開始したようです.(–record などで保存していたファイルを –play で再生することはできる.※要configure option )

メール購読していたISSUE でsite 見に行って気づきました.

早速build します.

$ git clone https://github.com/isaki68k/sayaka
$ cd sayaka
$ sudo apt install libbsd-dev libwebp-dev libgif-dev libwslay1 libwslay-dev libmbedtls-dev libssl-dev bmake build-essential
$ ./configure
$ bmake -DRELEASE sayaka
$ install src/sayaka ~/bin/
$ sayaka
sayaka: No command option specified.
usage: sayaka [<options>...]
   command option:
        --local <server> : show <server>'s local timeline.
        --play : read JSON from stdin.
   other options:
        --color <n> : color mode { 2 .. 256 or x68k }. default 256.
        --font <width>x<height> : font size. default 7x14
        --full-url : display full URL even if the URL is abbreviated. (twitter)
        --light / --dark : Use light/dark theme. (default: auto detect)
        --no-color : disable all text color sequences
        --no-image : force disable (SIXEL) images.
        --force-sixel : force enable SIXEL images.
        --jis / --eucjp : Set output encoding.
        --progress: show startup progress (for very slow machines).
        --protect : don't display protected user's tweet. (twitter)
        --record <file> : record JSON to file.
        --record-all <file> : record all received JSON to file.
        --timeout-image <msec>
        --version
        --x68k : preset options for x68k (with SIXEL kernel).

        -4 / -6                         --ciphers <ciphers>
        --debug       <0-2>             --debug-format
        --debug-http  <0-2>             --debug-image <0-1>
        --debug-sixel <0-2>             --debug-show  <0-2>
        --mathalpha                     --no-combine
        --max-cont <n>                  --max-image-cols <n>
        --ormode <on|off> (default off) --palette <on|off> (default on)
Note
Linux 環境だとmake(GNU Make)ではなくbmake(bsd make) を使います.

現在は指定したMisskey サーバのローカルタイムラインの表示ができます.認証などは必要ありません.Misskey サーバについては以下のページを参考にすると良さそうです.

$ sayaka --local <servername>

動作確認には流量の多い misskey.io が良さそう.

$ sayaka --local misskey.io
Tip
サーバに https:// を付けるとホスト名の解決に失敗します
$ sayaka --local https://misskey.yukineko.me/
Ready...mbedtls_net_connect_nonblock https:443 - NET - Failed to get an IP address for the given hostname
sayaka: WebSocket connection failed
Tip
ローカルタイムラインを無効にしているサーバだと何も流れてきません.
$ sayaka --local misskey.yukineko.me
Ready...Connected

大量に流れてきます :)

misskey.io htl

NSFW画像は既定値ではぼかされます.表示したい場合は --show-nsfw オプションを付けると表示されます.
CW 投稿は既定値では展開されません.表示したいときは --show-cw オプションを付けると表示されます.

$ sayaka --show-nsfw --show-cw --local misskey.io

画像が表示されない場合は端末がSIXEL に対応しているか確認しましょう.そういえば最近は Microsoft Visual Studio Code も対応しているようです.(要設定変更※未検証)

laptop なんかでサスペンドしたりネットワークが切れると終了するので無限ループの中に入れたり.

$ while true; do sayaka --show-cw --show-nsfw --local nijimiss.moe --local misskey.io ; sleep 30; done
環境
$ sayaka --version
sayaka version 3.7.2 (2023/10/19)
$ dpkg-query -W libbsd-dev libwebp-dev libgif-dev libwslay1 libwslay-dev libmbedtls-dev libssl-dev bmake build-essential
bmake   20200710-16
build-essential 12.10
libbsd-dev:amd64        0.11.7-4
libgif-dev:amd64        5.2.1-2.5
libmbedtls-dev:amd64    2.28.5-1
libssl-dev:amd64        3.0.12-1
libwebp-dev:amd64       1.3.2-0.3
libwslay-dev:amd64      1.1.1-4
libwslay1:amd64 1.1.1-4
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux trixie/sid
Release:        n/a
Codename:       trixie
$ arch
x86_64
]]>
https://matoken.org/blog/2023/10/31/sayaka-chang_which_supports_misskey/feed/ 1
Sixel対応TerminalのBlack Boxを少し試す https://matoken.org/blog/2023/08/04/try-black-box-terminal-emulatr/ https://matoken.org/blog/2023/08/04/try-black-box-terminal-emulatr/#respond Thu, 03 Aug 2023 21:22:00 +0000 https://matoken.org/blog/?p=3914

Black Box というターミナルエミュレータを少し試してみました.

Note

Black box といえば(X11 window manager のBlackbox を思い受けべますが多分関係はない,Black Box は主にVala で書かれているようです.Vala で出来たTerminal というと軽量なvala-terminal というものをarmhf 環境で使っていたことがありましたがこれも特に関係はなさそうです.(vala-terminal は開発が止まっていそうでDebian からもdrop しているようです.)

導入

flatpack から導入かセルフビルドになるようです.

$ flatpak install flathub com.raggesilver.BlackBox
Looking for matches…
Required runtime for com.raggesilver.BlackBox/x86_64/stable (runtime/org.gnome.Platform/x86_64/44) found in remote flathub
Do you want to install it? [Y/n]:

com.raggesilver.BlackBox permissions:
    ipc     fallback-x11     wayland     x11    devices    file access [1]    dbus access [2]

    [1] host
    [2] org.freedesktop.Flatpak


        ID                                        Branch           Op           Remote            Download
 1. [✓] com.raggesilver.BlackBox.Locale           stable           i            flathub             9.3 kB / 290.9 kB
 2. [✓] org.gnome.Platform.Locale                 44               i            flathub           101.3 kB / 340.5 MB
 3. [✓] org.gnome.Platform                        44               i            flathub           248.4 MB / 323.4 MB
 4. [✓] com.raggesilver.BlackBox                  stable           i            flathub           555.3 kB / 746.4 kB

Installation complete.
$ flatpak info com.raggesilver.BlackBox

Black Box - A beautiful GTK 4 terminal

          ID: com.raggesilver.BlackBox
         Ref: app/com.raggesilver.BlackBox/x86_64/stable
        Arch: x86_64
      Branch: stable
     Version: 0.14.0
     License: GPL-3.0-or-later
      Origin: flathub
  Collection: org.flathub.Stable
Installation: system
   Installed: 2.7 MB
     Runtime: org.gnome.Platform/x86_64/44
         Sdk: org.gnome.Sdk/x86_64/44

      Commit: 9cf004e5bf5dfc847db69e6c3f9dcd2d27a8541d815a537af553a4d47545a583
      Parent: 1a3b7c86da1c662d5e793b03b83e9b02a4c151aea33fb03f07caaca1e576708a
     Subject: Remove session-bus permission (b58d6d98)
        Date: 2023-07-17 23:14:18 +0000

flatpack は結構依存関係が多いですね.
でもセルフビルドするにはもっと大量のディスクが必要だと思います…….とりあえずはflatpack で.

flatpack版起動

$ flatpak run com.raggesilver.BlackBox

BlackBox about

Sixel

Sixel に対応しているようなので試してみます.Sixel に対応した端末なら端末内で画像が表示可能です.X などが無くても対応端末であれば画像を表示できます.
img2sixel で画像表示……されません.なんでだろうと思ったら既定値では無効になっていて設定変更で動作しました.

「Prefarence」→「Advanced」→「Experimental」→「Sixel Support」

BlackBox Sixel

Sixel で画像出せます.

BlackBox Sixel dlogo

neofeth –slxel

BlackBox Sixel neofetch

Sixel の活用については以下のあたりを.

sudo/ssh環境でのヘッダーバーの色

通常時,sudo利用時,ssh接続時でヘッダーバーの色が変わります.(少しタイムラグあり)

通常時

BlackBox headerbar normal

sudo 実行時

BlackBox headerbar sudo

ssh 接続時

BlackBox headerbar ssh

Black Box非アクティブ時に終了したプロセスの通知

Black Box 非アクティブ時に終了したプロセスはデスクトップに通知が来ます.
通知は一定時間で消えてしまうのでPCから目を話している場合は気づけません.

BlackBox desktopnotify

環境
$ flatpak info com.raggesilver.BlackBox

Black Box - A beautiful GTK 4 terminal

          ID: com.raggesilver.BlackBox
         Ref: app/com.raggesilver.BlackBox/x86_64/stable
        Arch: x86_64
      Branch: stable
     Version: 0.14.0
     License: GPL-3.0-or-later
      Origin: flathub
  Collection: org.flathub.Stable
Installation: system
   Installed: 2.7 MB
     Runtime: org.gnome.Platform/x86_64/44
         Sdk: org.gnome.Sdk/x86_64/44

      Commit: 9cf004e5bf5dfc847db69e6c3f9dcd2d27a8541d815a537af553a4d47545a583
      Parent: 1a3b7c86da1c662d5e793b03b83e9b02a4c151aea33fb03f07caaca1e576708a
     Subject: Remove session-bus permission (b58d6d98)
        Date: 2023-07-17 23:14:18 +0000
$ dpkg-query -W flatpak libsixel-bin
flatpak 1.14.4-2
libsixel-bin    1.10.3-3
$ lsb_release -dr
No LSB modules are available.
Description:    Debian GNU/Linux trixie/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2023/08/04/try-black-box-terminal-emulatr/feed/ 0
mltermのAlt keyを使った単語移動 https://matoken.org/blog/2022/04/12/word-movement-using-alt-key-of-mlterm/ https://matoken.org/blog/2022/04/12/word-movement-using-alt-key-of-mlterm/#respond Mon, 11 Apr 2022 21:08:28 +0000 http://matoken.org/blog/?p=3591

単語単位での移動は Esc → f/b 可能です.しかしEsc押し直しが必要なのでたくさん移動するのには不向きです,
sakuraではAlt + f/b(→←) でAlt key押しっぱなしで移動できて便利だった.のですが,手元のmltermでは移動できません.
mltermでAlt+a/fを押すと「áæ」のアクセント文字が入力されるしまい手癖で入力してしまい消して書き直すといったことをしていました.

以下のページによるとmltermもAlt+f/bで単語移動するようです.

うまく行かないことをTwitterに書いたら教えてもらいました.

mlterm/doc/ja/README.ja より
o mod_meta_mode  (none/esc/*8bit*) (#)
  Meta キーを押下した時の挙動

ということで

$ echo "mod_meta_mode = esc" | tee -a ~/.mlterm/main

としてmltermを再起動することでAlt + f/bでの単語移動が実現できました :)

環境
$ dpkg-query -W mlterm*
mlterm  3.9.0-1+b1
mlterm-common   3.9.0-1+b1
mlterm-im-m17nlib
mlterm-im-scim
mlterm-im-uim
mlterm-tiny     3.9.0-1+b1
mlterm-tools    3.9.0-1+b1
$ lsb_release -dr
Description:    Debian GNU/Linux bookworm/sid
Release:        unstable
$ arch
x86_64
]]>
https://matoken.org/blog/2022/04/12/word-movement-using-alt-key-of-mlterm/feed/ 0
mltermでTwemoji利用 https://matoken.org/blog/2022/04/08/use-twemoji-with-mlterm/ https://matoken.org/blog/2022/04/08/use-twemoji-with-mlterm/#respond Thu, 07 Apr 2022 15:06:08 +0000 http://matoken.org/blog/?p=3582

最近端末ソフトウェアをmltermに切り替えようと設定しています.今回は絵文字にTwitter EmojiのTwemojiを使ってみました.

3.4.2で入ったようで,このときはgemojiを使っていたようですが,今見ると画像が見当たりません.

[Mlterm-dev-en mlterm 3.4.2 released]

以下のページを参考にTwemojiを使ってみました.

$ git -C ~/src/ clone --depth 1 https://github.com/twitter/twemoji.git (1)
$ ln -s ~/src/twemoji/assets/72x72 ~/.mlterm/emoji (2)
  1. 適当な場所にTwemojiをclone
  2. ~/.mlterm/emoji にシンボリックリンク

この状態でmltermを新規に起動してみると絵文字がTwemojiになりカラフルになりました :)

mlterm emoji

環境
$ dpkg-query -W mlterm*
mlterm  3.9.0-1
mlterm-common   3.9.0-1
mlterm-im-ibus  3.9.0-1
mlterm-tools    3.9.0-1
$ lsb_release -dr
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
$ arch
x86_64
]]>
https://matoken.org/blog/2022/04/08/use-twemoji-with-mlterm/feed/ 0
AWK製FPSゲームの「TERMMAZE3D」 https://matoken.org/blog/2021/06/14/termmaze3d/ https://matoken.org/blog/2021/06/14/termmaze3d/#comments Sun, 13 Jun 2021 15:20:14 +0000 http://matoken.org/blog/?p=3265

TERMMAZE3D という端末上で動作するAWK製のFPSゲームを見つけたので遊んでみました.

まずは依存コマンドを導入します.

Requirements
gawk or awk (except mawk)
GNU coreutils or equivalent BSD command (dd, echo, sleep, stty)

Linux環境ではGNU Coreutils + GNU awk,*bsd環境ではdd, echo, sleep, stty + nawk あたりでしょうか.今回はDebian bullseye 環境なのでこんな感じで.GNU Coreutils, GNU awk とリポジトリをclone するためにgit を導入します.

$ sudo apt install coreutils gawk git

source をclone します.

$ git clone https://github.com/mikkun/termmaze3d (1)
$ cd termmaze3d
$ ./termmaze3d.awk (2)
  1. TERMMAZE3Dをclone
  2. 実行

もし,実行時に真っ黒な画面になってしまう場合はawkが mawk に向いていると思うので次のページを参考にgawkに切り替えるか, $ gawk -f ./termmaze3d.awk のように gawk コマンドを直に叩くといいです.
端末サイズは80×22と比較的小さいのでフォントサイズを調整するといい感じになります.

ゲームは毎回自動生成されるマップの中を歩き回ってタイムアップする前に宝物を5つ集めるとクリアです.赤い敵が出てきますが当たるとタイムが減っていきます. k keyで攻撃したり逃げましょう.

以下プレイ動画です.


(backup)

awkでできたゲームといえば以前 awkaster というものもありました.同作者のテトリスライクなAWKTCもAWK製です.興味のある方はこれらも遊んでみるといいかもしれません.

環境1
$ git log --oneline
16e844a (HEAD -> main, tag: v1.0.0, origin/main, origin/HEAD) :tada: Initial co
$ dpkg-query -W gawk coreutils git
coreutils       8.32-4+b1
gawk    1:5.1.0-1
git     1:2.30.2-1
$ lsb_release -dr
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
$ arch
x86_64
環境2
$ git log --oneline
16e844a (HEAD -> main, tag: v1.0.0, origin/main, origin/HEAD) :tada: Initial co
$ dpkg-query -W gawk coreutils git
coreutils       8.30-3
gawk    1:4.2.1+dfsg-1
git     1:2.20.1-2+deb10u3
$ lsb_release -dr
Description:    Raspbian GNU/Linux 10 (buster)
Release:        10
$ arch
armv7l
]]>
https://matoken.org/blog/2021/06/14/termmaze3d/feed/ 1
ターミナルダッシュボードのWTFを少し試す https://matoken.org/blog/2021/03/27/try-terminal-dashboard-wtf/ https://matoken.org/blog/2021/03/27/try-terminal-dashboard-wtf/#respond Sat, 27 Mar 2021 14:13:52 +0000 http://matoken.org/blog/?p=3149

WTFというGo製のターミナルダッシュボードを見かけたので少し試してみました.

導入はLinuxのamd64/armv6/arm64,macOSのamd64/arm64はGitHub releaseページにあるのでそれを使うのが手っ取り早いです.
今回はarmv6をRaspberry Pi 3 Model BのRaspberry Pi OS armhfで試しました.

$ wget https://github.com/wtfutil/wtf/releases/download/v0.36.0/wtf_0.36.0_linux_armv6.tar.gz https://github.com/wtfutil/wtf/releases/download/v0.36.0/wtf_0.36.0_checksums.txt (1)
$ sha256sum -c ./wtf_0.36.0_checksums.txt 2>&1 | grep wtf_0.36.0_linux_armv6.tar.gz: (2)
wtf_0.36.0_linux_armv6.tar.gz: OK
$ tar tvf ./wtf_0.36.0_linux_armv6.tar.gz (3)
-rw-r--r-- ccummer/staff 34534 2021-03-23 19:20 wtf_0.36.0_linux_armv6/CHANGELOG.md
-rw-r--r-- ccummer/staff 14878 2018-12-01 01:13 wtf_0.36.0_linux_armv6/LICENSE.md
-rw-r--r-- ccummer/staff 39700 2021-03-20 13:46 wtf_0.36.0_linux_armv6/README.md
-rwxr-xr-x ccummer/staff 41615360 2021-03-23 19:35 wtf_0.36.0_linux_armv6/wtfutil
$ tar xf ./wtf_0.36.0_linux_armv6.tar.gz (4)
$ wtf_0.36.0_linux_armv6/wtfutil (5)
  1. Releases ページから最新のバイナリとチェックサムファイルを入手
  2. チェックサムファイルの中を見ると桁数的にsha256のようだったので,sha256sumでチェックサムを確認
  3. アーカイブの確認
  4. アーカイブの展開
  5. WTF起動

バイナリアーカイブをダウンロードして展開しました.
wtf_0.36.0_linux_armv6/wtfutil を実行すると既定値で起動します.しかし娘の設定だとターミナルサイズ固定だったりあまり嬉しくありません.

リポジトリの _sample_configs 以下にサンプルがあるのでこれを指定して起動してみます.

設定ファイルは既定値は ~/.config/wtf/config.yml を使います.存在しない場合はデフォルトのものが生成されます.若しくは wtf の -c, --config= オプションで指定した設定ファイルを指定できます.

$ wtf_0.36.0_linux_armv6/wtfutil --config=../src/wtf/_sample_configs/sample_config.yml

wtf 01

wtfリポジトリの _sample_configs/sample_config.yml を指定して起動するとこんな感じでターミナルサイズにも追従していい感じです.

wtf 02

diff --git a/_sample_configs/sample_config.yml b/_sample_configs/sample_config.yml
index e16690a0..fa3bf5c0 100644
--- a/_sample_configs/sample_config.yml
+++ b/_sample_configs/sample_config.yml
@@ -73,10 +73,21 @@ wtf:
         width: 1
       refreshInterval: 15
       sort: "alphabetical"
+    feedreader:
+      enabled: true
+      feeds:
+        - https://nitter.matoken.org/matoken1/rss
+      feedLimit: 10
+      position:
+        top: 1
+        left: 3
+        height: 1
+        width: 1
+      updateInterval: 14400
     battery:
       type: power
       title: "⚡"
-      enabled: true
+      enabled: false
       position:
         top: 1
         left: 3

Raspberry Piは電源ステータスは見えないので無効にして代わりにfeedreaderを有効にしてNitter経由でTwitterのRSSフィードを表示してみました.

日本語や絵文字も崩れず表示できて良さそうですね.

その他にもたくさんのモジュールがあるようです.こちらのページから確認できます.(Nitterを通さなくてもTwitterモジュールもあった)

自分の用途に合わせて設定していくと便利そうです.

環境
$ wtf_0.36.0_linux_armv6/wtfutil --version
0.36.0 (2021-03-23T10:33:30Z)
$ lsb_release -dr
Description:    Raspbian GNU/Linux 10 (buster)
Release:        10
$ uname -m
armv7l
$ cat /proc/device-tree/model ;echo
Raspberry Pi 3 Model B Rev 1.2
]]>
https://matoken.org/blog/2021/03/27/try-terminal-dashboard-wtf/feed/ 0
Twitterクライアントsayakaちゃんの最新版(3.5.0)をLinuxでビルドする https://matoken.org/blog/2021/03/06/build-the-latest-version-3-5-0-of-twitter-client-sayaka-on-linux/ https://matoken.org/blog/2021/03/06/build-the-latest-version-3-5-0-of-twitter-client-sayaka-on-linux/#respond Sat, 06 Mar 2021 13:32:34 +0000 http://matoken.org/blog/?p=3052

追記2021-03-09)
Raspberry Pi OS buster armhf 及び Ubuntu 21.04 (development branch) amd64でも同様にビルドできました :)

ターミナルで動作するTwitterクライアントとしてsayakaちゃんというものがあります.NetBSDの入ったSHARP X68030でも動作するという軽量なクライアントで,SIXELで画像が表示できたりストリームモードがあってハッシュタグなどを垂れ流すのに便利に使っています.

今日オープンソースカンファレンス2021 Online/Spring 2日目があって @ebijunさんの「NetBSDのご紹介」 を視聴していたのですが,新しいバージョンの 3.5.0 がリリースされたとのことで試してみました.

twitter クライアント sayaka ちゃん version 3.5.0 (2021/03/03)
ターミナルに特化した twitter クライアントです。

フィルタストリームの垂れ流しが出来ます。
フィルタストリームによる疑似ホームタイムラインが表示できます。
mlterm などの SIXEL 対応ターミナル用です。
X68030/25MHz、メモリ12MB でも快適(?)動作。
更新履歴
3.5.0 (2021/03/03) … C++ に移行し vala 版廃止。 画像は現在のところ JPEG, PNG のみ対応。 ターミナル背景色の自動取得を実装。 --protect、--support-evs オプション廃止。 --noimg オプションを廃止 (--no-image に変更)。 userstream 時代の録画データの再生機能廃止。

watchしてたけどメール届いていないようです?

sayaka watch

現在のバーションを確認してみます.1つ前のバージョンぽいですね.

$ sayaka --version
sayaka.vala 3.4.6 (2020/11/10)

ビルドを試みます.

$ git clone https://github.com/isaki68k/sayaka/ (1)
$ cd sayaka
$ git checkout 3.5.0
HEAD is now at 958f630 ver 3.5.0 (2021/03/03)
$ ./configure (2)
  1. sayakaのsourceをclone
  2. configure

足りないものがパッケージ名で表示されて助かります :)

configure: error: *** mbedtls not found.
        On Ubuntu, sudo apt install libmbedtls-dev
configure: error: *** mbedtls not found.
        On Ubuntu, sudo apt install libmbedtls-dev

./configure が通ったらmake……失敗です.

$ make
(cd src; make all)
make[1]: Entering directory '/home/matoken/src/sayaka/src'
Makefile:3: *** missing separator.  Stop.
make[1]: Leaving directory '/home/matoken/src/sayaka/src'
make: *** [Makefile:2: all] Error 2

必要なものをよく見ると,GNU makeではなく BSD make が必要となっていました.(3.4.6を確認するとこのときはGNU makeなので今回変わったようです)

必要なもの
C++17 compiler
jpeg (libjpeg)
libpng
mbedtls (2.9.0 or later?)
BSD make (not GNU make)

BSD makeを導入してGNU makeではなくBSD makeを使います.

$ sudo apt install bmake (1)
$ bmake sayaka (2)
$ src/sayaka --version (3)
sayaka version 3.5.0 (2021/03/03)
$ install src/sayaka ~/bin/ (4)
  1. BSD makeを導入
  2. BSD makeでsayakaをmake
  3. 出来上がったsayakaを叩いてみる
  4. sayakaを適当な場所( ~/bin )にコピーにinstall

ということでsayaka 3.5.0 にできました :)

私はmlterm等のSIXEL対応端末で検索したいキーワードを繋げていってデスクトップの横においておくといった感じで使っています.

環境
$ sayaka --version
sayaka version 3.5.0 (2021/03/03)
$ ldd src/sayaka | cut -f1 -d"(" | cut -f3 -d" " | xargs -n1 apt-file search | cut -f1 -d: | uniq | xargs dpkg-query -W | grep amd64
libbsd0:amd64   0.11.3-1
libc6:amd64     2.31-9
libgcc-s1:amd64 10.2.1-6
libjpeg62-turbo:amd64   1:2.0.6-2
libmbedcrypto3:amd64    2.16.9-0.1
libmbedtls12:amd64      2.16.9-0.1
libmbedx509-0:amd64     2.16.9-0.1
libmd0:amd64    1.0.3-3
libpng16-16:amd64       1.6.37-3
libstdc++6:amd64        10.2.1-6
zlib1g:amd64    1:1.2.11.dfsg-2
$ dpkg-query -W bmake build-essential
bmake   20200710-7
build-essential 12.9
$ lsb_release -dr
Description:    Debian GNU/Linux bullseye/sid
Release:        unstable
$ uname -m
x86_64
]]>
https://matoken.org/blog/2021/03/06/build-the-latest-version-3-5-0-of-twitter-client-sayaka-on-linux/feed/ 0
端末上で遊べる障害物避けゲームのascii runner https://matoken.org/blog/2018/07/11/ascii-runner-game-to-play-on-the-terminal/ https://matoken.org/blog/2018/07/11/ascii-runner-game-to-play-on-the-terminal/#respond Tue, 10 Jul 2018 20:02:04 +0000 http://matoken.org/blog/?p=1987

端末上で遊ぶ障害物をスペースバーでジャンプして避けるゲーム.自キャラの4本足の生き物の動きがコミカルです.でも案外難しい.
macOS/Linux のamd64 だったらバイナリやパッケージがあるのでそれを使うのが良いです.
buildする場合はこんな感じで(結構時間掛かった)

$ sudo apt install haskell-stack $ git clone https://github.com/smallhadroncollider/ascii-runner $ cd ascii-runner $ stack build $ stack install $ runner 
]]>
https://matoken.org/blog/2018/07/11/ascii-runner-game-to-play-on-the-terminal/feed/ 0