Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Terminal-based Telegram / WhatsApp client for Linux and macOS

License

NotificationsYou must be signed in to change notification settings

d99kris/nchat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LinuxMac
LinuxmacOS

nchat is a terminal-based chat client for Linux and macOS with support forTelegram and WhatsApp.

screenshot nchat

Features

  • Customizable color schemes and key bindings
  • Jump to unread chat
  • Message history cache with support for text export
  • Message read receipt
  • Receive / send markdown formatted messages
  • Reply / delete / edit / forward / send messages
  • List dialogs for selecting chats, contacts, emojis, files
  • Show user status (online, away, typing)
  • Toggle to view textized emojis vs. graphical
  • View / save media files (documents, photos, videos)
  • Send and display reactions

Usage

Usage:

nchat [OPTION]

Command-line Options:

-d, --confdir <DIR>    use a different directory than ~/.config/nchat-e, --verbose          enable verbose logging-ee, --extra-verbose   enable extra verbose logging-h, --help             display this help and exit-k, --keydump          key code dump mode-m, --devmode          developer mode-r, --remove           remove chat protocol account-s, --setup            set up chat protocol account-v, --version          output version information and exit-x, --export <DIR>     export message cache to specified dir

Interactive Commands:

PageDn      history next pagePageUp      history previous pageTab         next chatSh-Tab      previous chatCtrl-f      jump to unread chatCtrl-g      toggle show help barCtrl-l      toggle show contact listCtrl-n      goto chatCtrl-p      toggle show top barCtrl-q      quitCtrl-s      insert emojiCtrl-t      send fileCtrl-x      send messageCtrl-y      toggle show emojisKeyUp       select messageAlt-d       delete/leave current chatAlt-e       external editor composeAlt-i       auto-compose replyAlt-n       search contactsAlt-t       external telephone callAlt-/       find in chatAlt-?       find next in chatAlt-$       external spell checkAlt-,       decrease contact list widthAlt-.       increase contact list width

Interactive Commands for Selected Message:

Ctrl-d      delete selected messageCtrl-r      download attached fileCtrl-v      open/view attached fileCtrl-w      open linkCtrl-x      send reply to selected messageCtrl-z      edit selected messageAlt-c       copy selected message to clipboardAlt-q       jump to quoted/replied messageAlt-r       forward selected messageAlt-s       add/remove reaction on selected messageAlt-w       external message viewer

Interactive Commands for Text Input:

Ctrl-a      move cursor to start of lineCtrl-c      clear input bufferCtrl-e      move cursor to end of lineCtrl-k      delete from cursor to end of lineCtrl-u      delete from cursor to start of lineAlt-Left    move cursor backward one wordAlt-Right   move cursor forward one wordAlt-Backsp  delete previous wordAlt-Delete  delete next wordAlt-c       copy input buffer to clipboard (if no message selected)Alt-v       paste into input buffer from clipboardAlt-x       cut input buffer to clipboard

Supported Platforms

nchat is developed and tested on Linux and macOS. Current version has beentested on:

  • macOS Sequoia 15.5
  • Ubuntu 24.04 LTS

Install using Package Manager

macOS

Build / Install Stable Release using Brew

brew tap d99kris/nchatbrew install nchat

Optionally one can disable protocols using--without-whatsapp and--without-telegram, for example:

brew install nchat --without-telegram

Arch Linux

Build / Install Latest Git

yay -S nchat-git

Build / Install Stable Release

yay -S nchat

Build from Source

nchat consists of a large code-base (mainly the Telegram library tdlib), so beprepared for a relatively long first build time.

Get Source

git clone https://github.com/d99kris/nchat && cd nchat

Using make.sh script

If using macOS, Alpine, Arch, Fedora, Gentoo, Raspbian, Ubuntu or Void, onecan use themake.sh script provided.

Dependencies

./make.sh deps

Build / Install

./make.sh build && ./make.sh install

Manually

Dependencies

macOS

brew install gperf cmake openssl ncurses ccache readline help2man sqlite libmagic go

Arch

sudo pacman -S ccache cmake file go gperf help2man ncurses openssl readline sqlite zlib base-devel

