title.go 877 B

1234567891011121314151617181920212223242526272829303132
  1. package ansi
  2. // SetIconNameWindowTitle returns a sequence for setting the icon name and
  3. // window title.
  4. //
  5. // OSC 0 ; title ST
  6. // OSC 0 ; title BEL
  7. //
  8. // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands
  9. func SetIconNameWindowTitle(s string) string {
  10. return "\x1b]0;" + s + "\x07"
  11. }
  12. // SetIconName returns a sequence for setting the icon name.
  13. //
  14. // OSC 1 ; title ST
  15. // OSC 1 ; title BEL
  16. //
  17. // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands
  18. func SetIconName(s string) string {
  19. return "\x1b]1;" + s + "\x07"
  20. }
  21. // SetWindowTitle returns a sequence for setting the window title.
  22. //
  23. // OSC 2 ; title ST
  24. // OSC 2 ; title BEL
  25. //
  26. // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Operating-System-Commands
  27. func SetWindowTitle(s string) string {
  28. return "\x1b]2;" + s + "\x07"
  29. }