nanotodon – matoken's blog https://matoken.org/blog Is there no plan B? Tue, 14 Jan 2025 20:01:00 +0000 ja hourly 1 https://wordpress.org/?v=7.0 https://matoken.org/blog/wp-content/uploads/2025/03/cropped-1865f695c4eecc844385acef2f078255036adccd42c254580ea3844543ab56d9-32x32.jpeg nanotodon – matoken's blog https://matoken.org/blog 32 32 nanotodon 0.5.0でSixel https://matoken.org/blog/2025/01/12/nanotodon-0-5-0/ https://matoken.org/blog/2025/01/12/nanotodon-0-5-0/#respond Sat, 11 Jan 2025 22:03:50 +0000 https://matoken.org/blog/?p=4365

CLI Mastodon clientのnanotodon 0.5.0がリリースされました.
Sixel対応のようです.

  • Sixelがある程度動くようになった

Sixelのつかいかた

Makefileを見てね!

ということでReleaseからsource archiveを入手したり,git cloneしてMakefileを見てみます.

$ wget2 -c -v https://github.com/taka-tuos/nanotodon/archive/refs/tags/0.5.0.tar.gz
$ tar tvf 0.5.0.tar.gz
$ cd nanotodon-0.5.0

or

$ git clone https://github.com/taka-tuos/nanotodon
$ cd nanotodon
$ git checkout -b 0.5.0

Sixel対応のため以下のように編集しました.(Webpはオプション)

$ git diff Makefile
diff --git a/Makefile b/Makefile
index 6332820..238c2ed 100644
--- a/Makefile
+++ b/Makefile
@@ -10,11 +10,11 @@ LDLIBS += -lcurl -lpthread -lm
 CFLAGS += -DSUPPORT_XDG_BASE_DIR

 # EXPERIMENTAL: sixel support
-#CFLAGS += -DUSE_SIXEL
+CFLAGS += -DUSE_SIXEL

 # EXPERIMENTAL: webp support
-#CFLAGS += -DUSE_WEBP
-#LDLIBS += -lwebp
+CFLAGS += -DUSE_WEBP
+LDLIBS += -lwebp

 # for pkgsrc
 #CFLAGS += -I/usr/pkg/include
Note

webpを無効にするとwebp形式の画像の表示に失敗します.画像は以下のものに差し替えられました.結構webpは多いので有効にしたほうが良さそうです.

err

View on Mastodon

buildします.

$ make

そしてnanotodonを実行.

$ ./nanotodon

アイコンや添付画像がSixelで表示されるようになりました :)

nanotodon sixel

Sixel対応端末については以下のページが参考になります.

今回はmltermの上でtmuxを動かし,その上でnanotodonを動かしました.
以下はtmuxの上の窓でnanotodon,下の窓でsayakaでMisskeyを表示しています.

nanotodonsayaka

楽しいです :)

環境
$ dpkg-query -W make gcc libcurl4t64 libblis64-4-pthread
gcc     4:14.2.0-1
libblis64-4-pthread:amd64       1.0-1+b1
libcurl4t64:amd64       8.11.1-1
make    4.4.1-1
$ lsb_release -dr
Description:    Debian GNU/Linux trixie/sid
Release:        n/a
$ arch
x86_64
]]>
https://matoken.org/blog/2025/01/12/nanotodon-0-5-0/feed/ 0
terminalで動作するMastodon clientのnanotodonを試してみた https://matoken.org/blog/2018/05/21/try-terminal-base-masodon-client-nanotodon/ https://matoken.org/blog/2018/05/21/try-terminal-base-masodon-client-nanotodon/#respond Mon, 21 May 2018 11:15:51 +0000 http://matoken.org/blog/?p=1891 mikutodonをDebian jessie armhfに入れてみた.Makefileを修正したら動いたけど文字化けする.ちなみにDebian sid amd64では問題なく動作した.

$ cat /etc/debian_version 
8.10
$ uname -m
armv7l

ライブラリ等導入

