Debian Codegraph @

ansi/title.go

raw
1 package ansi
2
3 // SetIconNameWindowTitle returns a sequence for setting the icon name and
4 // window title.
5 //
6 // OSC 0 ; title ST
7 // OSC 0 ; title BEL
8 //
9 // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands
10 func SetIconNameWindowTitle(s string) string {
11 return "\x1b]0;" + s + "\x07"
12 }
13
14 // SetIconName returns a sequence for setting the icon name.
15 //
16 // OSC 1 ; title ST
17 // OSC 1 ; title BEL
18 //
19 // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands
20 func SetIconName(s string) string {
21 return "\x1b]1;" + s + "\x07"
22 }
23
24 // SetWindowTitle returns a sequence for setting the window title.
25 //
26 // OSC 2 ; title ST
27 // OSC 2 ; title BEL
28 //
29 // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands
30 func SetWindowTitle(s string) string {
31 return "\x1b]2;" + s + "\x07"
32 }
33
34 // DECSWT is a sequence for setting the window title.
35 //
36 // This is an alias for [SetWindowTitle]("1;<name>").
37 // See: EK-VT520-RM 5–156 https://vt100.net/dec/ek-vt520-rm.pdf
38 func DECSWT(name string) string {
39 return SetWindowTitle("1;" + name)
40 }
41
42 // DECSIN is a sequence for setting the icon name.
43 //
44 // This is an alias for [SetWindowTitle]("L;<name>").
45 // See: EK-VT520-RM 5–134 https://vt100.net/dec/ek-vt520-rm.pdf
46 func DECSIN(name string) string {
47 return SetWindowTitle("L;" + name)
48 }