This commit is contained in:
2026-03-25 16:30:17 +01:00
parent f249171d50
commit 5bd960d386
59 changed files with 1354 additions and 10589 deletions

View File

@@ -0,0 +1,14 @@
[metadata]
name = "alias"
description = "A channel to select from shell aliases"
[source]
# you may need to adjust the command depending on your shell
command = "$SHELL -ic 'alias'"
output = "{split:=:0}"
[preview]
command = "$SHELL -ic 'alias' | grep -E '^(alias )?{split:=:0}='"
[ui.preview_panel]
size = 30

View File

@@ -0,0 +1,23 @@
[metadata]
name = "channels"
description = "A channel to find and select other channels"
[source]
command = "tv list-channels"
[keybindings]
enter = "actions:zap"
ctrl-t = "actions:echo"
[actions.echo]
description = "Echo the channel name"
command = "echo '{}'"
mode = "execute"
[actions.zap]
description = "Switch to the channel"
command = "tv '{}'"
mode = "execute"
# [preview]
# command = "bat -n --color=always ~/.config/television/cable/'{}'.toml"

View File

@@ -0,0 +1,23 @@
[metadata]
name = "compose"
description = "Search XCompose key mappings (no preview)"
[source]
command = [
"cat ~/.XCompose /usr/share/X11/locale/cs_CZ.UTF-8/Compose",
"cat /usr/share/X11/locale/en_US.UTF-8/Compose",
]
ansi = false
output = "{}"
[ui]
ui_scale = 90
layout = "portrait"
input_bar_position = "top"
input_header = "Search Compose mappings:"
[ui.preview_panel]
hidden = true # No preview panel
[ui.remote_control]
show_channel_descriptions = true

View File

@@ -0,0 +1,25 @@
[metadata]
name = "dirs"
description = "A channel to select from directories"
requirements = ["fdfind"]
[source]
command = ["printenv | grep -e '^m' | sort | cut -d= -f2-", "fdfind -t d", "fdfind -t d --hidden"]
[preview]
command = "ls -la --color=always '{}'"
[keybindings]
shortcut = "f2"
ctrl-o = "actions:cd"
ctrl-up = "actions:goto_parent_dir"
[actions.cd]
description = "Open a shell in the selected directory"
command = "cd '{}' && $SHELL"
mode = "execute"
[actions.goto_parent_dir]
description = "Re-opens tv in the parent directory"
command = "tv dirs .."
mode = "execute"

View File

@@ -0,0 +1,32 @@
[metadata]
name = "docker-compose"
description = "Manage Docker Compose services"
requirements = ["docker"]
[source]
command = "docker compose ps --format '{{.Name}}\t{{.Service}}\t{{.Status}}'"
display = "{split:\t:1} ({split:\t:2})"
output = "{split:\t:1}"
[preview]
command = "docker compose logs --tail=30 --no-log-prefix '{split:\t:1}'"
[actions.up]
description = "Start the selected service"
command = "docker compose up -d '{split:\t:1}'"
mode = "fork"
[actions.down]
description = "Stop and remove the selected service"
command = "docker compose down '{split:\t:1}'"
mode = "fork"
[actions.restart]
description = "Restart the selected service"
command = "docker compose restart '{split:\t:1}'"
mode = "fork"
[actions.logs]
description = "Follow logs of the selected service"
command = "docker compose logs -f '{split:\t:1}'"
mode = "execute"

View File

@@ -0,0 +1,19 @@
[metadata]
name = "dotfiles"
description = "A channel to select from your user's dotfiles"
requirements = ["fdfind", "bat"]
[source]
command = "fdfind -t f . $HOME/.config"
[preview]
command = "bat -n --color=always '{}'"
[keybindings]
enter = "actions:edit"
[actions.edit]
description = "Edit the selected dotfile"
command = "${EDITOR:-vim} '{}'"
shell = "bash"
mode = "execute"

View File

@@ -0,0 +1,28 @@
[metadata]
name = "files"
description = "A channel to select files and directories"
requirements = ["fdfind", "batcat", "cat", "head"]
[source]
command = ["fdfind -t f", "fdfind -t f -H", "fdfind -t f -H -I"]
[preview]
command = ["batcat -n --color=always '{}'", "cat '{}'", "head -50 '{}'"]
env = { BAT_THEME = "ansi" }
[keybindings]
shortcut = "f1"
ctrl-e = "actions:edit"
ctrl-up = "actions:goto_parent_dir"
[actions.edit]
description = "Opens the selected entries with the default editor (falls back to vim)"
command = "${EDITOR:-vim} '{}'"
shell = "bash"
# use `mode = "fork"` if you want to return to tv afterwards
mode = "execute"
[actions.goto_parent_dir]
description = "Re-opens tv in the parent directory"
command = "tv files .."
mode = "execute"

View File

@@ -0,0 +1,37 @@
[metadata]
name = "git-branch"
description = "A channel to select from git branches"
requirements = ["git"]
[source]
command = "git --no-pager branch --all --format=\"%(refname:short)\""
output = "{split: :0}"
[preview]
command = "git show -p --stat --pretty=fuller --color=always '{0}'"
[keybindings]
ctrl-o = "actions:checkout"
ctrl-d = "actions:delete"
ctrl-m = "actions:merge"
ctrl-r = "actions:rebase"
[actions.checkout]
description = "Checkout the selected branch"
command = "git switch '{0}'"
mode = "execute"
[actions.delete]
description = "Delete the selected branch"
command = "git delete-branch '{0}'"
mode = "execute"
[actions.merge]
description = "Merge the selected branch into current branch"
command = "git merge '{0}'"
mode = "execute"
[actions.rebase]
description = "Rebase current branch onto the selected branch"
command = "git rebase '{0}'"
mode = "execute"

View File

@@ -0,0 +1,34 @@
[metadata]
name = "git-diff"
description = "A channel to select files from git diff commands"
requirements = ["git"]
[source]
command = "GIT_PAGER= git diff --name-only HEAD"
[preview]
command = "GIT_PAGER= git diff HEAD --color=always -- '{}'"
[ui]
layout = "portrait"
[keybindings]
ctrl-s = "actions:stage"
ctrl-r = "actions:restore"
ctrl-e = "actions:edit"
[actions.stage]
description = "Stage the selected file"
command = "git add '{}'"
mode = "fork"
[actions.restore]
description = "Discard changes in the selected file"
command = "git restore '{}'"
mode = "fork"
[actions.edit]
description = "Open the selected file in editor"
command = "${EDITOR:-vim} '{}'"
shell = "bash"
mode = "execute"

View File

@@ -0,0 +1,34 @@
[metadata]
name = "git-log"
description = "A channel to select from git log entries"
requirements = ["git"]
[source]
command = "git log --graph --pretty=format:'%C(yellow)%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --color=always"
output = "{strip_ansi|split: :1}"
ansi = true
no_sort = true
frecency = false
[preview]
command = "git show -p --stat --pretty=fuller --color=always '{strip_ansi|split: :1}' | head -n 1000"
[keybindings]
ctrl-y = "actions:cherry-pick"
ctrl-r = "actions:revert"
ctrl-o = "actions:checkout"
[actions.cherry-pick]
description = "Cherry-pick the selected commit"
command = "git cherry-pick '{strip_ansi|split: :1}'"
mode = "execute"
[actions.revert]
description = "Revert the selected commit"
command = "git revert '{strip_ansi|split: :1}'"
mode = "execute"
[actions.checkout]
description = "Checkout the selected commit"
command = "git checkout '{strip_ansi|split: :1}'"
mode = "execute"

View File

@@ -0,0 +1,28 @@
[metadata]
name = "git-reflog"
description = "A channel to select from git reflog entries"
requirements = ["git"]
[source]
command = "git reflog --decorate --color=always"
output = "{0|strip_ansi}"
ansi = true
no_sort = true
frecency = false
[preview]
command = "git show -p --stat --pretty=fuller --color=always '{0|strip_ansi}'"
[keybindings]
ctrl-o = "actions:checkout"
ctrl-r = "actions:reset"
[actions.checkout]
description = "Checkout the selected reflog entry"
command = "git checkout '{0|strip_ansi}'"
mode = "execute"
[actions.reset]
description = "Reset --hard to the selected reflog entry"
command = "git reset --hard '{0|strip_ansi}'"
mode = "execute"