Debian-based (Ubuntu, Raspbian, etc)

sudo apt install ccache cmake build-essential gperf help2man libreadline-dev libssl-dev libncurses-dev libncursesw5-dev ncurses-doc zlib1g-dev libsqlite3-dev libmagic-dev golang

Fedora

sudo dnf install git cmake clang golang ccache file-devel file-libs gperf readline-devel openssl-devel ncurses-devel sqlite-devel zlib-devel

Gentoo

sudo emerge -n dev-util/cmake dev-util/ccache dev-util/gperf sys-apps/help2man sys-libs/readline dev-libs/openssl sys-libs/ncurses sys-libs/zlib dev-db/sqlite sys-apps/file dev-lang/go

Void

sudo xbps-install base-devel go ccache cmake gperf help2man libmagick-devel readline-devel sqlite-devel file-devel openssl-devel

Build

mkdir -p build && cd build && cmake .. && make -s

Install

sudo make install

Advanced Build Options

By default nchat requires ~3.5GB RAM to build using G++ and ~1.5GB RAM withclang++, but it is possible to reduce the memory needed,seeBuilding on Low Memory Systems.

All nchat features are enabled by default, but it's possible to controlinclusion of some features using cmake flags, seeFeature Flags.

Getting Started

In order to configure / setup an account one needs to run nchat in setup mode:

nchat --setup

The setup mode prompts for phone number, which shall be entered with countrycode. Example:

$ nchat --setupProtocols:0. Dummy1. Telegram2. WhatsAppMd3. Exit setupSelect protocol (3): 1Enter phone number (ex. +6511111111): +6511111111Enter authentication code: xxxxxSuccesfully set up profile Telegram_+6511111111

If unsure of what phone number to enter, open the Telegram app on the phoneand press the menu button and use the number displayed there (omitting spaces,so for the below screenshot the number to enter is +6511111111).

screenshot telegram phone

Once the setup process is completed, the main UI of nchat will be loaded.

In order to set up multiple protocols/profiles, exit nchat and perform thesetup step again.

Troubleshooting

Refer toDebugging for details.

Telegram Group

A Telegram grouphttps://t.me/nchatusers isavailable for users to discuss nchat usage and related topics.

Security

User data is stored locally in~/.config/nchat. Default file permissionsonly allow user access, but anyone who can gain access to a user's privatefiles can also access the user's personal Telegram data. To protect againstthe most simple attack vectors it may be suitable to use disk encryption andto ensure~/.config/nchat is not backed up unencrypted.

Configuration

The following configuration files (listed with current default values) can beused to configure nchat.

~/.config/nchat/app.conf

This configuration file holds general application settings. Default content:

assert_abort=0attachment_prefetch=1attachment_send_type=1cache_enabled=1cache_read_only=0clipboard_copy_command=clipboard_has_image_command=clipboard_paste_command=clipboard_paste_image_command=coredump_enabled=0downloads_dir=emoji_list_all=0link_send_preview=1logdump_enabled=0message_delete=1proxy_host=proxy_pass=proxy_port=proxy_user=timestamp_iso=0use_pairing_code=0use_qr_terminal=0version_used=

assert_abort

Specifies whether to abort execution (crash) if assertions fail. Primarilyintended for debugging.

attachment_send_type

Specifies whether to detect file type (audio, video, image, document) and sendattachments as those types, instead of sending all attachments as documenttype (which typically leaves original file content intact).

attachment_prefetch

Specifies level of attachment prefetching:

0 = no prefetch (download upon open/save)1 = selected (download upon message selection) <- default2 = all (download when message is received)

cache_enabled

Specifies whether to enable cache functionality.

cache_read_only

Specifies whether to access cache read-only. Primarily intended for debugging.

clipboard_*_command

Specifies custom clipboard commands to be used instead of system clipboard.Refer toClipboard for details.

coredump_enabled

Specifies whether to enable core dumps on application crash.

downloads_dir

Specifies a custom downloads directory path to save attachments to. If notspecified, the default dir is~/Downloads if exists, otherwise~.

emoji_list_all

Specifies whether the emoji dialog should list all emojis, it is otherwiserestricted to listing emojis that renders properly in common terminals.

link_send_preview

Specifies whether to enable preview for links in messages sent (Telegram only).

logdump_enabled

Specifies whether to dump warning and error log messages to stdout upon exit.

message_delete

Specifies handling of message deletion by other users (WhatsApp only):

1 = erase message <- default2 = replace message with [Deleted] text3 = prefix message with [Deleted] text

proxy_

SOCKS5 proxy server details. To enable proxy usage the parametershost andport are required, whileuser andpass are optional (depending on theSOCKS server). Note: In order to use a proxy while setting up nchat the firsttime, it is recommended to first run nchat without arguments (nchat) for itsconfig dir to be created, and then edit proxy settings in~/.config/nchat/app.conf as needed, before runningnchat -s to setup anaccount.

timestamp_iso

Specifies whether to use ISO-style timestamps (YYYY-MM-DD HH:MM) in the UIand at export of chat history. By default nchat uses a dynamic "human-friendly"format:

  • HH:MM for timestamps on same date as today, e.g.19:00
  • DAY HH:MM for timestamps in the last week, e.g.Mon 19:00
  • DD MMM HH:MM for timestamps in the current year, e.g.14 Nov 19:00
  • DD MMM YYYY HH:MM for timestamps in non-current year, e.g.14 Nov 2022 19:00
  • DD MMM YYYY HH:MM for timestamps during export, e.g.14 Nov 2022 19:00

use_pairing_code

Stores the environment variable flagUSE_PAIRING_CODE if set during setup.It specifies whether to use pairing code instead of QR code (WhatsApp only).

use_qr_terminal

Stores the environment variable flagUSE_QR_TERMINAL if set during setup.It specifies whether to display QR code in the terminal, disabling detectionof GUI capability for displaying images (WhatsApp only).

version_used

For internal use only. Stores version used for last successful execution. Maybe used for debugging startup crash / hang regressions.

~/.config/nchat/ui.conf

This configuration file holds general user interface settings. Default content:

attachment_indicator=📎attachment_open_command=away_status_indication=0auto_compose_command=auto_compose_enabled=0auto_compose_history_count=25auto_select_chat_timeout_sec=1call_command=chat_picker_sorted_alphabetically=0confirm_deletion=1confirm_send_pasted_image=1desktop_notify_active_current=0desktop_notify_active_noncurrent=0desktop_notify_command=desktop_notify_connectivity=0desktop_notify_enabled=0desktop_notify_inactive=0downloadable_indicator=+emoji_enabled=1entry_height=4failed_indicator=✗file_picker_command=file_picker_persist_dir=1help_enabled=1home_fetch_all=0linefeed_on_enter=1link_open_command=list_enabled=1list_width=14listdialog_show_filter=1mark_read_any_chat=0mark_read_on_view=1mark_read_when_inactive=0message_edit_command=message_open_command=muted_indicate_unread=1muted_notify_unread=0muted_position_by_timestamp=1notify_every_unread=1online_status_share=1online_status_dynamic=1phone_number_indicator=proxy_indicator=🔒read_indicator=✓reactions_enabled=1spell_check_command=status_broadcast=1syncing_indicator=⇄terminal_bell_active=0terminal_bell_inactive=1terminal_title=top_enabled=1top_show_version=0transfer_send_caption=1typing_status_share=1unread_indicator=*

attachment_indicator

Specifies text to prefix attachment filenames in message view.

attachment_open_command

Specifies a custom command to use for opening/viewing attachments. Thecommand shall include%1 which will be replaced by the filenameto open. If not specified, the following default commands are used:

Linux:xdg-open >/dev/null 2>&1 '%1' &

macOS:open '%1' &

Note: Omit the trailing& for commands taking over the terminal, forexamplew3m -o confirm_qq=false '%1' andsee '%1'.

away_status_indication

Specifies whether to indicate away status in the top bar while sharing awaystatus with other users. I.e. the status will readAway instead ofOnlinewhen the terminal is inactive (assumingonline_status_share=1 andonline_status_dynamic=1).

auto_compose_command

