23 releases

0.5.0 Mar 3, 2021
0.4.0 Aug 11, 2020
0.3.1 Mar 20, 2020
0.3.0 Jan 19, 2020
0.1.2 Aug 10, 2019

#25 in Command-line interface

Download history 3/week @ 2020-12-23 2/week @ 2020-12-30 3/week @ 2021-01-06 10/week @ 2021-01-13 3/week @ 2021-01-20 6/week @ 2021-01-27 4/week @ 2021-02-03 54/week @ 2021-02-10 71/week @ 2021-02-17 3/week @ 2021-02-24 22/week @ 2021-03-03 7/week @ 2021-03-10 2/week @ 2021-03-17 56/week @ 2021-03-24 49/week @ 2021-03-31 27/week @ 2021-04-07

77 downloads per month

BSD-3-Clause

1.5MB
1.5K 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 + ←
Zoom Ctrl + x

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

Running the tests

The tests will no longer kill your tmux server. As the tests have moved to use cursive exclusively in combination with insta

Running all test suites

Just run

$ cargo test

to execute all available tests.

Investigating failed tests

In case some test fails with your changes, you can use the cargo-insta tool to investigate the test case.

To install

$ cargo install cargo-insta

and to run the tests and investigate all failing tests interactively.

$ cargo insta review

Any changes between the expected and received screen will be then displayed.

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@weirder.earth
🐦 @fin_ger_github


Johannes WΓΌnsche

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

Show your support

Give a ⭐ if this project helped you!

Dependencies

~4MB
~77K SLoC