• Stars
    star
    145
  • Rank 252,921 (Top 5 %)
  • Language
    C#
  • License
    MIT License
  • Created almost 2 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A terminal GUI designer for PowerShell.

The Terminal User Interface (TUI) designer is used for designing UIs that run within standard terminals. They output script that works with Terminal.Gui. This project allows for the creation of UIs that run on Windows, Linux and Mac. You can even run terminals in shells like Azure Cloud Shell.

Installation

Install-Module TerminalGuiDesigner

Overview

You can open the TUI designer by executing Show-TUIDesigner within PowerShell.

The TUI designer is broken into 4 sections. On the left, you have the following.

  • Toolbox - Contains available controls that can be added to the window
  • Properties - Allows for editing for selected controls
  • Controls - Contains a list of controls defined in the Window

The right side of the designer is the design surface and displays the current window and any controls that are added to it.

Designing a TUI

To design a TUI, you take advantage of the sections defined above. To add new controls, double click on the control listed in the Toolbox and it will be added to the form.

Once the control has been added, it will appear within the designer window and within the list of Controls. Some default properties will be set for the control. You can move the control around the window by clicking and dragging it. When moving a control like this, it will set the absolute positioning of the control.

When you select a control, the Properties view will update with all the available properties that you can set for the control. Some properties have special dialogs that will open to allow you to modify more complex objects. Properties like sizes and positioning can be used to create calculated layouts. You can also easily set text and IDs.

Once you have completed designing your control, you can save the file as a PS1 file. The PS1 file will contain a PowerShell script that will display the same TUI.

Adding Event Handlers

To add interaction to your TUI, you will need to add event handlers. You can learn about all of the events that are available by visiting the Terminal.Gui documentation. For example, if you want to add a click event to a button, you could do the following (see code below). Variables for each one of your controls will be defined based on their ID.

$View0.add_Clicked({[Terminal.Gui.MessageBox]::Query("Hello", "")})

Running a TUI

To run a TUI, you will need to install and import the TerminalGuiDesigner module on target machines. You can also, optionally, ship the Terminal.Gui.dll and NStack.dll with your PowerShell scripts.

Install-Module TerminalGuiDesigner

Next, you will need to load the Terminal.Gui assembly and initialize the application.

$guiTools = (Get-Module TerminalGuiDesigner -List).ModuleBase
Add-Type -Path (Join-path $guiTools Terminal.Gui.dll)
[Terminal.Gui.Application]::Init()

The script that is generated with the TUI designer will return a Window object that you can use in your application. Invoke your script and add it to the application. Do not modify the script directly. It will be overwritten if you use the designer again and the designer may not be able to load the script if you modify it.

$Window = .\tui.ps1
[Terminal.Gui.Application]::Top.Add($Window)

Finally, you can start your application by calling Run.

[Terminal.Gui.Application]::Run()

More Repositories

1

universal-dashboard

Build beautiful websites with PowerShell.
JavaScript
446
star
2

psmsi

Create MSIs using PowerShell.
C#
254
star
3

psedit

A terminal-based editor for PowerShell
C#
254
star
4

powershell-universal-legacy

PowerShell Universal is the ultimate platform for building web-based IT tools.
PowerShell
128
star
5

code-conversion

Code conversion command line tool for PowerShell and C#
C#
121
star
6

findopenfiles

A PowerShell module for finding open files.
C#
74
star
7

pscommander

Automate your desktop with PowerShell.
C#
70
star
8

psavalonia

Avalonia bindings for PowerShell
PowerShell
58
star
9

universal-docs

Documentation for PowerShell Universal
50
star
10

gallery

Public gallery of modules for PowerShell Universal
PowerShell
49
star
11

powershell-pro-tools

Scripting, automation, and development tools for professionals working with PowerShell.
C#
46
star
12

ud-powershellexplorer

PowerShell Explorer shows information about the PowerShell environment on your machine.
PowerShell
41
star
13

poshud

Dashboard used for Poshud.com
PowerShell
38
star
14

powershell-universal

Issue tracker for PowerShell Universal
35
star
15

awesome-powershell-universal

A curated list of awesome PowerShell Universal resources.
30
star
16

ud-forge

Desktops apps with Universal Dashboard
PowerShell
28
star
17

universal-dashboard-documentation

Documentation for PowerShell Universal Dashboard.
27
star
18

plinqo

LINQ-Style PowerShell Methods
PowerShell
25
star
19

poshprotools

Issue tracker and examples for PowerShell Pro Tools. Not maintained! Click here ->
25
star
20

universal-templates

Templates you can use to get started with Universal
PowerShell
24
star
21

universal-automation

Universal Automation is the PowerShell-first automation platform.
24
star
22

universal-samples

Ironman Software PowerShell samples.
PowerShell
21
star
23

powershell-protect

Audit and block PowerShell scripts.
C#
20
star
24

ud-bginfo

