gui-cs / Terminal.Gui

Cross Platform Terminal UI toolkit for .NET
MIT License
9.73k stars 694 forks source link

Support ANSI Operating System Commands (OSCs) #2302

Open tig opened 1 year ago

tig commented 1 year ago

See https://conemu.github.io/en/AnsiEscapeCodes.html#ConEmu_specific_OSC

OSC (Operating system commands)
Note. These codes may ends with ‘ESC\’ (two symbols - ESC and BackSlash) or ‘BELL’ (symbol with code \x07, same as ‘^a’ in *nix). For simplifying, endings in the following table marked as ‘ST’.

Sequence    Description
ESC ] 0..2 ; “txt” ST   Set console window title to txt.
ConEmu specific OSC
Sequence    Description
ESC ] 9 ; 1 ; ms ST Sleep. ms - number, milliseconds.
ESC ] 9 ; 2 ; ”txt“ ST  Show GUI MessageBox ( txt ) for any purposes.
ESC ] 9 ; 3 ; ”txt“ ST  Change ConEmu Tab to txt. Set empty string to return original Tab text.
ESC ] 9 ; 4 ; st ; pr ST    Set progress state on Windows 7 taskbar and ConEmu title. When st is 0: remove progress. When st is 1: set progress value to pr (number, 0-100). When st is 2: set error state in progress on Windows 7 taskbar, pr is optional. When st is 3: set indeterminate state. When st is 4: set paused state, pr is optional.
ESC ] 9 ; 5 ST  Wait for Enter/Space/Esc. Set environment variable “ConEmuWaitKey” to “ENTER”/”SPACE”/”ESC” on exit.
ESC ] 9 ; 6 ; ”txt“ ST  Execute GuiMacro ( txt ). Set EnvVar “ConEmuMacroResult” on exit.
ESC ] 9 ; 7 ; ”cmd“ ST  Run some process with arguments.
ESC ] 9 ; 8 ; “env” ST  Output value of environment variable.
ESC ] 9 ; 9 ; “cwd” ST  Inform ConEmu about shell current working directory.
ESC ] 9 ; 10 ST Request xterm keyboard and output emulation.
ESC ] 9 ; 10 ; n ST When n is 0 turn off xterm keyboard and output emulation. When n is 1 turn on xterm keyboard and output emulation. When n is 2 turn off xterm output emulation. When n is 3 turn on xterm output emulation.
ESC ] 9 ; 11; “txt” ST  Just a ‘comment’, skip it.
ESC ] 9 ; 12 ST Let ConEmu treat current cursor position as prompt start. Useful with PS1.

These are the most interesting and we should consider allowing Terminal.Gui apps to take advantage of them.

tznind commented 1 year ago

Nice, having the console title showing users application name would be a great feature. And showing progress bar on start menu is pretty neat too.

tig commented 4 months ago

Relevant

https://github.com/mintty/mintty/blob/master/wiki/CtrlSeqs.md