Specifies a custom command to use to auto-compose message reply. Thecommand shall include%1 which will be replaced by the path of a temporarytext file with message history. If not specified, the following defaultcommand is used:

(prefix)/libexec/nchat/compose -c '%1'

Refer toAuto-Compose for details.

auto_compose_enabled

Specifies whether to enable using auto-compose. The reason for not enablingit by default is that thecompose tool may use third-party services (if APIkey is set up in the shell environment) that can incur costs.

auto_compose_history_count

Specifies the maximum number of chat messages up to latest (or currentselected) to pass to the auto-compose tool.

auto_select_chat_timeout_sec

Specifies a timeout after receiving previous history sync message (withtimestamp before the application went online) for automatically settingcurrent chat. If disabled (value 0) current chat will only be set uponany user input, or receiving a message with timestamp after applicationwent online (connected to server).

call_command

Specifies a custom command to use for starting a call using an externaltool. The command shall include%1 which will be replaced by the phonenumber of the contact. If not specified, the following default commandsare used:

Linux:xdg-open >/dev/null 2>&1 'tel://%1' &

macOS:open 'tel://%1' &

chat_picker_sorted_alphabetically

Specifies whether the chat selection dialog (used when forwarding message)should be sorted alphabetically. If not, its order follows the main chatlist order.

confirm_deletion

Specifies whether to prompt the user for confirmation when deleting a messageor a chat.

confirm_send_pasted_image

Specifies whether to prompt the user for confirmation when pasting an imageto a chat.

desktop_notify_active_current

Specifies whether new message in current chat shall trigger desktopnotification when nchat terminal window is active.

desktop_notify_active_noncurrent

Specifies whether new message in non-current chat shall trigger desktopnotification when nchat terminal window is active.

desktop_notify_command

Specifies a custom command to use for desktop notifications. The command mayinclude%1 (will be replaced bysender name orgroup name - sender name)and%2 (will be replaced bymessage text) enclosed in single quotes (toprevent shell injection). Default command used, if not specified:

Linux:notify-send 'nchat' '%1: %2'

macOS:osascript -e 'display notification "%1: %2" with title "nchat"'

desktop_notify_connectivity

Specifies whether change of connectivity status (going offline or back online)shall trigger desktop notification.

desktop_notify_enabled

Specifies whether desktop notifications are permitted. Simply enabling thisparameter will not display notifications, unless otherdesktop_notify_*parameters are enabled.

desktop_notify_inactive

Specifies whether new message shall trigger desktop notification when nchatterminal window is inactive.

downloadable_indicator

Specifies text to suffix attachment filenames in message view for attachmentsnot yet downloaded. This is only shown forattachment_prefetch < 2.

emoji_enabled

Specifies whether to display emojis. Controlled by Ctrl-y in run-time.

entry_height

Specifies height of text entry area.

failed_indicator

Specifies text to suffix attachment filenames in message view for faileddownloads.

file_picker_command

Specifies a command to use for file selection, in place of the internal fileselection dialog used when sending files. The command shall include%1 (atemporary file path) which the command should write its result to. Examples:

nnn:nnn -p '%1'

ranger:ranger --choosefiles='%1'

file_picker_persist_dir

Specifies whether the file selection dialog shall persist the directory oflast selected file.

help_enabled

Specifies whether to display help bar. Controlled by Ctrl-g in run-time.

home_fetch_all

Specifies whetherhome button shall repeatedly fetch all chat history.

linefeed_on_enter

Specifies if enter key press should be read as linefeed (LF\12).Otherwise read as carriage return (CR\15). This setting is onlyrelevant ifkey.conf uses numerical key value for enter (LF\12,CR\15). The key nameKEY_RETURN always maps to the one in use.

link_open_command

Specifies a custom command to use for opening/viewing links. Thecommand shall include%1 which will be replaced by the urlto open. If not specified, the following default commands are used:

Linux:xdg-open >/dev/null 2>&1 '%1' &

macOS:open '%1' &

Note: Omit the trailing& for commands taking over the terminal, forexamplew3m -o confirm_qq=false '%1' andsee '%1'.