Web-based BGInfo built on Universal Dashboard
PowerShell
20
star
25

poshtools-docs

PowerShell Tools Documentation
19
star
26

universal-active-directory

Active Directory dashboard for PowerShell Universal.
PowerShell
18
star
27

universal-modules

PowerShell Universal modules that provide additional functionality to the platform.
PowerShell
13
star
28

restore

Ctrl+Shift+T for PowerShell Terminals
PowerShell
12
star
29

ud-codeeditor

Code editor control for Universal Dashboard.
PowerShell
10
star
30

RuntimeDiagnostics

.NET Runtime diagnostic cmdlets.
C#
10
star
31

ud-custom-control-template

A custom control template for Universal Dashboard.
PowerShell
10
star
32

ud-outrest

Universal Dashboard REST API Generator for PowerShell
PowerShell
9
star
33

windevtools

PowerShell
8
star
34

pswindows

Manipulate Windows in Microsoft Windows with PowerShell.
C#
8
star
35

universal-automation-desktop

Universal Automation Desktop Edition
8
star
36

universal-code

Visual Studio Code extension for PowerShell Universal
TypeScript
8
star
37

ud-chatroom

A chatroom example to demonstrate real-time elements.
PowerShell
7
star
38

ud-factory

Tools for creating custom components and frameworks for PowerShell Universal.
JavaScript
7
star
39

ud-sparklines

Sparklines controls for Universal Dashboard
PowerShell
6
star
40

universal-dashboard-component

Universal Dashboard v3 Component template repository.
PowerShell
5
star
41

ud-material-design

Material Design components for PowerShell Universal Dashboard.
PowerShell
4
star
42

searchindex

Search Index cmdlet example.
C#
4
star
43

dashboard-utils

Utilities for PowerShell Universal Dashboards.
PowerShell
4
star
44

ud-leaflet

A map component for Universal Dashboard
PowerShell
4
star
45

universal-automation-documentation

4
star
46

universal-azure-actions

GitHub actions for deploying PowerShell Universal to Azure.
PowerShell
3
star
47

ud-clock

A clock built with PowerShell Universal Dashboard
PowerShell
3
star
48

ud-diagrams

Diagrams for Universal Dashboard
PowerShell
3
star
49

ud-moment

Time and Date component for Universal Dashboard.
PowerShell
3
star
50

local-accounts

Local Accounts Dashboard
PowerShell
3
star
51

chuck-norris-jokes

Example Electron App and PowerShell Installer
HTML
3
star
52

ud-jea

Universal Dashboard for managing JEA endpoints and allowing access to JEA tools.
PowerShell
3
star
53

ud-calendar

Calendar for Universal Dashboard
PowerShell
3
star
54

ud-hyperv

Hyper-V Dashboard
PowerShell
2
star
55

ud-style

Emotion support for Universal Dashboard
PowerShell
2
star
56

ud-deployment

Example deployment script using Universal Dashboard
PowerShell
2
star
57

csharp-winform-designer

Documentation and Issues tracker for the C# WinForm Designer for VS Code
2
star
58

ud-weather

Weather dashboard for Universal Dashboard
PowerShell
2
star
59

universal-icons

Repository of Icon libraries for PowerShell Universal apps.
PowerShell
2
star
60

universal-windows-performance

Windows Performance dashboard and scripts.
PowerShell
2
star
61

ud-syntaxhighlighter

Syntax Highlighter for Universal Dashboard
PowerShell
2
star
62

universal-powershell-explorer

A dashboard that provides information about the current PowerShell environment.
PowerShell
2
star
63

universal-landing-page

A dashboard landing page that generates based on your defined dashboards.
PowerShell
2
star
64

universal-dashboard-enterprise

This repository contains releases of Universal Dashboard Enterprise.
2
star
65

ud-95

PowerShell
1
star
66

ud-pghero

A performance dashboard for Postgres
PowerShell
1
star
67

ud-helmet

React Helmet support for Universal Dashboard
PowerShell
1
star
68

ud-knob

Knob control for Universal Dashboard
JavaScript
1
star
69

poshud.com

Docker container for PoshUD.com
PowerShell
1
star
70

universal-dashboard-marketplace

Universal Dashboard Marketplace
C#
1
star
71

powershell-universal-template

A template repository for creating and publishing PowerShell Universal Templates
1
star
72

whats-next

CSS
1
star
73

universaldashboard.io

UniversalDashboard.io website.
HTML
1
star
74

ud-gridlayout

UDGridLayout component for Universal Dashboard.
PowerShell
1
star
75

poshtools-issues

Issue tracker for PowerShell Pro Tools
1
star
76

universal-docker

Docker images for PowerShell Universal.
PowerShell
1
star
77

ud-jspacker

Universal Dashboard JavaScript framework packager.
1
star
78

universal-database-explorer

A MS SQL database explorer.
PowerShell
1
star