Skip to content

How to create a status bar? #677

Answered by gyscos
0x7FFFFFFFFFFFFFFF asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, and thanks for the question!

To create a status bar, you can add a transparent full-screen layer at the back of your StackView, which only draws something at the bottom.
For example, you can use a FixedLayout to manually specify the location of a TextView, and use OnLayoutView to update this location when the terminal is resized:

use cursive::traits::{Nameable, Resizable};
use cursive::view::View;
use cursive::views::{FixedLayout, Layer, OnLayoutView, TextView};
use cursive::{Rect, Vec2};

fn main() {
    let mut siv = cursive::default();

    siv.screen_mut().add_transparent_layer(
        OnLayoutView::new(
            FixedLayout::new().child(
                Rect::from_point(Vec2::z…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@stIncMale
Comment options

@gyscos
Comment options

@stIncMale
Comment options

Answer selected by 0x7FFFFFFFFFFFFFFF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants