Skip to content
ConsoleMonster
Class

TaskbarProgress

ConsoleMonster.Output

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, Show-ConsoleStatusLine 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() #

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

public static void Clear() #

Clears the indicator if it shows anything.

public static TaskbarState Combine(IEnumerable<KeyValuePair<TaskbarState, double>> sources, out int percent) #

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, double>> required
The contributions.
percent int required
The combined percentage.

Returns

TaskbarState The combined state (Clear when nothing reports).
public static bool IsSupported(TerminalProfile profile) #

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

Parameters

profile ConsoleMonster.Capabilities.TerminalProfile required
The profile.

Returns

bool True when the sequence may be written.
public static string Sequence(TaskbarState state, int percent) #

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

Parameters

state ConsoleMonster.Output.TaskbarState required
The state.
percent int required
The percentage, 0 to 100 (ignored for Clear and Indeterminate).

Returns

string The sequence.
public static void Set(TaskbarState state, int percent = 0) #

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

Parameters

state ConsoleMonster.Output.TaskbarState required
The state.
percent int = 0 optional
The percentage, 0 to 100.

Properties

public static bool 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.