1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

Set terminal type in the config file.

Adds a "term" option that takes a terminal type (ie: vt100, xterm,
xterm-256color, etc.)

Example:

```yaml
wtf:
  term: "vt100"
```
This commit is contained in:
Chris Cummer 2018-06-01 14:15:22 -07:00
parent bf30e8750c
commit b56629b6fd
5 changed files with 23 additions and 3 deletions

View File

@ -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
@ -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.).

View File

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

View File

@ -127,7 +127,8 @@ See this <a href="https://github.com/senorprogrammer/wtf/blob/master/_sample_con
</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 />
@ -171,6 +172,14 @@ How often, in seconds, the UI refreshes itself. <br />
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">

View File

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

2
wtf.go
View File

@ -204,6 +204,7 @@ func loadConfig(configFlag string) {
}
func main() {
cmdFlags := wtf.NewCommandFlags()
cmdFlags.Parse(version)
@ -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()