list_enabled

Specifies whether to display chat list. Controlled by Ctrl-l in run-time.

list_width

Specifies width of chat list.

listdialog_show_filter

Specifies whether list dialogs should display the search filter input by user.

mark_read_any_chat

Specifies whether nchat may mark messages as read before current chat hasbeen set (either through user activity or time elapsed since last old syncmessage was received).

mark_read_on_view

Specifies whether nchat should send message read receipts upon viewing. Iffalse nchat will only mark the messages read uponnext_page (page down),end (end) or upon sending a message/file in the chat.

mark_read_when_inactive

Controls whether nchat marks messages in the current chat as read while theterminal is inactive.

message_edit_command

Specifies a custom command to use for external editor compose. If notspecified, nchat will useEDITOR environment variable if set, orotherwise usenano.

message_open_command

Specifies a custom command to use for opening/viewing message text part. Ifnot specified, nchat will usePAGER environment variable if set, orotherwise useless.

muted_indicate_unread

Specifies whether chat list should indicate unread status* for muted chats.This also determines whether the such chats are included in jump to unread.

muted_notify_unread

Specifies whether to notify (terminal bell) new unread messages in muted chats.

muted_position_by_timestamp

Specifies whether chat list position of muted chats should reflect the time oftheir last received/sent message. Otherwise muted chats are listed last.

notify_every_unread

Specifies whether to notify upon receiving more messages in an unread chat.

online_status_share

Share online status with other users.Note: Disabling this stops updates on other users online/typing status forWhatsApp.

online_status_dynamic

Dynamically update online status based on terminal active state.Note: Enabling this stops updates on other users online/typing status forWhatsApp when the terminal is not active.

phone_number_indicator

Specifies status bar text to indicate phone number of the current chat isavailable. This field may contain%1 which will be replaced with the actualphone number of the contact. Other examples:🎧

proxy_indicator

Specifies top bar text to indicate proxy is enabled.

read_indicator

Specifies text to indicate a message has been read by the receiver.

reactions_enabled

Specifies whether to display reactions.

spell_check_command

Specifies a custom command to use for spell checking composed messages. If notspecified, nchat checks ifaspell orispell is available on the system (inthat order), and uses the first found.

status_broadcast

Specifies (WhatsApp) Status Updates chat level of visibility:

0 = hidden1 = visible and muted  <- default2 = visible

syncing_indicator

Specifies text to suffix attachment filenames in message view for downloadsin progress.

terminal_bell_active

Specifies whether new message shall trigger terminal bell when nchat terminalwindow is active.

terminal_bell_inactive

Specifies whether new message shall trigger terminal bell when nchat terminalwindow is inactive.

terminal_title

Specifies custom terminal title, ex:terminal_title=nchat - telegram.

top_enabled

Specifies whether to display top bar. Controlled by Ctrl-p in run-time.

top_show_version

Specifies whether to display nchat version in top bar.

transfer_send_caption

Specifies if entered text should be sent as caption when transferring a file.

typing_status_share

Specifies whether to share typing status with other user(s) in theconversation.

unread_indicator

Specifies the character to suffix chats with unread messages in the chat list.

~/.config/nchat/key.conf

This configuration file holds user interface key bindings. Default content:

auto_compose=\33\151backspace=KEY_BACKSPACEbackspace_alt=KEY_ALT_BACKSPACEbackward_kill_word=\33\177backward_word=begin_line=KEY_CTRLAcancel=KEY_CTRLCclear=KEY_CTRLCcopy=\33\143cut=\33\170decrease_list_width=\33\54delete=KEY_DCdelete_chat=\33\144delete_line_after_cursor=KEY_CTRLKdelete_line_before_cursor=KEY_CTRLUdelete_msg=KEY_CTRLDdown=KEY_DOWNedit_msg=KEY_CTRLZend=KEY_ENDend_line=KEY_CTRLEext_call=\33\164ext_edit=\33\145find=\33\57find_next=\33\77forward_msg=\33\162forward_word=goto_chat=KEY_CTRLNhome=KEY_HOMEincrease_list_width=\33\56jump_quoted=\33\161kill_word=left=KEY_LEFTlinebreak=KEY_RETURNnext_chat=KEY_TABnext_page=KEY_NPAGEok=KEY_RETURNopen=KEY_CTRLVopen_link=KEY_CTRLWopen_msg=\33\167other_commands_help=KEY_CTRLOpaste=\33\166prev_chat=KEY_BTABprev_page=KEY_PPAGEquit=KEY_CTRLQreact=\33\163right=KEY_RIGHTsave=KEY_CTRLRselect_contact=\33\156select_emoji=KEY_CTRLSsend_msg=KEY_CTRLXspell=\33\44terminal_focus_in=KEY_FOCUS_INterminal_focus_out=KEY_FOCUS_OUTterminal_resize=KEY_RESIZEtoggle_emoji=KEY_CTRLYtoggle_help=KEY_CTRLGtoggle_list=KEY_CTRLLtoggle_top=KEY_CTRLPtransfer=KEY_CTRLTunread_chat=KEY_CTRLFup=KEY_UP

The key bindings may be specified in the following formats:

  • Ncurses macro (ex:KEY_CTRLK)
  • Hex key code (ex:0x22e)
  • Octal key code sequence (ex:\033\177)
  • Plain-text single-char ASCII (ex:r)
  • Disable key binding (KEY_NONE)

To determine the key code sequence for a key, one can run nchat in key codedump modenchat -k which will output the octal code, and ncurses macro name(if present).

~/.config/nchat/color.conf

This configuration file holds user interface color settings. Default content:

default_color_bg=default_color_fg=dialog_attr=dialog_attr_selected=reversedialog_color_bg=dialog_color_fg=entry_attr=entry_color_bg=entry_color_fg=help_attr=reversehelp_color_bg=blackhelp_color_fg=whitehistory_name_attr=boldhistory_name_attr_selected=reversehistory_name_recv_color_bg=history_name_recv_color_fg=history_name_recv_group_color_bg=history_name_recv_group_color_fg=history_name_sent_color_bg=history_name_sent_color_fg=grayhistory_text_attachment_color_bg=history_text_attachment_color_fg=grayhistory_text_attr=history_text_attr_selected=reversehistory_text_quoted_color_bg=history_text_quoted_color_fg=grayhistory_text_reaction_color_bg=history_text_reaction_color_fg=grayhistory_text_recv_color_bg=history_text_recv_color_fg=history_text_recv_group_color_bg=history_text_recv_group_color_fg=history_text_sent_color_bg=history_text_sent_color_fg=graylist_attr=list_attr_selected=reverselist_color_bg=list_color_fg=list_color_unread_bg=list_color_unread_fg=listborder_attr=listborder_color_bg=listborder_color_fg=status_attr=reversestatus_color_bg=status_color_fg=top_attr=reversetop_color_bg=top_color_fg=

Supported text attributes_attr (defaults tonormal if not specified):

normalunderlinereversebolditalic

Supported text background_bg and foreground_fg colors:

blackredgreenyellowbluemagentacyanwhitegraybright_black (same as gray)bright_redbright_greenbright_yellowbright_bluebright_magentabright_cyanbright_white

Custom colors may be specified using hex RGB code, for example0xff8937.

Thehistory_name_recv_group_color andhistory_text_recv_group_colorparameters also supports the special valueusercolor. When set, nchat willdetermine which color to use for a user, based on a hash of their user idused to pick a color from the list in~/.config/nchat/usercolor.conf.

Themes

Example color config files are provided in$(dirname $(which nchat))/../share/nchat/themesand can be used by copying to~/.config/nchat/.

Default Theme