View File

@@ -0,0 +1,26 @@
[metadata]
name = "git-tags"
description = "Browse and checkout git tags"
requirements = ["git"]
[source]
command = "git tag --sort=-creatordate"
no_sort = true
frecency = false
[preview]
command = "git show --color=always '{}'"
[keybindings]
ctrl-o = "actions:checkout"
ctrl-d = "actions:delete"
[actions.checkout]
description = "Checkout the selected tag"
command = "git switch '{}'"
mode = "execute"
[actions.delete]
description = "Delete the selected tag"
command = "git tag -d '{}'"
mode = "execute"

View File

@@ -0,0 +1,24 @@
[metadata]
name = "images"
description = "Browse image files with preview"
requirements = ["fdfind", "chafa"]
[source]
command = [
"fdfind -t f -e png -e jpg -e jpeg -e gif -e webp -e bmp -e svg .",
"fdfind -t f -e png -e jpg -e jpeg -e gif -e webp -e bmp -e svg -H .",
]
[preview]
command = [
"viu -w 40 -h 80 '{}'",
"chafa -s 80x40 '{}' 2>/dev/null || file '{}'",
]
[keybindings]
ctrl-o = "actions:open"
[actions.open]
description = "Open the selected image with default viewer"
command = "xdg-open '{}' 2>/dev/null || open '{}'"
mode = "fork"

View File

@@ -0,0 +1,24 @@
[metadata]
name = "journalctl"
description = "Browse systemd journal log identifiers and their logs"
requirements = ["journalctl"]
[source]
command = "journalctl --field SYSLOG_IDENTIFIER 2>/dev/null | sort -f"
[preview]
command = "journalctl -b --no-pager -o short-iso -n 50 SYSLOG_IDENTIFIER='{}' 2>/dev/null"
[ui]
layout = "portrait"
preview_panel = { size = 70 }
[actions.logs]
description = "Follow live logs for the selected identifier"
command = "journalctl -f SYSLOG_IDENTIFIER='{}'"
mode = "execute"
[actions.full]
description = "View all logs for the selected identifier in a pager"
command = "journalctl -b --no-pager -o short-iso SYSLOG_IDENTIFIER='{}' | less"
mode = "fork"

View File

@@ -0,0 +1,33 @@
[metadata]
name = "pkgs-apt"
description = "List and manage APT packages, including upgradable ones"
requirements = ["dpkg", "apt"]
[source]
command = [
"dpkg-query -W -f='${Package}\t${Version}\t${Status}\n' 2>/dev/null | grep 'install ok installed' | awk -F'\t' '{print $1, $2}'",
"apt-mark showmanual 2>/dev/null | sort -u",
"apt-get -s upgrade 2>/dev/null | grep -oP '^Inst \\K[^ ]+' | sort -u",
]
[preview]
command = "apt show '{split: :0}' 2>/dev/null"
[keybindings]
ctrl-u = "actions:upgrade"
ctrl-d = "actions:remove"
[actions.upgrade]
description = "Upgrade the selected package"
command = "sudo apt install --only-upgrade '{split: :0}'"
mode = "execute"
[actions.reinstall]
description = "Reinstall the selected package"
command = "sudo apt install --reinstall '{split: :0}'"
mode = "execute"
[actions.remove]
description = "Remove the selected package"
command = "sudo apt remove '{split: :0}'"
mode = "execute"

View File

@@ -0,0 +1,29 @@
[metadata]
name = "pkgs-brew"
description = "List and manage Homebrew packages, including outdated ones (installed on request)"
requirements = ["brew"]
[source]
command = [
"comm -12 <(brew list --installed-on-request | sort) <(brew outdated | sort)",
"brew list --installed-on-request",
"brew list --formula",
"brew list --cask",
]
[preview]
command = "brew info '{}'"
[keybindings]
ctrl-u = "actions:upgrade"
ctrl-d = "actions:uninstall"
[actions.upgrade]
description = "Upgrade the selected package"
command = "brew upgrade '{}'"
mode = "execute"
[actions.uninstall]
description = "Uninstall the selected package"
command = "brew uninstall '{}'"
mode = "execute"

