Skip to content

Commit

Permalink
Set terminal type in the config file.
Browse files Browse the repository at this point in the history
Adds a "term" option that takes a terminal type (ie: vt100, xterm,
xterm-256color, etc.)

Example:

```yaml
wtf:
  term: "vt100"
```
  • Loading branch information
senorprogrammer committed Jun 2, 2018
1 parent bf30e87 commit b56629b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
9 changes: 9 additions & 0 deletions _site/content/posts/configuration/attributes.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ wtf:
rows: [10, 10, 10, 10, 10, 3, 4]
# The app redraws itself once a second
refreshInterval: 1
term: "xterm-256color"
```
### Attributes
Expand Down Expand Up @@ -69,3 +70,11 @@ How often, in seconds, the UI refreshes itself. <br />
**Note:** This implementation is probably wrong and buggy and likely to
change. <br />
Values: A positive integer, `0..n`.

`term` <br />
This value is _optional_. Sets a custom value for the terminal type this app runs in. Leave this entry out of the config if you simply want to use your terminal's
default setting. <br />
**Note:** If an invalid value is provided for this setting, the app will
crash with a `"terminal entry not found"` error. <br />
Values: Any valid terminal type (ie: vt100, xterm, xterm-256color, ansi,
etc.).
2 changes: 1 addition & 1 deletion docs/index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ cmd The terminal command to be run, withouth the arguments. Ie: ping, whoami, cu

<guid>https://wtfutil.com/posts/configuration/attributes/</guid>
<description>The following top-level attributes are configurable in config.yml. See this example config file for more details.
wtf:colors:background:&amp;#34;red&amp;#34;border:Focusable:&amp;#34;darkslateblue&amp;#34;focused:&amp;#34;orange&amp;#34;normal:&amp;#34;gray&amp;#34;grid:# How _wide_ the columns are, in terminal characters. In this case we have# six columns, each of which are 35 characters widecolumns:[35,35,35,35,35,35]# How _high_ the rows are, in terminal lines. In this case we have five rows# that support ten line of text, one of three lines, and one of fourrows:[10,10,10,10,10,3,4]# The app redraws itself once a secondrefreshInterval:1 Attributes colors.</description>
wtf:colors:background:&amp;#34;red&amp;#34;border:Focusable:&amp;#34;darkslateblue&amp;#34;focused:&amp;#34;orange&amp;#34;normal:&amp;#34;gray&amp;#34;grid:# How _wide_ the columns are, in terminal characters. In this case we have# six columns, each of which are 35 characters widecolumns:[35,35,35,35,35,35]# How _high_ the rows are, in terminal lines. In this case we have five rows# that support ten line of text, one of three lines, and one of fourrows:[10,10,10,10,10,3,4]# The app redraws itself once a secondrefreshInterval:1term:&amp;#34;xterm-256color&amp;#34; Attributes colors.</description>
</item>

<item>
Expand Down
11 changes: 10 additions & 1 deletion docs/posts/configuration/attributes/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ <h1>Configuration: Attributes</h1>
</span><span class="w"> </span><span class="c"># that support ten line of text, one of three lines, and one of four</span><span class="w">
</span><span class="w"> </span>rows<span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="m">10</span><span class="p">,</span><span class="w"> </span><span class="m">10</span><span class="p">,</span><span class="w"> </span><span class="m">10</span><span class="p">,</span><span class="w"> </span><span class="m">10</span><span class="p">,</span><span class="w"> </span><span class="m">10</span><span class="p">,</span><span class="w"> </span><span class="m">3</span><span class="p">,</span><span class="w"> </span><span class="m">4</span><span class="p">]</span><span class="w">
</span><span class="w"> </span><span class="c"># The app redraws itself once a second</span><span class="w">
</span><span class="w"> </span>refreshInterval<span class="p">:</span><span class="w"> </span><span class="m">1</span></code></pre></div>
</span><span class="w"> </span>refreshInterval<span class="p">:</span><span class="w"> </span><span class="m">1</span><span class="w">
</span><span class="w"> </span>term<span class="p">:</span><span class="w"> </span><span class="s2">&#34;xterm-256color&#34;</span></code></pre></div>
<h3 id="attributes">Attributes</h3>

<p><code>colors.background</code> <br />
Expand Down Expand Up @@ -171,6 +172,14 @@ <h3 id="attributes">Attributes</h3>
change. <br />
Values: A positive integer, <code>0..n</code>.</p>

<p><code>term</code> <br />
This value is <em>optional</em>. Sets a custom value for the terminal type this app runs in. Leave this entry out of the config if you simply want to use your terminal&rsquo;s
default setting. <br />
<strong>Note:</strong> If an invalid value is provided for this setting, the app will
crash with a <code>&quot;terminal entry not found&quot;</code> error. <br />
Values: Any valid terminal type (ie: vt100, xterm, xterm-256color, ansi,
etc.).</p>

</div>

<div class="footer">
Expand Down
2 changes: 1 addition & 1 deletion docs/posts/index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ cmd The terminal command to be run, withouth the arguments. Ie: ping, whoami, cu

<guid>https://wtfutil.com/posts/configuration/attributes/</guid>
<description>The following top-level attributes are configurable in config.yml. See this example config file for more details.
wtf:colors:background:&amp;#34;red&amp;#34;border:Focusable:&amp;#34;darkslateblue&amp;#34;focused:&amp;#34;orange&amp;#34;normal:&amp;#34;gray&amp;#34;grid:# How _wide_ the columns are, in terminal characters. In this case we have# six columns, each of which are 35 characters widecolumns:[35,35,35,35,35,35]# How _high_ the rows are, in terminal lines. In this case we have five rows# that support ten line of text, one of three lines, and one of fourrows:[10,10,10,10,10,3,4]# The app redraws itself once a secondrefreshInterval:1 Attributes colors.</description>
wtf:colors:background:&amp;#34;red&amp;#34;border:Focusable:&amp;#34;darkslateblue&amp;#34;focused:&amp;#34;orange&amp;#34;normal:&amp;#34;gray&amp;#34;grid:# How _wide_ the columns are, in terminal characters. In this case we have# six columns, each of which are 35 characters widecolumns:[35,35,35,35,35,35]# How _high_ the rows are, in terminal lines. In this case we have five rows# that support ten line of text, one of three lines, and one of fourrows:[10,10,10,10,10,3,4]# The app redraws itself once a secondrefreshInterval:1term:&amp;#34;xterm-256color&amp;#34; Attributes colors.</description>
</item>

<item>
Expand Down
2 changes: 2 additions & 0 deletions wtf.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ func loadConfig(configFlag string) {
}

func main() {

cmdFlags := wtf.NewCommandFlags()
cmdFlags.Parse(version)

Expand All @@ -219,6 +220,7 @@ func main() {
wtf.WriteConfigFile()

loadConfig(cmdFlags.Config)
os.Setenv("TERM", Config.UString("wtf.term", os.Getenv("TERM")))

app := tview.NewApplication()
pages := tview.NewPages()
Expand Down

0 comments on commit b56629b

Please sign in to comment.