morgon has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I have a very basic understanding of curses to build full-screen text GUIs, but I cannot figure out if it is possible to build a text-based GUI in Perl that only uses part of the terminal screen estate.

What I mean is something like the "fzf" tool (which is written in go) does. Usually it takes over the whole terminal, but when supplying an argument like "--height 50%" it only takes a part of the terminal screen size, but within that part there is a GUI.

Is is possible to do something like that in Perl (using curses or something else)?

Many thanks.

  • Comment on textual GUI using only part of the terminal

Replies are listed 'Best First'.
Re: textual GUI using only part of the terminal -- 3 options
by Discipulus (Canon) on Jun 27, 2017 at 07:57 UTC
    hello morgon,

    you are probably looking for Term::Visual from the docs:

    split-terminal user interface.

    Term::Visual is a "visual" terminal interface for curses applications. It provides the split-screen interface you may have seen in console based IRC and MUD clients.

    I never used it but it seems very close to your needs: do not expect zooming features anyway.

    Another viable option can be Curses::UI look at the picture in an external website.

    Also Term::Cap can be used to have the screen partitioned: see Pure Perl Split Screen for an example by blindluke.

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
      Unfortunately neither of these modules does what I want - at least I cannot see it.

      Both take over the whole terminal screen estate while I am looking for a way to have the GUI use only part of it.

      But never mind - it's not something I need, I am only curious as to whether it would be possible at all.

Re: textual GUI using only part of the terminal
by zentara (Cardinal) on Jun 27, 2017 at 13:11 UTC
    Using Tmux is the way to go. There are numerous short tutorials on youtube.

    I'm not really a human, but I play one on earth. ..... an animated JAPH
Re: textual GUI using only part of the terminal
by Anonymous Monk on Jun 26, 2017 at 22:51 UTC
    According to the docs fzf can integrate with tmux for the terminal splitting. That's probably easier, just use screen or tmux to run your script in one pane and a regular terminal in the other. But if you do want to reinvent the wheel, then yea, Curses would be one way.
      Are you positive that Curses can do that or are you only guessing?

      If you know could you show me how one would go about it?

      And sure, a tmux pane would achieve something similar, but that is not my question.

        Are you positive that Curses can do that or are you only guessing?

        Other guy mean that tmux is created using libevent and ncurses -- can you reinvent a terminal multiplexer using perl and curses? Sure theoretically, but it is a lot of work in all all corners of the environment