View File

@@ -0,0 +1,27 @@
[metadata]
name = "pkgs-flatpak"
description = "List and manage Flatpak applications"
requirements = ["flatpak"]
[source]
command = "flatpak list --app --columns=application,name,version 2>/dev/null"
display = "{split:\t:1} ({split:\t:2})"
output = "{split:\t:0}"
[preview]
command = "flatpak info '{split:\t:0}' 2>/dev/null"
[actions.run]
description = "Launch the selected application"
command = "flatpak run '{split:\t:0}'"
mode = "execute"
[actions.uninstall]
description = "Uninstall the selected application"
command = "flatpak uninstall '{split:\t:0}'"
mode = "execute"
[actions.update]
description = "Update the selected application"
command = "flatpak update '{split:\t:0}'"
mode = "execute"

View File

@@ -0,0 +1,28 @@
[metadata]
name = "pkgs-npm"
description = "List globally installed npm packages"
requirements = ["npm"]
[source]
command = [
"npm outdated -g --depth=0 --json | njs -p '$.stdin.json()' 'Object.entries' 'e=> e.map(([p,i])=> `${p} @${i.current} → ${i.wanted} (${i.latest})`).join(\"\\n\")'",
"npm list -g --depth=0 --json | njs -p '$.stdin.json().dependencies' 'Object.entries' 'e=> e.map(([p,i])=> p).join(\"\\n\")'",
]
output = "{split: :0}"
[preview]
command = "npm info '{split: :0}' 2>/dev/null | head -30"
[keybindings]
ctrl-u = "actions:update"
ctrl-d = "actions:uninstall"
[actions.uninstall]
description = "Uninstall the selected global package"
command = "npm uninstall -g '{split: :0}'"
mode = "execute"
[actions.update]
description = "Update the selected global package"
command = "npm update -g '{split: :0}'"
mode = "execute"

View File

@@ -0,0 +1,23 @@
[metadata]
name = "recent-files"
description = "List recently modified files (via git or filesystem)"
requirements = ["git", "fdfind", "batcat"]
[source]
command = [
"git diff --name-only HEAD~10 HEAD 2>/dev/null || find . -type f -mtime -7 -not -path '*/.*' 2>/dev/null | head -100",
"fdfind -t f --changed-within 7d -E .git -E .cache -E node_modules -E .local/share/Trash",
]
[preview]
command = "batcat -n --color=always '{}'"
env = { BAT_THEME = "ansi" }
[keybindings]
ctrl-e = "actions:edit"
[actions.edit]
description = "Open the selected file in editor"
command = "${EDITOR:-vim} '{}'"
shell = "bash"
mode = "execute"

View File

@@ -0,0 +1,29 @@
[metadata]
name = "text"
description = "A channel to find and select text from files"
requirements = ["rg", "batcat"]
[source]
command = [
"rg . --no-heading --line-number --colors 'match:fg:white' --colors 'path:fg:blue' --color=always",
"rg . --no-heading --line-number --hidden --colors 'match:fg:white' --colors 'path:fg:blue' --color=always",
]
ansi = true
output = "'+{strip_ansi|split:\\::1}' '{strip_ansi|split:\\::0}'"
[preview]
command = "batcat -n --color=always '{strip_ansi|split:\\::0}'"
env = { BAT_THEME = "ansi" }
offset = '{strip_ansi|split:\::1}'
[ui]
preview_panel = { header = '{strip_ansi|split:\::..2}' }
[keybindings]
ctrl-e = "actions:edit"
[actions.edit]
description = "Open file in editor at line"
command = "${EDITOR:-vim} '+{strip_ansi|split:\\::1}' '{strip_ansi|split:\\::0}'"
shell = "bash"
mode = "execute"