cp $(dirname $(which nchat))/../share/nchat/themes/default/* ~/.config/nchat/

screenshot nchat

Basic Color Theme

cp $(dirname $(which nchat))/../share/nchat/themes/basic-color/* ~/.config/nchat/

screenshot nchat

Dracula Theme

cp $(dirname $(which nchat))/../share/nchat/themes/dracula/* ~/.config/nchat/

screenshot nchat

iTerm2-Color-Schemes Themes

iTerm2 Color Schemes canbe used to generate themes for nchat. The following themes generated usingiTerm2 Color Schemes are available in$(dirname $(which nchat))/../share/nchat/themes:

  • Catppuccin Mocha:cp $(dirname $(which nchat))/../share/nchat/themes/catppuccin-mocha/* ~/.config/nchat/
  • Espresso:cp $(dirname $(which nchat))/../share/nchat/themes/espresso/* ~/.config/nchat/
  • Gruvbox Dark:cp $(dirname $(which nchat))/../share/nchat/themes/gruvbox-dark/* ~/.config/nchat/
  • Solarized Dark Higher Contrast:cp $(dirname $(which nchat))/../share/nchat/themes/solarized-dark-higher-contrast/* ~/.config/nchat/
  • Tokyo Night:cp $(dirname $(which nchat))/../share/nchat/themes/tokyo-night/* ~/.config/nchat/
  • Tomorrow Night:cp $(dirname $(which nchat))/../share/nchat/themes/tomorrow-night/* ~/.config/nchat/
  • Zenbones Dark:cp $(dirname $(which nchat))/../share/nchat/themes/zenbones-dark/* ~/.config/nchat/
  • Zenburned:cp $(dirname $(which nchat))/../share/nchat/themes/zenburned/* ~/.config/nchat/

To generate additional nchat themes and install for use withnchat, refer toGenerating nchat themes from iTerm2 Color Schemes.

General

Deleting a configuration entry line (while nchat is not running) and startingnchat will populate the configuration file with the default entry.

Protocol-Specific Configuration

The following configuration files (listed with current default values) can beused to configure nchat.

~/.config/nchat/profiles/Telegram_+nnnnn/telegram.conf

This configuration file holds protocol-specific settings for Telegram. Defaultcontent:

local_key=markdown_enabled=1markdown_version=1profile_display_name=

local_key

For internal use by nchat only.

markdown_enabled

Specifies whether to enable Markdown <-> text conversion for text messages(default enabled).

markdown_version

Specifies which Telegram Markdown version to use (default 1).

profile_display_name

Specifies an optional short/display name in the status bar when using nchatwith multiple profiles. The default profile name isTelegram orTelegram_+nnnnn (when more than one Telegram profile is set up) if thissetting is not specified.

~/.config/nchat/profiles/WhatsAppMd_+nnnnn/whatsappmd.conf

This configuration file holds protocol-specific settings for WhatsApp. Defaultcontent:

profile_display_name=

profile_display_name

Specifies an optional short/display name in the status bar when using nchatwith multiple profiles. The default profile name isWhatsAppMd orWhatsAppMd_+nnnnn (when more than one WhatsAppMd profile is set up) if thissetting is not specified.

FAQ

1. Alt/Opt-keyboard shortcuts are not working?

For Linux please ensure the terminal is configured withmeta to send escape.For macOS Terminal ensure that the Terminal profile keyboard setting"Use Option as Meta key" is enabled.

If issues are still encountered, please usenchat -k (keydump mode) todetermine the key codes and modify~/.config/nchat/key.conf accordingly.

2. Send messages with Enter key?

To simply send on enter key press and skip message compose with linebreaks,one can just setsend_msg=KEY_RETURN in~/.config/nchat/key.conf.

To also be able to compose messages with linebreaks using Alt/Opt-Enter, edit~/.config/nchat/ui.conf and setlinefeed_on_enter=0. And in~/.config/nchat/key.conf setlinebreak=\33\15.

3. Custom colors are not shown when running nchat in tmux?

Please try to run nchat with a TERM supporting custom colors, e.g:

TERM=xterm-256color nchat

4. Sent messages are not visible?

For terminals with eight colors (or more) the default color theme displayssent messages in gray (shaded). Some terminals may wrongly report supportingmore colors than two, or the terminal may be set up with gray mapped to black.In this case sent / own messages may appear invisible. To avoid nchat usinggray one can edit~/.config/nchat/color.conf and remove occurances ofgray.

5. How to use Telegram and WhatsApp concurrently or switch between them?

Therecommended method is to set up nchat with one config directory perprotocol/phone number, and run each instance in separate terminal windows/tabs.To simplify such usage one can set up aliases, for example:

alias telegram='nchat -d ~/.config/nchat-telegram'alias whatsapp='nchat -d ~/.config/nchat-whatsapp'

Then use regular setup for them (separately), for example:

telegram -swhatsapp -s

Thealternative method is to set up multiple protocol accounts in a singlenchat config directory. For each protocol/phone nubmer, run setup mode and exitafter initial sync:

nchat -s

6. How to set up WhatsApp without scanning a QR code?

By default setting up a WhatsApp account will display a QR code to be scannedusing the WhatsApp mobile application on the primary device. As an alternativeone can set an environment flag to have nchat display a pairing code, to beentered in WhatsApp on the primary device:

USE_PAIRING_CODE=1 nchat -s

7. No QR code is shown when setting up WhatsApp?

By default nchat will attempt to detect if the system is capable of viewingimages using a GUI image viewer, and if detected (indicated by "has gui" inthe log) it displays the QR code using default image viewer. If that for somereason fails, one can use pairing code (see above), or force nchat to displaythe QR code in the terminal:

USE_QR_TERMINAL=1 nchat -s

8. Build fails withc++: fatal error: Killed signal terminated program cc1plus?

This often means that OOM killer has terminated the compilation due to thesystem running out of free RAM.

If the system hasless than 4 GB RAM, please refer toBuilding on Low Memory Systems.

If the system has4 GB RAM or more, the problem can occur if parallelismis set too high, which is likely to be encountered when installing from theArch Linux AUR package. A workaround for the AUR package is to manuallyrestrict max number of parallel jobs toavailable RAM in GB divided by 4.For example a system with 8 GB would then need to use max 8 / 4 = 2 jobs:

CMAKE_BUILD_PARALLEL_LEVEL=2 yay -S nchat

Alternatively one canBuild from Source using themake.sh script, which sets parallel job count based on the systemcapabilities.

9. Terminal transparency is not working?

If on Linux, try removing any custom default background set up, i.e. setdefault_color_bg= in~/.config/nchat/color.conf.

Project Scope

Limitations

There are no plans to support the following features:

  • Facebook Messenger
  • Signal
  • Telegram secret chats
  • Voice / video calls

Additionally, WhatsApp is only supported on macOS and glibc-based Linuxsystems. Thus, it is not supported on musl-based operating systems, suchas Alpine Linux. Seeissue #204for technical details on this limitation.

Roadmap

There is currently no concrete roadmap for further feature development ofnchat. It is not intended to be a full-featured client on par with officialTelegram / WhatsApp clients, but rather a light-weight client providingessential functionality suitable for the terminal. However, feel free tosubmit feature requests if there's something missing, or help upvoteexisting feature requests,if it's useful and low effort it will be considered.

Contributions

Please refer toContributing Guidelines andDesign Notes.

Alternatives

Terminal-based Telegram clients:

Terminal-based WhatsApp clients:

Technical Details

Custom API Id / Hash

nchat uses its own Telegram API id and hash by default. To use custom id/hash,obtained fromhttps://my.telegram.org/ one may setenvironment variablesTG_APIID andTG_APIHASH when setting up a new Telegramaccount. Example (below values must be changed to valid api id/hash):

TG_APIID="123456" TG_APIHASH="aaeaeab342aaa23423" nchat -s

Third-party Libraries

nchat is primarily implemented in C++ with some parts in Go. Its source treeincludes the source code of the following third-party libraries:

Thetdlib andwhatsmeow libraries are activelydeveloped and need to be updated and integrated into nchat on a regularbasis by nchat maintainer(s). To facilitate this there are scripts availableto update to latest (or a specific) version of these libraries. Example usages:

./utils/tdlib-update 8517026./utils/whatsmeow-update 7aedaa1

Code Formatting

Uncrustify is used to maintain consistent source code formatting, example:

./make.sh src

License

nchat is distributed under the MIT license. See LICENSE file.

Keywords

command line, console-based, linux, macos, chat client, ncurses, telegram,terminal-based.


[8]ページ先頭

©2009-2025 Movatter.jp