diff --git a/bombadillo.1 b/bombadillo.1 index bd7f0c8..f2da50e 100644 --- a/bombadillo.1 +++ b/bombadillo.1 @@ -4,8 +4,7 @@ .SH SYNOPSIS .nf .fam C -\fBbombadillo\fP [\fIurl\fP] -\fBbombadillo\fP [\fBOPTION\fP] +\fBbombadillo\fP [\fIoptions\fP] [\fIurl\fP] .fam T .fi .SH DESCRIPTION @@ -15,12 +14,16 @@ .SH OPTIONS .TP .B -\fB-v\fP -Display version information and exit. +\fB-h\fP +Display usage help and exit. Provides a list of all command line options with a short description and exits. .TP .B -\fB-h\fP -Usage help. Displays all command line options with a short description. +\fB-t\fP +Set the window title to 'Bombadillo'. Can be used in a GUI environment, however not all terminals support this feature. +.TP +.B +\fB-v\fP +Display version information and exit. .SH PROTOCOL SUPPORT All of the below protocols are supported. With the exception of gopher, the protocol name must be present as the scheme component of a url in the form of \fI[protocol]://[the rest of the url]\fP. .TP diff --git a/bombadillo.desktop b/bombadillo.desktop index 3ca2531..4510dcd 100644 --- a/bombadillo.desktop +++ b/bombadillo.desktop @@ -5,6 +5,6 @@ GenericName=Non-Web Browser Comment=View gopher, gemini, finger, telnet, http(s) sites over the internet Terminal=true Categories=Network;WebBrowser;ConsoleOnly; -Exec=bombadillo %U +Exec=bombadillo -t %u Icon=bombadillo-icon MimeType=x-scheme-handler/gopher;x-scheme-handler/gemini;x-scheme-handler/finger; diff --git a/cui/cui.go b/cui/cui.go index f294ea0..7f2be9f 100644 --- a/cui/cui.go +++ b/cui/cui.go @@ -49,6 +49,7 @@ func Exit(exitCode int, msg string) { if msg != "" { fmt.Print(msg, "\n") } + fmt.Print("\033[23;0t") // Restore window title from terminal stack os.Exit(exitCode) } diff --git a/main.go b/main.go index 88a70b0..1362e78 100644 --- a/main.go +++ b/main.go @@ -166,10 +166,10 @@ func handleSignals(c <-chan os.Signal) { func printHelp() { art := `Bombadillo - a non-web browser -Syntax: bombadillo [url] - bombadillo [options...] +Syntax: bombadillo [options] [url] Examples: bombadillo gopher://bombadillo.colorfield.space + bombadillo -t bombadillo -v Options: @@ -180,6 +180,7 @@ Options: func main() { getVersion := flag.Bool("v", false, "Display version information and exit") + addTitleToXWindow := flag.Bool("t", false, "Set the window title to 'Bombadillo'. Can be used in a GUI environment, however not all terminals support this feature.") flag.Usage = printHelp flag.Parse() if *getVersion { @@ -189,6 +190,12 @@ func main() { args := flag.Args() cui.InitTerm() + + if *addTitleToXWindow { + fmt.Print("\033[22;0t") // Store window title on terminal stack + fmt.Print("\033]0;Bombadillo\007") // Update window title + } + defer cui.Exit(0, "") initClient()