Микроблогинг в Gemini: tinylog и gtl / Microbloging in Gemini: tinylog and gtl
RU
Tinylog
В Gemini популярно вести свой блог. Люди пишут объёмные посты где высказывают свои мысли, переживания или делятся интересными находками. Писать легко и приятно благодаря gemtext разметке.
Но что делать если вы хотите поделиться короткой заметкой, шальной мыслью или ссылкой? Создавать пост для этого может показаться расточительством. Этой короткой заметкой можно поделиться на специальных платформах для микроблогинга, таких как Fediverse (Mastodon, Pleroma, Misskey) или Twitter. Но это не наш вариант, не так ли? Специально для тех, кто не хочет покидать Gemini люди придумали tinylog [1]!
[1] https://codeberg.org/bacardi55/gemini-tinylog-rfc
Tinylog это определённым образом отформатированный gemtext файл с короткими заметками.
Идея tinylog пришла к Drew/uoou/Friendo [2], он же подготовил большинство правил. Собрать же это всё в стандарт постарался bacardi55 [3]. Хочу выразить им мою благодарность.
[2] gemini://friendo.monster/log/lace.gmi
[3] gemini://gmi.bacardi55.io/
Файл с заметками форматируются следующим способом:
## 2021-06-20 20:40 +0200 A small thought to share. ## 2021-06-20 20:30 CEST A first tinylog entry
Новые заметки добавляются в начало файла.
Так же tinylog поддерживает ответы на чужие заметки. Для правильного форматирования можно выбрать один из следующих вариантов:
## 2021-06-20 22:30 CEST => gemini://capsule.tld/tinylog.gmi Re: @user 2021-06-20 22:30 CEST A response to @user: hello, cool post! ## 2021-06-20 22:30 CEST => gemini://capsule.tld/tinylog.gmi Re: @user@capsule.tld 2021-06-20 22:30 CEST A response to @user: hello, cool post! ## 2021-06-20 22:30 CEST Re: @user 2021-06-20 22:30 CEST A response to @user: hello, cool post! ## 2021-06-20 22:30 CEST Re: @user@capsule.tld 2021-06-20 22:30 CEST A response to @user: hello, cool post!
Ещё есть возможность добавить дополнительную информацию (никнейм, аватар), но для этого обязательно прочтите Tinylog RFC [1] от начала и до конца.
GTL
Но согласитесь, каждый раз писать дату, время, часовой пояс и только потом то что вы хотели сказать весьма муторно. Вот для таких лентяев как я господин bacardi55 [3] создал gtl.
GTL [4] это инструмент для удобного чтения, написания и ответа на tinylog заметки.
[4] https://github.com/bacardi55/gtl/
Сборка и установка GTL очень проста. Вам нужно иметь git и go версии >= 1.16.
git clone https://github.com/bacardi55/gtl.git cd gtl make dependencies make build
После чего можно создать ссылку для быстрого вызова gtl. Например:
ln -s ~/gtl/bin/gtl ~/.local/bin/gtl
После первого запуска gtl автоматически подпишется на "глобальную ленту" [5].
[5] gemini://tinylogs.gmi.bacardi55.io/index.gmi
Чтобы самостоятельно подписаться на чей-нибудь tinylog выполните:
add --url url --title title
gtl может работать в трёх режимах: TUI, CLI и Gemini.
TUI режим. Введите:
gtl
или
gtl --mode tui
После чего вы увидите интерфейс с двумя колонками. Слева список ваших подписок, а справа заметки. Прокручивать заметки можно стрелочками на клавиатуре или клавишами j/k. Чтобы написать новую заметку нажмите N. Для ответа вам сначала необходимо выбрать заметку на которую вы будете отвечать клавишами J/K, а затем нажать R. Выйти из программы можно нажав клавишу q. Для того чтобы узнать обо всех горячих клавишах нажмите ?.
CLI режим. Для использования CLI режима введите:
gtl --mode cli --limit 10
Это выведет последние 10 заметок из ваших подписок.
Gemini режим. gtl может создать полностью валидный gemtext файл, который можно прочесть любым gemini браузером. Например:
gtl --mode gemini --limit 10 > timeline.gmi
Файл с настройками программы создаётся при первом запуске по адресу ~/.config/gtl/gtl.toml Давайте посмотрим что мы можем в нём настроить и что изменил в нём я.
- subscribed_data = "~/.config/gtl/subs" - Путь по которому храниться файл с вашими подписками.
- date_format = "Mon 02 Jan 2006 15:04 MST" - Формат отображения даты. Я заменил его на date_format = "2006-01-02 15:04 MST"
- log_file = "/dev/null" - Путь по которому храниться файл с логами. У меня log_file = "/tmp/gtl.log"
- highlights = "@bacardi55, @bacardi, anything" - gtl может выделять слова из данного списка, например ваш никнейм.
- mode = "tui" - Стандартный режим в котором работает gtl.
- allow_edit = false - Возможность писать новые заметки из gtl. Нужна настроенная переменная $EDITOR. Изменяем на allow_edit = true
- tinylog_path = "path/to/tinylog/file.gmi" - Путь по которому храниться файл с вашими tinylog заметками.
- post_edit_script = "path/to/script" - Путь по которому храниться скрипт, который будет выполняться после редактирования вашего tinylog файла. У меня он состоит из четырёх строк: #!/usr/bin/bash && cd /home/razzlom/projects/gemini_capsule/ && git add users/razzlom/tinylog/tinylog.gmi && git commit -m "New tinylog entry!"
- post_edit_refresh = false - Обновление вашей ленты после редактирования вашего tinylog файла. Меняем на post_edit_refresh = true
- tui_copy_stub_clipboard = false - После включения этой настройки во время редактирования вашего tinylog файла нажмите Ctrl + V (или p) и вставится дата, время, часовой пояс, после чего вы сразу можете писать ваши мысли. Очень удобно! Необходим xclip или xsel. tui_copy_stub_clipboard = true
А теперь самое интересное! Вы можете изменить тему. Для этого в конец файла с настройками добавьте:
# Default (dark) theme: tui_color_background = "000000" tui_color_box = "FFFFFF" tui_color_focus_box = "008000" tui_color_author_name = "FF0000" tui_color_links = "87CEEB" tui_color_elapsed_time = "87CEEB" tui_color_text = "FFFFFF" tui_color_selected_background = "FFFFFF" tui_color_selected_foreground = "000000" tui_color_highlight = "FF0000" tui_color_quote = "808080"
И изменяйте на свой вкус!
А для вас, мои читатели, я приготовил подарок. Две готовые темы, gruvbox dark и gruvbox light. Перед установкой темы вы можете полюбоваться на неё по следующим ссылкам:
# gruvbox dark theme: tui_color_background = "282828" tui_color_box = "ebdbb2" tui_color_focus_box = "b8bb26" tui_color_author_name = "fb4934" tui_color_links = "d3869b" tui_color_elapsed_time = "b8bb26" tui_color_text = "ebdbb2" tui_color_selected_background = "ebdbb2" tui_color_selected_foreground = "282828" tui_color_highlight = "fb4934" tui_color_quote = "928374" # gruvbox light theme: tui_color_background = "fbf1c7" tui_color_box = "3c3836" tui_color_focus_box = "79740e" tui_color_author_name = "9d0006" tui_color_links = "8f3f71" tui_color_elapsed_time = "79740e" tui_color_text = "3c3836" tui_color_selected_background = "3c3836" tui_color_selected_foreground = "fbf1c7" tui_color_highlight = "9d0006" tui_color_quote = "7c6f64"
Спасибо за внимание! Надеюсь эта заметка была интересна и/или полезна для вас.
EN
Tinylog
Blogging is popular in Gemini. People write lengthy posts where they express their thoughts, experiences, or share interesting findings. Writing is nice and easy thanks to the gemtext markup.
But what if you want to share a short note, a stray thought, or a link? Creating a post for that might seem like a waste. That short note can be shared on dedicated microblogging platforms like Fediverse (Mastodon, Pleroma, Misskey) or Twitter. But that's not our option, is it? Especially for those who don't want to leave Gemini people came up with tinylog [1]!
[1] https://codeberg.org/bacardi55/gemini-tinylog-rfc
A tinylog is a formatted gemtext file with short notes.
Drew/uoou/Friendo [2] came up with the idea for tinylog and wrote most of the rules. It was bacardi55 [3] who compiled it all into a standard. I want to express my gratitude to them.
[2] gemini://friendo.monster/log/lace.gmi
[3] gemini://gmi.bacardi55.io/
The notes file is formatted as follows:
## 2021-06-20 20:40 +0200 A small thought to share. ## 2021-06-20 20:30 CEST. A first tinylog entry
New notes are added to the beginning of the file.
Tinylog also supports replying to other people's notes. For proper formatting you can choose one of the following options:
## 2021-06-20 22:30 CEST => gemini://capsule.tld/tinylog.gmi Re: @user 2021-06-20 22:30 CEST A response to @user: hello, cool post! ## 2021-06-20 22:30 CEST => gemini://capsule.tld/tinylog.gmi Re: @user@capsule.tld 2021-06-20 22:30 CEST A response to @user: hello, cool post! ## 2021-06-20 22:30 CEST Re: @user 2021-06-20 22:30 PM CEST A response to @user: hello, cool post! ## 2021-06-20 22:30 CEST Re: @user@capsule.tld 2021-06-20 22:30 CEST A response to @user: hello, cool post!
It's also possible to add additional information (nickname, avatar), but to do so, be sure to read Tinylog RFC [1] from beginning to end.
GTL
But agree, every time you write the date, time, time zone and only then what you want to say is quite lazy. For lazy people like me sir bacardi55 [3] created gtl.
GTL [4] is a tool for easy reading, writing and responding to tinylog notes.
[4] https://github.com/bacardi55/gtl/
Building and installing the GTL is very easy. You need to have git and go version >= 1.16.
git clone https://github.com/bacardi55/gtl.git cd gtl make dependencies make build
After that you can create a link to call gtl quickly. For example:
ln -s ~/gtl/bin/gtl ~/.local/bin/gtl
After the first run, gtl will automatically subscribe to the "global timeline" [5].
[5] gemini://tinylogs.gmi.bacardi55.io/index.gmi
To subscribe to someone's tinylog yourself, do
add --url url --title title
The gtl has three modes: TUI, CLI and Gemini.
TUI mode. Type:
gtl
or
gtl --mode tui
After that you will see an interface with two columns. On the left is a list of your subscriptions, and on the right are your notes. You can scroll through the notes with the keyboard arrows or with the j/k keys. To write a new note, press N. To reply, you first need to select the note you are going to reply to with the J/K keys and then press R. You can exit the program by pressing q. Press ? to see all hotkeys.
CLI mode. To use CLI mode, type:
gtl --mode cli --limit 10
This will display the last 10 notes from your subscriptions.
Gemini mode. gtl can create a fully valid gemtext file that can be read by any gemini browser. For example:
gtl --mode gemini --limit 10 > timeline.gmi
The file with the program's settings is created at the first startup at ~/.config/gtl/gtl.toml Let's see what we can set up in it and what I can change.
- subscribed_data = "~/.config/gtl/subs" - The path where the file with your subscriptions is stored.
- date_format = "Mon 02 Jan 2006 15:04 MST" - Date format. I replaced it with date_format = "2006-01-02 15:04 MST".
- log_file = "/dev/null" - The path where the log file is stored. I have log_file = "/tmp/gtl.log"
- highlights = "@bacardi55, @bacardi, anything" - gtl can highlight words from this list, such as your nickname.
- mode = "tui" - Standard mode in which gtl is working.
- allow_edit = false - Ability to write new notes from gtl. You need to have $EDITOR variable configured. Change it to allow_edit = true
- tinylog_path = "path/to/tinylog/file.gmi" - The path of the file with your tinylog notes.
- post_edit_script = "path/to/script" - The path for the script which will be executed after you edit your tinylog file. I have it in four lines: #!/usr/bin/bash && cd /home/razzlom/projects/gemini_capsule/ && git add users/razzlom/tinylog/tinylog.gmi && git commit -m "New tinylog entry!"
- post_edit_refresh = false - Refresh your feed after editing your tinylog file. Change to post_edit_refresh = true
- tui_copy_stub_clipboard = false - When you turn this on and you're editing your tinylog file, press Ctrl + V (or p) to put in the date, time, and time zone, and then you can write your thoughts right away. Very handy! You need xclip or xsel. tui_copy_stub_clipboard = true
And now the best part! You can change the theme. To do this, add at the end of the settings file:
# Default (dark) theme: tui_color_background = "000000" tui_color_box = "FFFFFFF" tui_color_focus_box = "008000" tui_color_author_name = "FF0000" tui_color_links = "87CEEB" tui_color_elapsed_time = "87CEEB" tui_color_text = "FFFFFFF" tui_color_selected_background = "FFFFFFFF" tui_color_selected_foreground = "00000000" tui_color_highlight = "FF0000" tui_color_quote = "808080"
And change it to your liking!
And for you, my readers, I've prepared a gift. Two ready-to-use themes, gruvbox dark and gruvbox light. Before installing the theme you can admire it at the following links:
# gruvbox dark theme: tui_color_background = "282828" tui_color_box = "ebdbb2" tui_color_focus_box = "b8bb26" tui_color_author_name = "fb4934" tui_color_links = "d3869b" tui_color_elapsed_time = "b8bb26" tui_color_text = "ebdbb2" tui_color_selected_background = "ebdbb2" tui_color_selected_foreground = "282828" tui_color_highlight = "fb4934" tui_color_quote = "928374" # gruvbox light theme: tui_color_background = "fbf1c7" tui_color_box = "3c3836" tui_color_focus_box = "79740e" tui_color_author_name = "9d0006" tui_color_links = "8f3f71" tui_color_elapsed_time = "79740e" tui_color_text = "3c3836" tui_color_selected_background = "3c3836" tui_color_selected_foreground = "fbf1c7" tui_color_highlight = "9d0006" tui_color_quote = "7c6f64"
Thank you for your attention! I hope this post was interesting and/or useful to you.
Source