Skip to main content

Channel Specification

This document provides the complete reference for channel TOML configuration files.

File Location

Channels are stored as .toml files in:

  • Linux/macOS: ~/.config/television/cable/
  • Windows: %LocalAppData%\television\cable\
  • Custom: Set via $TELEVISION_CONFIG/cable/ or --cable-dir

High-Level Structure

[metadata]
# Channel identification and requirements

[source]
# What to search through

[preview]
# How to preview entries

[ui]
# UI customization

[keybindings]
# Key mappings

[actions.NAME]
# Custom action definitions

[metadata]

Channel identification and documentation.

FieldTypeRequiredDescription
namestringYesUnique channel identifier
descriptionstringNoHuman-readable description
requirementsstring[]NoRequired external tools (checked at runtime)

Example:

[metadata]
name = "files"
description = "Browse and select files"
requirements = ["fd", "bat"]

[source]

Defines what data the channel searches through.

FieldTypeRequiredDescription
commandstring or string[]YesCommand(s) that produce entries
ansibooleanNoParse ANSI escape codes (default: false)
displaystringNoTemplate for display (incompatible with ansi = true)
outputstringNoTemplate for final output
watchfloatNoReload interval in seconds
entry_delimiterstringNoCustom entry delimiter (default: newline)
no_sortbooleanNoPreserve original source order, disabling match-quality sorting and frecency (default: false)
frecencybooleanNoEnable frecency-based ranking for this channel (default: true). See Frecency Sorting

Single Source Command

[source]
command = "fd -t f"

Multiple Source Commands (Cycling)

[source]
command = ["fd -t f", "fd -t f -H", "fd -t f -H -I"]
# Press Ctrl+S to cycle between commands

With ANSI Colors

[source]
command = "git log --oneline --color=always"
ansi = true
output = "{strip_ansi|split: :0}" # Clean output

Display Template

[source]
command = "docker ps --format '{{.ID}}\\t{{.Names}}\\t{{.Status}}'"
display = "{split:\\t:1} ({split:\\t:2})" # Show: name (status)
output = "{split:\\t:0}" # Output: container ID

Watch Mode

[source]
command = "docker ps"
watch = 2.0 # Reload every 2 seconds

Custom Delimiter

[source]
command = "find . -print0"
entry_delimiter = "\0" # Null-byte separated

[preview]

Defines how to preview entries.

FieldTypeRequiredDescription
commandstring or string[]NoPreview command template(s)
envtableNoEnvironment variables for preview
offsetstringNoTemplate to extract line offset
headerstringNoPreview panel header template
footerstringNoPreview panel footer template

Basic Preview

[preview]
command = "bat -n --color=always '{}'"

Multiple Preview Commands (Cycling)

[preview]
command = ["bat -n --color=always '{}'", "cat '{}'", "xxd '{}' | head -100"]
# Press Ctrl+F to cycle between preview commands

With Environment Variables

[preview]
command = "bat -n --color=always '{}'"
env = { BAT_THEME = "ansi" }

With Line Offset

# Entry format: "file.txt:42:content"
[preview]
command = "bat -H '{split:\\::1}' --color=always '{split:\\::0}'"
offset = "{split:\\::1}" # Scroll to line 42

With Header/Footer

[preview]
command = "bat -n --color=always '{}'"
header = "File: {}"
footer = "Size: $(stat -c%s '{}')"

[ui]

Customize the user interface.

Top-Level Options

FieldTypeDefaultDescription
ui_scaleinteger (0-100)100Percentage of terminal to use
layoutstring"landscape""landscape" or "portrait"
input_bar_positionstring"top""top" or "bottom"
input_headerstringchannel nameInput bar header text
input_promptstring">"Input prompt string
[ui]
ui_scale = 80
layout = "portrait"
input_bar_position = "bottom"
input_header = "Search files:"
input_prompt = ">> "

[ui.preview_panel]

FieldTypeDefaultDescription
sizeinteger (0-100)50Preview panel size percentage
headerstring-Header template
footerstring-Footer template
scrollbarbooleantrueShow scrollbar
border_typestring"rounded""none", "plain", "rounded", "thick"
paddingtableall 0Panel padding
hiddenbooleanfalseHide by default
[ui.preview_panel]
size = 60
header = "{}"
scrollbar = true
border_type = "rounded"
padding = { left = 1, right = 1 }
hidden = false

