Merge branch 'window-title' of sloum/bombadillo into develop

This commit is contained in:
Sloom Sloum Sluom IV 2020-01-04 14:26:21 -05:00 committed by Gitea
commit 6c634415d8
4 changed files with 20 additions and 9 deletions

View File

@ -4,8 +4,7 @@
.SH SYNOPSIS .SH SYNOPSIS
.nf .nf
.fam C .fam C
\fBbombadillo\fP [\fIurl\fP] \fBbombadillo\fP [\fIoptions\fP] [\fIurl\fP]
\fBbombadillo\fP [\fBOPTION\fP]
.fam T .fam T
.fi .fi
.SH DESCRIPTION .SH DESCRIPTION
@ -15,12 +14,16 @@
.SH OPTIONS .SH OPTIONS
.TP .TP
.B .B
\fB-v\fP \fB-h\fP
Display version information and exit. Display usage help and exit. Provides a list of all command line options with a short description and exits.
.TP .TP
.B .B
\fB-h\fP \fB-t\fP
Usage help. Displays all command line options with a short description. 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 .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. 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 .TP

View File

@ -5,6 +5,6 @@ GenericName=Non-Web Browser
Comment=View gopher, gemini, finger, telnet, http(s) sites over the internet Comment=View gopher, gemini, finger, telnet, http(s) sites over the internet
Terminal=true Terminal=true
Categories=Network;WebBrowser;ConsoleOnly; Categories=Network;WebBrowser;ConsoleOnly;
Exec=bombadillo %U Exec=bombadillo -t %u
Icon=bombadillo-icon Icon=bombadillo-icon
MimeType=x-scheme-handler/gopher;x-scheme-handler/gemini;x-scheme-handler/finger; MimeType=x-scheme-handler/gopher;x-scheme-handler/gemini;x-scheme-handler/finger;

View File

@ -49,6 +49,7 @@ func Exit(exitCode int, msg string) {
if msg != "" { if msg != "" {
fmt.Print(msg, "\n") fmt.Print(msg, "\n")
} }
fmt.Print("\033[23;0t") // Restore window title from terminal stack
os.Exit(exitCode) os.Exit(exitCode)
} }

11
main.go
View File

@ -166,10 +166,10 @@ func handleSignals(c <-chan os.Signal) {
func printHelp() { func printHelp() {
art := `Bombadillo - a non-web browser art := `Bombadillo - a non-web browser
Syntax: bombadillo [url] Syntax: bombadillo [options] [url]
bombadillo [options...]
Examples: bombadillo gopher://bombadillo.colorfield.space Examples: bombadillo gopher://bombadillo.colorfield.space
bombadillo -t
bombadillo -v bombadillo -v
Options: Options:
@ -180,6 +180,7 @@ Options:
func main() { func main() {
getVersion := flag.Bool("v", false, "Display version information and exit") 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.Usage = printHelp
flag.Parse() flag.Parse()
if *getVersion { if *getVersion {
@ -189,6 +190,12 @@ func main() {
args := flag.Args() args := flag.Args()
cui.InitTerm() 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, "") defer cui.Exit(0, "")
initClient() initClient()