Skip to content
ConsoleMonster

API Reference

Class

TaskbarProgress

Namespace ConsoleMonster.Output
Assembly ConsoleMonster
Modifiers static

Drives the terminal's progress indicator with OSC 9;4: in Windows Terminal the tab and the taskbar button show a percentage, an error, warnings or indeterminate work. Live sessions, Write-ConsoleStatus and Terminal.Status drive it automatically, and it is cleared when they end, on Ctrl+C and on process exit. It is only written to terminals known to show it (Windows Terminal, ConEmu), never in CI, redirected or plain output, and CONSOLEMONSTER_TASKBAR=0 or TaskbarProgress.Enabled turns it off.

Inheritance

  • Object
  • TaskbarProgress

Methods

public static Void Bell() #
Returns: Void

Rings the terminal bell (BEL) on the console, for a finished run; not in CI or redirected output.

public static Void Clear() #
Returns: Void

Clears the indicator if it shows anything.

public static TaskbarState Combine(IEnumerable<KeyValuePair<TaskbarState, Double>> sources, out Int32 percent) #
Returns: TaskbarState

Combines contributions: an error wins, then warnings, then a percentage (the average of those that have one), then indeterminate work.

Parameters

sources System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<ConsoleMonster.Output.TaskbarState, System.Double>> requiredposition: 0
The contributions.
percent System.Int32 requiredposition: 1
The combined percentage.

Returns

The combined state (Clear when nothing reports).

public static Boolean IsSupported(TerminalProfile profile) #
Returns: Boolean

Whether a terminal shows the indicator: Windows Terminal (or ConEmu), interactive VT output, not CI, not redirected.

Parameters

profile ConsoleMonster.Capabilities.TerminalProfile requiredposition: 0
The profile.

Returns

True when the sequence may be written.

public static String Sequence(TaskbarState state, Int32 percent) #
Returns: String

The escape sequence for a state: ESC ] 9 ; 4 ; state ; percent BEL.

Parameters

state ConsoleMonster.Output.TaskbarState requiredposition: 0
The state.
percent System.Int32 requiredposition: 1
The percentage, 0 to 100 (ignored for Clear and Indeterminate).

Returns

The sequence.

public static Void Set(TaskbarState state, Int32 percent = 0) #
Returns: Void

Shows a state on the console when it shows the indicator; repeated states are not written again.

Parameters

state ConsoleMonster.Output.TaskbarState requiredposition: 0
The state.
percent System.Int32 = 0 optionalposition: 1
The percentage, 0 to 100.

Properties

public static Boolean Enabled { get; set; } #

Whether the indicator may be used at all (default true; CONSOLEMONSTER_TASKBAR=0 turns it off).

public static TaskbarState Current { get; } #

The state last written.