mtm icon indicating copy to clipboard operation
mtm copied to clipboard

Status line support

Open alexherbo2 opened this issue 8 years ago • 10 comments

alexherbo2 avatar Jun 09 '17 17:06 alexherbo2

The latest code in master has a status line. Please test it out and close this issue if it works for you. Thanks!

deadpixi avatar Jul 08 '17 03:07 deadpixi

Will the status line be customizable?

alexherbo2 avatar Jul 08 '17 07:07 alexherbo2

Will the status line be customizable?

It is now. Check out the latest code. You can give mtm a filename and it will read the contents of that file periodically and put them in the status line (in front of any window titles). You're free to put whatever you want in the file.

Please close this issue if you think this solves it. Thanks!

deadpixi avatar Jul 10 '17 06:07 deadpixi

I don’t see how it could be useful.

Can you give me some usage?

alexherbo2 avatar Jul 10 '17 09:07 alexherbo2

For example, I have this in my .Xsession:


while true ; do
    DATE=$(date)
    BATTERY=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep percentage)
    echo "${DATE} ${BATTERY}" > ~/.status
    sleep 60
done

Then I invoke mtm like this:

mtm -s ~/.status

Now I have the current date, time, and laptop battery percentage in the status bar updated every minute, along with whatever window title is set by the focused virtual terminal.

deadpixi avatar Jul 10 '17 14:07 deadpixi

I would like to add Git status line, using working directory of active pane.

alexherbo2 avatar Jul 10 '17 15:07 alexherbo2

You could modify your shell's prompt command to run git-status and put the output in the title bar using the title-setting escape sequence. How you'd do that would depend on what shell you're using.

deadpixi avatar Jul 10 '17 15:07 deadpixi

I don’t want Git information in my shell prompt, but rather delegate to the WM or TM status bar I’m using.

In i3 I do something like that.

That enables some ubiquity and DRY, because you always have the information accurate to what you focus, no matter if you are in your shell, editor or what ever application.

For instance in Kakoune, I just have some hooks on focus changes to update the adapters.

alexherbo2 avatar Jul 10 '17 15:07 alexherbo2

Assuming you use bash (I know you can do it with other shells too), doing something like this:

PROMPT_COMMAND='echo -ne "\033]0;`pwd`\007"'

will put your current working directory in mtm's title bar, not your prompt. You could replace "pwd" with whatever command you want (an arbitrarily complex shell script), and thus put whatever you wanted in the title.

mtm is smart enough to display the title for the currently focused window, so different windows can have different titles.

deadpixi avatar Jul 10 '17 15:07 deadpixi

Would be nice if we could just put bash-like escape colors like \x1b[1;33;41m ^-^ \x1b[0m on the status bar. Or a custom escape sequence, easier to implement, like a escape character 0x1b followed by a single byte where each nibble is one of the 16 possible colours for fg and bg, like 0x1b 0xab. And if mtm could get the current terminal width with system("tput cols"), we could have a right aligned status line instead of the actual left-aligned.

mazeto avatar Mar 17 '18 23:03 mazeto