[ui.results_panel]

FieldTypeDefaultDescription
border_typestring"rounded"Border style
paddingtableall 0Panel padding
[ui.results_panel]
border_type = "plain"
padding = { top = 1, bottom = 1 }

[ui.input_bar]

FieldTypeDefaultDescription
border_typestring"rounded"Border style
paddingtableall 0Bar padding
[ui.input_bar]
border_type = "rounded"
padding = { left = 2, right = 2 }

[ui.status_bar]

FieldTypeDefaultDescription
separator_openstring""Opening separator
separator_closestring""Closing separator
hiddenbooleanfalseHide by default
[ui.status_bar]
separator_open = "["
separator_close = "]"
hidden = false

[ui.help_panel]

FieldTypeDefaultDescription
show_categoriesbooleantrueGroup by category
hiddenbooleantrueHide by default
disabledbooleanfalseCompletely disable
[ui.help_panel]
show_categories = true
hidden = true
disabled = false

[ui.remote_control]

FieldTypeDefaultDescription
show_channel_descriptionsbooleantrueShow descriptions
sort_alphabeticallybooleantrueAlphabetical sort
disabledbooleanfalseDisable feature
[ui.remote_control]
show_channel_descriptions = true
sort_alphabetically = true
disabled = false

[keybindings]

Custom key mappings for this channel.

FieldTypeDescription
shortcutstringGlobal shortcut to switch to this channel
<action>string or string[]Override default keybinding
[keybindings]
shortcut = "f1" # Press F1 to switch to this channel

# Override defaults
quit = ["esc", "ctrl-c"]
select_next_entry = ["down", "ctrl-j"]

# Trigger custom actions
ctrl-e = "actions:edit"
ctrl-o = "actions:open"

[actions.NAME]

Define custom actions that can be triggered by keybindings.

FieldTypeRequiredDescription
descriptionstringNoAction description
commandstringYesCommand template
modestringNo"fork" (default) or "execute"
separatorstringNoMulti-select join character (default: " ")

Fork Mode (Return to tv)

[actions.view]
description = "View file in less"
command = "less '{}'"
mode = "fork"

Execute Mode (Replace tv)

[actions.edit]
description = "Edit in nvim"
command = "nvim '{}'"
mode = "execute"

Multi-Select with Custom Separator

[actions.delete]
description = "Delete selected files"
command = "rm {}"
mode = "fork"
separator = " " # Files joined with spaces

Complete Example

[metadata]
name = "docker-containers"
description = "Manage Docker containers"
requirements = ["docker"]

[source]
command = ["docker ps --format '{{.ID}}\\t{{.Names}}\\t{{.Status}}'",
"docker ps -a --format '{{.ID}}\\t{{.Names}}\\t{{.Status}}'"]
display = "{split:\\t:1} | {split:\\t:2}"
output = "{split:\\t:0}"

[preview]
command = "docker inspect '{split:\\t:0}' | jq ."

[ui]
layout = "landscape"
[ui.preview_panel]
size = 55
header = "Container: {split:\\t:1}"

[keybindings]
shortcut = "f5"
ctrl-l = "actions:logs"
ctrl-x = "actions:stop"
ctrl-a = "actions:attach"

[actions.logs]
description = "View container logs"
command = "docker logs -f '{split:\\t:0}'"
mode = "fork"

[actions.stop]
description = "Stop container"
command = "docker stop '{split:\\t:0}'"
mode = "fork"

[actions.attach]
description = "Attach to container"
command = "docker exec -it '{split:\\t:0}' /bin/sh"
mode = "execute"

Template Syntax

Templates use the string-pipeline syntax. Common patterns:

PatternDescription
{}Entire entry
{0}, {1}Positional fields (delimiter: :)
{split:DELIM:INDEX}Split on custom delimiter
{strip_ansi}Remove ANSI codes
{trim}Remove whitespace
{upper}, {lower}Case conversion

For complete template documentation, see Template System.

See Also