Add a flag to change the window title on run #121

Manually merged
sloum merged 3 commits from window-title into develop 2020-01-04 19:26:22 +00:00
4 changed files with 20 additions and 9 deletions

View File

@ -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
Outdated
Review

@asdf Based on your description in the issue, we should be fine with only this line, right (slighyl modified here from what is in the file_?

fBbombadillofP [fIoptionfP] [fIurlfP]

If this is correct I can remove the extra lines (7 and 8) and update 9 to the above,.

@asdf Based on your description in the issue, we should be fine with only this line, right (slighyl modified here from what is in the file_? ```groff fBbombadillofP [fIoptionfP] [fIurlfP] ``` If this is correct I can remove the extra lines (7 and 8) and update 9 to the above,.
.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

View File

@ -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
Review

%U, as it turns out, is for passing multiple urls... which we do not support. I updated to %u , which is for a single url. I also added -t so that any time the program is opened via its desktop file the title will get updated.

`%U`, as it turns out, is for passing multiple urls... which we do not support. I updated to `%u` , which is for a single url. I also added `-t` so that any time the program is opened via its desktop file the title will get updated.
Icon=bombadillo-icon
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 != "" {
fmt.Print(msg, "\n")
}
fmt.Print("\033[23;0t") // Restore window title from terminal stack
os.Exit(exitCode)
}

11
main.go
View File

@ -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
Outdated
Review

Should the syntax here get updated to just bombadillo [options] [url]?

Should the syntax here get updated to just `bombadillo [options] [url]`?
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()