ConsoleGuiTools icon indicating copy to clipboard operation
ConsoleGuiTools copied to clipboard

OCGV: Add ability to minimize UI

Open tig opened this issue 5 years ago • 7 comments
trafficstars

The window border, filter box, and status bar use valuable screen real estate. I'd like to have an option of not having it visible.

I considered having parameters for all of them:

  • -NoFrame
  • -NoFilter
  • -NoStatusBar

But that seems overkill. Instead, just:

  • -MinUI

I just pushed a change to Terminal.Gui that will enable hiding the statusbar. Then all that's needed is to change the logic that creates the Window to:

        private Window AddTopLevelWindow()
        {
            // Creates the top-level window to show
            var win = new Window(_applicationData.Title)
            {
                X = _applicationData.MinUi ? -1 : 0,
                Y = _applicationData.MinUi ? -1 : 0,
                // By using Dim.Fill(), it will automatically resize without manual intervention
                Width = Dim.Fill(_applicationData.MinUi ? -1 : 0),
                Height = Dim.Fill(_applicationData.MinUi ? -1 : 1)
            };

            Application.Top.Add(win);
            return win;
        }

tig avatar Sep 29 '20 20:09 tig

I like the idea of being able to customize the UI, however, I wonder if -MinUI is sufficient or over time we end up with lots of switches/parameters? Perhaps accept a hashtable that accepts customization options?

SteveL-MSFT avatar Oct 15 '20 17:10 SteveL-MSFT

I like the idea of being able to customize the UI, however, I wonder if -MinUI is sufficient or over time we end up with lots of switches/parameters? Perhaps accept a hashtable that accepts customization options?

Steve, is there a built-in way for PS cmdlets to take multiple options (OR) in a parameter? E.g.

ocgv -UIOptions A | B | C

tig avatar Oct 15 '20 17:10 tig

@tig it can accept an array.

ocgv -HideUIElement Filter,Frame,foo,bar

The type of the parameter HideUIElement can be an enum array so tab completion "just works"

TylerLeonhardt avatar Oct 15 '20 17:10 TylerLeonhardt

Based on this feedback I will revisit this PR using HideUIElement as the parameter and implement flags as suggested.

But, I will include a All in the enum...

tig avatar Oct 15 '20 17:10 tig

I'm not married to the name HideUIElement but I do think this kind of parameter seems pretty cool. I like adding All and None where None is the default value.

TylerLeonhardt avatar Oct 15 '20 17:10 TylerLeonhardt

Or,

iocgv -UI [All*, None, Filter, Headers, Frame, StatusBar]

Where All is default.

tig avatar Oct 15 '20 18:10 tig

hmm... I'm not sure. If we go with -UI and then we add another thing to the enum, it wouldn't show up and I'm not sure if that's a good thing or a bad thing because I would want new things to be visible first so the user can see the new capability.

TylerLeonhardt avatar Oct 15 '20 19:10 TylerLeonhardt

Actually, I would love the -NoFrame, -NoFilter, and -NoStatusBar that were proposed. I very frequently desire some of those but not others.

RokeJulianLockhart avatar Aug 24 '22 11:08 RokeJulianLockhart

Fixed in #166

tig avatar Aug 24 '22 12:08 tig