$ sudo apt install build-essential libcurl4-openssl-dev libjson-c-dev libncurses-dev libncursesw5
$ dpkg-query -W build-essential libcurl4-openssl-dev libjson-c-dev libncurses-dev libncursesw5
build-essential 11.7
libcurl4-openssl-dev:armhf      7.38.0-4+deb8u11
libjson-c-dev:armhf     0.11-4
libncurses-dev  
libncursesw5:armhf      5.9+20140913-1+deb8u2

<追記>
入ってない場合gitも必要ですね $ sudo apt install git
</追記>

source入手

$ git clone https://github.com/taka-tuos/nanotodon

make

コケた

$ cd nanotodon
$ make
make -r nanotodon
make[1]: Entering directory '/home/chip/src/nanotodon'
gcc -c -g -o nanotodon.o nanotodon.c
nanotodon.c: In function 'stream_event_notify':
nanotodon.c:110:12: warning: initialization discards 'const' qualifier from pointer target type
  char *t = json_object_get_string(notify_type);
            ^
nanotodon.c: At top level:
nanotodon.c:138:6: warning: conflicting types for 'stream_event_update'
 void stream_event_update(struct json_object *jobj_from_string)
      ^
nanotodon.c:128:3: note: previous implicit declaration of 'stream_event_update' was here
   stream_event_update(status);
   ^
nanotodon.c: In function 'stream_event_update':
nanotodon.c:180:14: warning: initialization discards 'const' qualifier from pointer target type
  char *src = json_object_get_string(content);
              ^
nanotodon.c:226:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
   for (int i = 0; i < json_object_array_length(media_attachments); ++i) {
   ^
nanotodon.c:226:3: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
nanotodon.c:245:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
   for(int i = 0; i < term_w - (l + 4); i++) waddstr(scr, " ");
   ^
nanotodon.c: At top level:
nanotodon.c:589:6: warning: conflicting types for 'do_htl'
 void do_htl()
      ^
nanotodon.c:303:2: note: previous implicit declaration of 'do_htl' was here
  do_htl();
  ^
nanotodon.c: In function 'do_htl':
nanotodon.c:618:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
   for (int i = json_object_array_length(jobj_from_string) - 1; i >= 0; i--) {
   ^
nanotodon.c: In function 'main':
nanotodon.c:751:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
  for(int i = 0; i < term_w; i++) mvaddch(5, i, '-');
  ^
nanotodon.c:777:4: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
    for(int i = 0; i < term_w; i++) mvaddch(5, i, '-');
    ^
nanotodon.c:802:3: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
   for(int i = 0; i < txt.stringlen; i++) {
   ^
Makefile.in:21: recipe for target 'nanotodon.o' failed
make[1]: *** [nanotodon.o] Error 1
make[1]: Leaving directory '/home/chip/src/nanotodon'
Makefile.in:11: recipe for target 'default' failed
make: *** [default] Error 2

Makefileを修正したら通った

diff --git a/Makefile b/Makefile
index ac1828f..a35ee6a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 TARGET         = nanotodon
 OBJS_TARGET    = nanotodon.o
 
-CFLAGS = -g
+CFLAGS = -g -std=gnu99
 LDFLAGS = 
 LIBS = -lc -lm -lcurl -ljson-c -lncursesw -lpthread
 

文字化け><

20180521_20:05:50-30304

Debian sid amd64ではMakefileの書き換えも必要なく文字化けもしない.

20180521_20:05:01-31796

$ cat /etc/debian_version 
buster/sid
$ uname -m
x86_64
$ dpkg-query -W build-essential libcurl4-openssl-dev libjson-c-dev libncurses-dev libncursesw5
build-essential 12.5
libcurl4-openssl-dev:amd64      7.60.0-1
libjson-c-dev:amd64     0.12.1-1.3
libncurses-dev:amd64    6.1+20180210-3
libncursesw5:amd64      6.1+20180210-3
]]>
https://matoken.org/blog/2018/05/21/try-terminal-base-masodon-client-nanotodon/feed/ 0