#cursive #tui #terminal #tiling #view

bin+lib cursive-multiplex

A tmux like multiplexer for gyscos/cursive views

18 releases

✓ Uses Rust 2018 edition

0.2.14 Sep 11, 2019
0.2.13 Sep 10, 2019
0.2.4 Aug 25, 2019
0.1.2 Aug 10, 2019

#37 in Command-line interface

Download history 22/week @ 2019-07-31 30/week @ 2019-08-07 29/week @ 2019-08-14 86/week @ 2019-08-21 34/week @ 2019-08-28 168/week @ 2019-09-04 65/week @ 2019-09-11 182/week @ 2019-09-18 117/week @ 2019-09-25 54/week @ 2019-10-02 1/week @ 2019-10-09 37/week @ 2019-10-16 62/week @ 2019-10-23 62/week @ 2019-10-30

125 downloads per month

BSD-3-Clause

1.5MB
2K SLoC

Welcome to cursive-multiplex 👋

stable build nightly build crates.io Docs.rs GitHub PRs Welcome
A tmux like multiplexer for gyscos/cursive views


This project is work-in-progress

This project provides a tiling window manager for gyscos/cursive similar to Tmux. You can place any other cursive view inside of a Mux view to display these views in complex layouts side by side. Watch the demo below to see how it looks.

How does it look like? demo terminalizer

Expand to view Demo GIF

Usage

Simply add to your Cargo.toml

[dependencies]
cursive-multiplex = "^0.2.0"

And then use Mux::new to create a new Mux view

let (mut mux, root_node) = cursive_multiplex::Mux::new(
    cursive::views::TextView::new("Hello World!".to_string())
);

Mux has defaults defined for key bindings. You can change them with the API described in the docs.

Expand to see default keybindings
Action Key
Move focus up Alt +
Move focus right Alt +
Move focus down Alt +
Move focus left Alt +
Resize up Ctrl +
Resize right Ctrl +
Resize down Ctrl +
Resize left Ctrl +

Adding views

You can add views by giving a path or an id to an existing node e.g.

let new_node = mux.add_right_of(
    cursive::views::TextView::new("Foo"),
    root_node,
).expect("adding right panel to root failed");

Its also possible to add views by their path.

if let Some(sibbling) = mux.root().right().right().down().build() {
    let new_node = mux.add_above(
        cursive::views::TextView::new("Foo"),
        sibbling,
    ).expect("adding by path failed");
}

Returned will be a Result Ok contains the new id assigned to the view, or an error in case of failure.

Removing Views

You can also remove views, by giving the id of the views.

mux.remove_id(new_node)?;

On success the id of the removed node is returned.

Switch Views

If you want to reorder your views you can easily switch them by using

mux.switch_views(new_node, old_node)?;

Troubleshooting

If you find any bugs/unexpected behaviour or you have a proposition for future changes open an issue describing the current behaviour and what you expected.

Development cargo test shellshot

Running the tests

‼️ CAUTION ‼️ This crate uses Tmux for end2end testing and will kill your Tmux server during testing!

Preparing integration tests

In order to run the integration tests, you first need to install a recent version of >=npm-10 and >=tmux-2.6!

After npm and tmux are installed, install required dependencies:

$ ./scripts/prepare-end2end-tests.sh

This will use npm to install jest and shellshot in the tests folder.

Running all test suites

Just run

$ cargo test

to execute all available tests.

shields.io endpoints

shields.io endpoints are generated inside the ./target/shields folder. They are used in this README.

Authors

Fin Christensen

:octocat: @fin-ger
🐘 @fin_ger@mastodon.social
🐦 @fin_ger_github


Johannes Wünsche

:octocat: @jwuensche
🐘 @fredowald@mastodon.social
🐦 @Fredowald

Show your support

Give a ⭐️ if this project helped you!

Dependencies

~5MB
~94K SLoC