termtitle

package module
v1.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2022 License: BSD-3-Clause Imports: 5 Imported by: 3

README

Terminal Title

Change the title if the currently running terminal emulator supports it.

Currently supported terminal emulators

  • konsole
  • alacritty
  • gnome-terminal

For unsupported terminal emulators, the MustSet function will try the same terminal codes as for gnome-terminal.

Example use

package main

import (
    "github.com/xyproto/termtitle"
)

func main() {
    termtitle.Set("TESTING 1 2 3")
}

Terminal codes

For konsole a working string seems to be:

\033]0;TITLE\a

While for gnome-terminal, this one works:

\033]30;TITLE\007

For alacritty, this seems to work:

\033]2;TITLE\007

TITLE is the title that will be set.

General info

  • Version: 1.5.1
  • License: BSD-3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateTitle added in v1.3.0

func GenerateTitle(filename string) string

GenerateTitle tries to find a suitable terminal emulator title text for a given filename, that is not too long (ideally <30 characters)

func MustSet added in v1.1.0

func MustSet(title string)

MustSet will do a best effort of setting the terminal emulator title. No error is returned.

func Set added in v1.1.0

func Set(title string) error

Set tries to set the title of the currently running terminal emulator. An error is returned if no supported terminal emulator is found.

func TitleString

func TitleString(title string) (string, error)

TitleString returns a string that can be used for setting the title for the currently running terminal emulator, or an error if not supported.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL