summaryrefslogtreecommitdiff
path: root/setTerminalTitle.go
diff options
context:
space:
mode:
Diffstat (limited to 'setTerminalTitle.go')
-rw-r--r--setTerminalTitle.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/setTerminalTitle.go b/setTerminalTitle.go
new file mode 100644
index 0000000..a39e386
--- /dev/null
+++ b/setTerminalTitle.go
@@ -0,0 +1,16 @@
+package main
+
+import (
+ "fmt"
+)
+
+// setTitle prints the escape sequence to change the terminal title.
+func setTerminalTitle(title string) {
+ fmt.Printf("\033]2;%s\007", title)
+}
+
+// resetTitle prints the escape sequence to clear the title.
+// Most terminals will revert to their default profile title.
+func resetTerminalTitle() {
+ fmt.Printf("\033]2;\007")
+}