0
0
forked from toolshed/abra
Files
abra/vendor/github.com/charmbracelet/x/ansi/title.go
2025-08-12 05:17:15 +00:00

49 lines
1.3 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package ansi
// SetIconNameWindowTitle returns a sequence for setting the icon name and
// window title.
//
// OSC 0 ; title ST
// OSC 0 ; title BEL
//
// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands
func SetIconNameWindowTitle(s string) string {
return "\x1b]0;" + s + "\x07"
}
// SetIconName returns a sequence for setting the icon name.
//
// OSC 1 ; title ST
// OSC 1 ; title BEL
//
// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands
func SetIconName(s string) string {
return "\x1b]1;" + s + "\x07"
}
// SetWindowTitle returns a sequence for setting the window title.
//
// OSC 2 ; title ST
// OSC 2 ; title BEL
//
// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands
func SetWindowTitle(s string) string {
return "\x1b]2;" + s + "\x07"
}
// DECSWT is a sequence for setting the window title.
//
// This is an alias for [SetWindowTitle]("1;<name>").
// See: EK-VT520-RM 5156 https://vt100.net/dec/ek-vt520-rm.pdf
func DECSWT(name string) string {
return SetWindowTitle("1;" + name)
}
// DECSIN is a sequence for setting the icon name.
//
// This is an alias for [SetWindowTitle]("L;<name>").
// See: EK-VT520-RM 5134 https://vt100.net/dec/ek-vt520-rm.pdf
func DECSIN(name string) string {
return SetWindowTitle("L;" + name)
}