deadpixi / mtm Goto Github PK
View Code? Open in Web Editor NEWPerhaps the smallest useful terminal multiplexer in the world.
Perhaps the smallest useful terminal multiplexer in the world.
I just tried to compile mtm on OSX, and I received the following error:
mtm.c:339:32: error: use of undeclared identifier 'A_ITALIC'
and the following warning:
mtm.c:676:5: warning: implicit declaration of function 'ioctl' is invalid in C99 [-Wimplicit-function-declaration]
How would I go about solving this? :)
I'm using the Arch Linux AUR package, and as the title says the options are inverted.
h splits vertically, and v horizontally. I checked the PKGBUILD and didn't find any compile time changes that could cause this. So, is it a problem with mtm or asome weird package issue?
In a horizontally-split mtm session in the Linux TTY, when I SSH into a remote server and edit a file with Vim, some actions (such as deleting lines, undoing deleting lines, and toggling syntax highlighting) cause the display to be incorrect (wrong lines being shown to be deleted, deleted text not being erased, overlapping text, etc).
These are all problems with the display; the content of the Vim buffer would still be correct, though it is displayed incorrectly. Forcing Vim to redraw itself (opening a new tab (:tabe
) and closing it) would usually fix the display.
This did not occur when I tested this:
I unable to consistently reproduce this and unsure how to debug this, but is there anyone who has experienced similar problems, or more knowledge about terminals who knows a possible cause of this?
My local computer is Arch Linux and the remote server is Debian 11 (bullseye).
I don't have a whole lot of information on this yet. I've built mtm as a part of the Openwrt/LEDE build system, and loaded it on an MIPS router and an x86 VM.
Mtm seems to work flawlessly on the x86 VM. On the router, it starts without issue, and the ctrl + g commands work as expected. The enter key is handled correctly as well. No other key strokes are detected.
The router is an ar71xx architecture, and is big-endian -- the opposite of x86. Is it possible that mtm isn't endian safe?
I won't have much time to dig in and try to troubleshot this myself, but I'll do what I can.
Probably a "works as expected" issue but even so I'll let you know. :)
I have my terminal emulator to use a couple of specific colors for and background and foreground color, but mtm is using colors 0 (normal black) and 7 (normal white).
This program looks great. I hope to try it out this (or next) weekend on a Debian server.
It would be great for a package to be available in the Debian repository.
Thank you!
Hello,
I running the kakoune text editor inside mtm. Kakoune works with mouse event like mouse like and mouse drag, but not inside mtm.
I got weird residues above fish prompt.
;fish ~;file://othala/home/alex;fish ~
Would you consider to provide support for multiple (fullscreen) windows? It appears doable, creating, focusing and deleting newview() as needed. However, I wasn't able to do it myself...
Is possible sharing sesion similar https://tmate.io/ or other way.
I would showing my friend nice console program and dont know how to do this
It could be a mistake on my part, but I'm encountering this error.
$ make
cp -i config.def.h config.h
gcc -O3 -std=c99 -Wall -Wno-unused-variable -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE_EXTENDED -DTMT_HAS_WCWIDTH -o mtm -DNCURSESW_INCLUDE_H="<ncursesw/curses.h>" tmt.c mtm.c -lncursesw -lutil
mtm.c:19:10: fatal error: 'pty.h' file not found
#include <pty.h>
^
1 error generated.
make: *** [mtm] Error 1
$
I am on arch linux. mtm is working as intended, but throwing error output as below :
/home/xxxx/programs/mtm: /usr/lib/libncursesw.so.6: no version information available (required by /home/xxxx/programs/mtm)
Commands that produce ‘many’ lines and bytes of output (e.g., ps faux
: 26+ kB in 200+ lines) seem to become displayed in chunks of approximately 4 kB bytes, temporally spaced ~1 second apart when run in an mtm
pane, while the same output appears virtually instantly without mtm.
The textmode editor jed
takes approximately 5 seconds to initialize its display in an mtm
pane, all the while the cursor jumps to different positions appr. every second. The same initialization takes place instantly without mtm
.
Displaying a 256 line ASCII file with 128 chars per line (including line terminator) in pagers more
, less
and most
exhibits the same chunkiness in mtm
.
The funny thing is, that while the above is also true while recording the session with asciinema
(to illustrate what I see), replaying the recorded file does not show the chunked output when replayed outside of mtm
.
All of this happens on a local machine, there is no network involved.
mtm: 1.0 and 1.0.1
OS: ArchLinux x86_64
glibc: 2.29
ncurses: 6.1
Window manager: qtile
Terminal emulator: sakura
, lilyterm
or xterm
Shell: fish
or bash
$TERM
: xterm-256color
(before starting mtm
, screen-256color
inside mtm
)
$LANG
: en_DK.UTF-8
$LC_ALL
: en_DK.UTF-8
$COLUMNS
: 191
$LINES
: 60
fremen:mtm> make
cc -O2 -pipe -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -o mtm vtparser.c mtm.c -lncursesw -lutil
In file included from mtm.c:40:
./config.h:81:10: fatal error: 'pty.h' file not found
#include FORKPTY_INCLUDE_H
^~~~~~~~~~~~~~~~~
./config.h:78:35: note: expanded from macro 'FORKPTY_INCLUDE_H'
#define FORKPTY_INCLUDE_H <pty.h>
^~~~~~~
1 error generated.
I didn't investigate further, sorry :)
Make a separate file for your license instead of putting it in the README. And copyright years need updating to 2016-2022
Thank you
Upon research neovim uses setrgbf and setrgbb terminfo extensions for termguicolors and termguicursors. Even if I install these locally is it fundamentally unsupported by mtm - I understand and agree if this is a choice for compatibility.
Any info would be very helpful, as in the end I may just fork to support those extensions, thanks in advance :>
Nested mtm with abduco can create a situation where x
and q
appear instead of unicode graphics.
Reproduction
mtm
in bothWhat is going on here?
I'm fixing building on FreeBSD, and there's a thing in config.h.def I'm not sure about.
49 /* Includes needed to make forkpty(3) work. */
50 #ifndef FORKPTY_INCLUDE_H
51 #if defined(__APPLE__) || (defined(BSD) && !defined(__linux__))
52 #define FORKPTY_INCLUDE_H <util.h>
What is the BSD
macro for? FreeBSD definitely does not define it, OSX does not define it, Linux obviously doesn't, I'm pretty sure neither do Open/Net/Dfly (although I'm not sure about these).
The forkpty
include is slightly different across the BSDs, so this will have to be a bit more granular than just "if BSD" - at this point though, I'm not sure if it's just a placeholder of sorts, or if there's an actual use case for it I can't seem to find.
Thank you for the nice software. However, It looks like there is a bug with zsh:
a h
(sometimes followed by a l
) appears after the prompt.
I'd gladly help if given any hint where to look first.
Compilation fails on Ubuntu 18.04. Looks like alloc_pair()
is introduced in ncurses 6.1.
$ make
cc -std=c99 -Wall -Wextra -pedantic -Os -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -o mtm vtparser.c mtm.c -lncursesw -lutil
mtm.c: In function ‘getinput’:
mtm.c:979:9: warning: ignoring return value of ‘read’, declared with attribute warn_unused_result [-Wunused-result]
read(statusfd, statusmsg, MAXOSC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/cc4Dsw9O.o: In function `sgr':
mtm.c:(.text+0x19c5): undefined reference to `alloc_pair'
/tmp/cc4Dsw9O.o: In function `rc':
mtm.c:(.text+0x1b3e): undefined reference to `alloc_pair'
/tmp/cc4Dsw9O.o: In function `main':
mtm.c:(.text.startup+0x12e): undefined reference to `alloc_pair'
collect2: error: ld returned 1 exit status
Makefile:14: recipe for target 'mtm' failed
make: *** [mtm] Error 1
The README has:
Usage is simple::
mtm [-T NAME] [-t NAME] [-c KEY] [-b COLOR]
The `-T` flag tells mtm to assume a different kind of host terminal.
The `-t` flag tells mtm what terminal type to advertise itself as.
Note that this doesn't change how mtm interprets control sequences; it
simply controls what the `TERM` environment variable is set to.
The `-c` flag lets you specify a keyboard character to use as the "command
prefix" for mtm when modified with *control* (see below). By default,
this is `g`.
The `-b` flag lets you specify the background color for the status bar.
The `-s` flag names a status file, and the `-S` flag indicates how often this
file should be checked. The contents of this file will be displayed in the
left side status bar, before any window title.
USAGE on the command line is defined as:
#define USAGE "usage: mtm [-s] [-T NAME] [-t NAME] [-c KEY]\n"
The man page lists:
-T HOST
-t TERMINAL
-c CHARACTER
-b COLOR
-s FILE
What's actually supported:
int c = 0;
while ((c = getopt(argc, argv, "c:T:t:x")) != -1) switch (c){
case 'c': commandkey = CTL(optarg[0]); break;
case 'T': setenv("TERM", optarg, 1); break;
case 't': term = optarg; break;
case 'x': dostatus = true; break;
default: quit(EXIT_FAILURE, USAGE); break;
}
Hello,
I would like to use Kakoune in mtm
but seems there is no exposure to implement :new
, :focus
and :repl
commands I need.
Cheers,
Alex.
I noticed that a lot of issues/pulls are related to the makefile portability. The .POSIX:
line tells make to follow the posix standard and is recommended.
Here is the POSIX standard for make: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html
And a quote:
To receive exactly the behavior described in this section, the user shall ensure that a portable makefile shall:
Include the special target .POSIX
Omit any special target reserved for implementations (a leading period followed by uppercase letters) that has not been specified by this section
The behavior of make is unspecified if either or both of these conditions are not met.
To do it you put only .POSIX:
on the first line of the make file.
From the screenshots in the Readme, I understand there should be some color support.
Currently using xfce4-terminal, I ran this script.
for i in {0..15} ; do ~
printf "\x1b[48;5;%sm%3d\e[0m " "$i" "$i"
if (( i == 15 )) || (( i > 15 )) && (( (i-15) % 6 == 0 )); then
printf "\n";
fi
done
Left is output outside mtm, and right is inside mtm. $TERM
inside mtm is eterm-color
. After installing mtm terminfo, wwitching to mtm -t mtm
doesn't make any difference.
If I try to show 256 colors, most numbers are shown as blinking text.
There's a very noticable delay when switching modes in vi
This problem exists is screen (AFAIK in tmux too), which has an option to change the escape delay: maptimeout 0
From the screen manpage:
maptimeout [timeout]
Set the inter-character timer for input sequence detection to a timeout of timeout ms. The
default timeout is 300ms. Map‐
timeout with no arguments shows the current setting. See also "bindkey".
A quick grep through the screen source suggested that it is calling a SetTimeout
function (sorry i'm not familiar enough with c to figure out any more than this)
Is there a similar option for mtm? Initial impression are really good, but i can't use it if it breaks vi :(
Not to waste time on installation people can download already compiled binaries, like this:
curl -L https://githubusercontent.com/...
Please publish releases ❤️ in this tab.
mtm compiles on elementary os 0.4 "Loki", but then throws up an error on execution. To fix this I changed line 85 in mtm.C from
static` const char *term = "eterm-color";
to
static const char *term = "Eterm-color";
works fine now.
I'm getting a fatal error: ncursesw/curses.h: No such file or directory
when running make
or make CURSESLIB=curses
.
Do I have to provide this file? Im not familiar with ncurses or even it's sources.
I'm on a healthy, fullly updated Arch box, ncurses version 6.1-6 is installed.
I created said folder, copied /usr/include/curses.h
into it but the error doesn't change a bit. Also happens with ncurses.h
.
Am I getting something wrong, or is this a bug? I just wanted vim bindings!
given that there is first party support for pty in windows would be good to support this.
another option is via win-pty. https://github.com/rprichard/winpty
This should make it easier to recompile with different options.
Hi,
Could you please add an option to change the control key? I would like to use ALT+<ESC>
as a control shortcut.
Thanks in advace.
Looks pretty clear that you don't intend to add any new feature, though I think a lot of times resizing a pane is needed, are you willing to build it or receive contributions regarding this?
Thanks for this software, indeed looks great :D
I'm on Arch Linux. I have installed mtm both from git and from AUR.
mtm seems to work fine in uxterm, but doesn't do anything in st/urxvt.
-> [ ~ ] :: mtm
-> [ ~ ] :: mtm
-> [ ~ ] :: mtm
-> [ ~ ] :: ls
c_unix_and_algo
media/
-> [ ~ ] ::
I compiled mtm
with CURSESLIB=curses
and whenever I run it, it segfaults.
If I compile with debugging info and run it the following backtrace is what lldb
shows me:
* thread #1: tid = 0xf377c7, 0x00007fff91ca748d libncurses.5.4.dylib`doupdate + 237, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x58)
* frame #0: 0x00007fff91ca748d libncurses.5.4.dylib`doupdate + 237
frame #1: 0x00007fff91c9b4d1 libncurses.5.4.dylib`wrefresh + 68
frame #2: 0x0000000100001927 mtm`doripoff(w=0x0000000100201770, i=<unavailable>) + 39 at mtm.c:853 [opt]
frame #3: 0x00007fff91c9cf49 libncurses.5.4.dylib`_nc_setupscreen + 1610
frame #4: 0x00007fff91c995a6 libncurses.5.4.dylib`newterm + 191
frame #5: 0x00007fff91c96581 libncurses.5.4.dylib`initscr + 83
frame #6: 0x0000000100001b80 mtm`main(argc=<unavailable>, argv=<unavailable>) + 592 at mtm.c:894 [opt]
frame #7: 0x00007fff8a5a75ad libdyld.dylib`start + 1
frame #8: 0x00007fff8a5a75ad libdyld.dylib`start + 1
Don't know how useful this is? I just started learning C the other day, so I can't really imagine what you'd need :) If you need anything else, please tell me :)
Maybe you thing it is an abomination to have these, but I like them for tracking my git branch in the pwd. They get boxed.
Apparently st doesn't even work for some people. Problem is certainly with character encodings and colour management/font management. Maybe a recommended or custom patch for st is needed.
Hi there, I don't think this is a bug in mtm, but I could use some guidance if possible!
When using mtm
to run a program created using the termion library for Rust, arrow keypresses are not being detected.
I've done some digging and it looks like this is because (by default) mtm sends "application mode" cursor commands like \EOA
instead of "normal mode" cursor commands such as \E[A
. Is this right or am I misunderstanding?
This line in particular checks for pnm
on a node and sends the O
or [
prefix accordingly:
https://github.com/deadpixi/mtm/blob/36910ba0/mtm.c#L1037
static void
sendarrow(const NODE *n, const char *k)
{
char buf[100] = {0};
snprintf(buf, sizeof(buf) - 1, "\033%s%s", n->pnm? "O" : "[", k);
SEND(n, buf);
}
However, it seems that Termion only looks for \E[A
and friends when detecting arrow keys: https://gitlab.redox-os.org/redox-os/termion/-/blob/a448f510/src/event.rs#L154-157
You can verify this by cloning Termion and running the keys example both within and without mtm
:
git clone https://github.com/redox-os/termion
cd termion
cargo run --example keys
In my terminal, without mtm
, I can run the example and see arrow keypresses registered. Under mtm
, most keys work but the arrow keys don't do anything.
All that said, here's my question:
As an application developer, should I be sending an escape code to say I want "normal mode"? aka should I be setting pnm = false
somehow? Or should the Termion library be looking for \EOA
and parsing it the same as \E[A
?
If so I am happy to send a patch. I guess I'm trying to determine if I should fix this behavior in my app or in the Termion library.
Thank you!
Hi @deadpixi 👋
I've tried to package mtm
for Homebrew distribution but a substantial amount of changes between the latest release and HEAD
turned out to be a dealbreaker (Homebrew/homebrew-core#66093 (comment))
I'm wondering is there a new release on the horizon anytime soon so we could move this thing forward?
It would be nice to have a simple scrolling implementation in mtm.
Related to #41
Compiling in Alpine linux from the master branch results in the compiler not finding curses.h and not having the man directory /usr/local.
I made these changes in config.def.h:
diff --git a/config.def.h b/config.def.h
index 248b296..f6ed0fc 100644
--- a/config.def.h
+++ b/config.def.h
@@ -61,7 +61,7 @@
/* The path for the wide-character curses library. */
#ifndef NCURSESW_INCLUDE_H
- #if defined(__APPLE__) || !defined(__linux__) || defined(__FreeBSD__)
+ #if defined(__APPLE__) || !defined(__linux__) || !defined(linux) || defined(__FreeBSD__)
#define NCURSESW_INCLUDE_H <curses.h>
#else
#define NCURSESW_INCLUDE_H <ncursesw/curses.h>
Then compiled it this way:
MANDIR=/usr/share make && make install
That allowed it to compile on Alpine.
On Arch Linux I had to do the same line replacement in config.def.h, but I did not have to change the MANDIR argument.
The xterm color profile does not load correctly when I run xterm -e mtm.
After splitting into two side by side virtual terminals, typing in the focused one intermittently causes the cursor to flicker in the non-focused one. I'm running with OSX Terminal.app SSHing into a VirtualBox running Arch Linux. I can reproduce consistently by pressing enter at the command line and then holding down the backspace key.
Does mtm support detaching? From the README it looks like the answer is "no". If not, would you consider a (hypothetical) program that supports only detaching to be a good complement to mtm?
I cannot close a virtual terminal inside mtm. I guess it might be related to the terminal type and the termcap database. I've tried to run
# tic -C -K -s -x mtm.ti >> /usr/share/misc/termcap
# cd /usr/share/misc
# cap_mkdb termcap
but it didn't help.
Launching mtm with -t mtm
, -t xterm
does not help.
I'm running FreeBSD 12.0-CURRENT r333344 amd64.
Related: #22
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.