Share your custom commands/modules! #1252
Replies: 98 comments 123 replies
-
ScreenshotCustom Command ScriptThe script below ( #!/usr/bin/zsh
if ! git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
exit 1
fi
$(git diff-files --no-ext-diff --quiet)
unstaged=$?
$(git diff-index --no-ext-diff --quiet --cached HEAD)
uncommited=$?
untracked=$(git ls-files -o --exclude-standard)
if [[ $unstaged -eq 1 || $uncommited -eq 1 || -n $untracked ]]; then
exit 0
fi
exit 1 # ~/.config/starship.toml
[custom.dirty]
command = "echo '*'"
when = "git-change"
style = "fg:red"
shell = "zsh"
prefix = ""
suffix = " " |
Beta Was this translation helpful? Give feedback.
-
ScreenshotCustom Command ScriptI've been bouncing between zsh and fish, so I wanted a subtle indicator to let me know which shell I was working in. I used external scripts as opposed to trying to make it work inline, since fish has its own syntax for conditional statements. # ~/.config/starship.toml
[custom.zsh]
command = "echo 🚀"
when = "~/.test_zsh.sh"
prefix = ""
[custom.fish]
command = "echo 🐟"
when = "~/.test_fish.sh"
prefix = "" ~/.test_zsh.sh
#!/usr/bin/env bash
if [ "$STARSHIP_SHELL" == "zsh" ]
then
echo true
else
exit 1
fi ~/.test_fish.sh
#!/usr/bin/env bash
if [ "$STARSHIP_SHELL" == "fish" ]
then
echo true
else
exit 1
fi |
Beta Was this translation helpful? Give feedback.
-
ScreenshotCustom Command ScriptThis is just a visual indicator for me that my current project that I am working on does have docker/docker-compose support. The symbol will only be shown when [custom.docker]
description = "Shows the docker symbol if the current directory has Dockerfile or docker-compose.yml files"
command = "echo 🐳"
files = ["Dockerfile", "docker-compose.yml", "docker-compose.yaml"]
when = """ command -v docker &> /dev/null; exit (echo $?); """
prefix = "on " Related |
Beta Was this translation helpful? Give feedback.
-
Screenshot:Custom Command ScriptThis is an alternative to the current git_status module which performs faster in some repos by calling git directly (in one of my cases: <1sec vs 4+ secs). I stole it from spaceship-prompt: https://github.com/denysdovhan/spaceship-prompt/ # ~/.config/starship.toml
format = """
...
$git_branch\
$git_commit\
$git_state\
$git_status\
${custom.git_status}\
...
"""
[git_status]
stashed = ''
# to slow
disabled=true
[custom.git_status]
description = "git status which calls git directly"
command = "~/bin/git_status_prompt.zsh || true"
when = "true"
style = "bold red"
# current master version of how to specify formats
format = "[\\[$output\\]]($style) "
#disabled = true ~/bin/git_status_prompt.zsh: #!/usr/bin/zsh
# initial code from https://github.com/denysdovhan/spaceship-prompt/blob/master/sections/git_status.zsh
#
# Git status
#
# ------------------------------------------------------------------------------
# Local Config
# ------------------------------------------------------------------------------
# Don't like stashed show up, I usually always have something stashed in the main repo
SPACESHIP_GIT_STATUS_STASHED=""
# coloring happens in starship
SPACESHIP_GIT_STATUS_COLOR=""
# ------------------------------------------------------------------------------
# Utils (from https://github.com/denysdovhan/spaceship-prompt/blob/master/lib/utils.zsh)
# ------------------------------------------------------------------------------
spaceship::is_git() {
# See https://git.io/fp8Pa for related discussion
[[ $(command git rev-parse --is-inside-work-tree 2>/dev/null) == true ]]
}
# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------
SPACESHIP_GIT_STATUS_SHOW="${SPACESHIP_GIT_STATUS_SHOW=true}"
SPACESHIP_GIT_STATUS_PREFIX="${SPACESHIP_GIT_STATUS_PREFIX=" ["}"
SPACESHIP_GIT_STATUS_SUFFIX="${SPACESHIP_GIT_STATUS_SUFFIX="]"}"
SPACESHIP_GIT_STATUS_UNTRACKED="${SPACESHIP_GIT_STATUS_UNTRACKED="?"}"
SPACESHIP_GIT_STATUS_ADDED="${SPACESHIP_GIT_STATUS_ADDED="+"}"
SPACESHIP_GIT_STATUS_MODIFIED="${SPACESHIP_GIT_STATUS_MODIFIED="!"}"
SPACESHIP_GIT_STATUS_RENAMED="${SPACESHIP_GIT_STATUS_RENAMED="»"}"
SPACESHIP_GIT_STATUS_DELETED="${SPACESHIP_GIT_STATUS_DELETED="✘"}"
SPACESHIP_GIT_STATUS_STASHED="${SPACESHIP_GIT_STATUS_STASHED="$"}"
SPACESHIP_GIT_STATUS_UNMERGED="${SPACESHIP_GIT_STATUS_UNMERGED="="}"
SPACESHIP_GIT_STATUS_AHEAD="${SPACESHIP_GIT_STATUS_AHEAD="⇡"}"
SPACESHIP_GIT_STATUS_BEHIND="${SPACESHIP_GIT_STATUS_BEHIND="⇣"}"
SPACESHIP_GIT_STATUS_DIVERGED="${SPACESHIP_GIT_STATUS_DIVERGED="⇕"}"
# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------
# We used to depend on OMZ git library,
# But it doesn't handle many of the status indicator combinations.
# Also, It's hard to maintain external dependency.
# See PR #147 at https://git.io/vQkkB
# See git help status to know more about status formats
spaceship_git_status() {
[[ $SPACESHIP_GIT_STATUS_SHOW == false ]] && return
spaceship::is_git || return
local INDEX git_status=""
INDEX=$(command git status --porcelain -b 2> /dev/null)
# Check for untracked files
if $(echo "$INDEX" | command grep -E '^\?\? ' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_UNTRACKED$git_status"
fi
# Check for staged files
if $(echo "$INDEX" | command grep '^A[ MDAU] ' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_ADDED$git_status"
elif $(echo "$INDEX" | command grep '^M[ MD] ' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_ADDED$git_status"
elif $(echo "$INDEX" | command grep '^UA' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_ADDED$git_status"
fi
# Check for modified files
if $(echo "$INDEX" | command grep '^[ MARC]M ' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_MODIFIED$git_status"
fi
# Check for renamed files
if $(echo "$INDEX" | command grep '^R[ MD] ' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_RENAMED$git_status"
fi
# Check for deleted files
if $(echo "$INDEX" | command grep '^[MARCDU ]D ' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_DELETED$git_status"
elif $(echo "$INDEX" | command grep '^D[ UM] ' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_DELETED$git_status"
fi
# Check for stashes
if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then
git_status="$SPACESHIP_GIT_STATUS_STASHED$git_status"
fi
# Check for unmerged files
if $(echo "$INDEX" | command grep '^U[UDA] ' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_UNMERGED$git_status"
elif $(echo "$INDEX" | command grep '^AA ' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_UNMERGED$git_status"
elif $(echo "$INDEX" | command grep '^DD ' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_UNMERGED$git_status"
elif $(echo "$INDEX" | command grep '^[DA]U ' &> /dev/null); then
git_status="$SPACESHIP_GIT_STATUS_UNMERGED$git_status"
fi
# Check whether branch is ahead
local is_ahead=false
if $(echo "$INDEX" | command grep '^## [^ ]\+ .*ahead' &> /dev/null); then
is_ahead=true
fi
# Check whether branch is behind
local is_behind=false
if $(echo "$INDEX" | command grep '^## [^ ]\+ .*behind' &> /dev/null); then
is_behind=true
fi
# Check wheather branch has diverged
if [[ "$is_ahead" == true && "$is_behind" == true ]]; then
git_status="$SPACESHIP_GIT_STATUS_DIVERGED$git_status"
else
[[ "$is_ahead" == true ]] && git_status="$SPACESHIP_GIT_STATUS_AHEAD$git_status"
[[ "$is_behind" == true ]] && git_status="$SPACESHIP_GIT_STATUS_BEHIND$git_status"
fi
# changed
if [[ -n $git_status ]]; then
echo $git_status
fi
}
spaceship_git_status |
Beta Was this translation helpful? Give feedback.
-
ScreenshotCustom Command ScriptShows which version of ansible is active, assuming ansible gets activated by its # ~/.config/starship.toml
[custom.ansible]
description = "Ansible version"
command = "echo -n $(ansible --version 2>/dev/null | grep ^ansible | awk '{ print $2 }') $(which ansible | sed -e s@$HOME/@@ -e s@/bin/ansible@@ -e s@/.virtual_env@@)
when = """ test -n "${ANSIBLE_HOME}" """
files = [ "ansible.cfg" ]
shell = "/bin/bash"
symbol = "Ⓐ "
format = "[$symbol$output]($style) " |
Beta Was this translation helpful? Give feedback.
-
ScreenshotCustom Command ScriptShow a marker whilst the # ~/.config/starship.toml
[custom.sudo]
description = "valid sudo timestamp marker"
command = "echo -n '!'"
format = "[$symbol$output]($style) "
style = "bold fg:bright-red"
when = "sudo -vn &>/dev/null" |
Beta Was this translation helpful? Give feedback.
-
ScreenshotCustom Command ScriptA custom module for displaying Deno version. Before Deno, NodeJS was the only runtime for javascript so any [custom.deno]
command = """ sed "s/deno //g" <<< "$(deno -V)" """
files = ["mod.ts", "deps.ts", "mod.js", "deps.js"]
format = "🦕 [$output](green) "
[custom.node]
command = """ sed "s/v//g" <<< "$(node -v)" """
directories = ["node_modules"]
files = ["package.json"]
format = "node [$output](green) " FAQ
|
Beta Was this translation helpful? Give feedback.
-
ScreenshotCustom Command ScriptA two-fer to show SSH agent status, if you have or don't have keys available # ~/.config/starship.toml
[custom.ssh_no_keys]
description = "SSH missing keys"
when = "ssh-add -l | grep -q 'no identities'"
command = "echo 🚫"
format = "$symbol[$output]($style) "
shell = ["bash", "--noprofile", "--norc"]
symbol = "🔑"
style = "bold fg:red"
[custom.ssh_keys]
description = "SSH key count"
when = "ssh-add -l | grep -v -q 'no identities'"
command = "ssh-add -l | grep -v 'no identities' | wc -l"
format = "$symbol[$output]($style) "
shell = ["bash", "--noprofile", "--norc"]
symbol = "🔑"
style = "bold fg:green" |
Beta Was this translation helpful? Give feedback.
-
Based off my Q&A #1880 (comment) This will fill the rest of the line with the background color of your choice. [custom.bgfill]
command = "echo a"
style="yellow bg:yellow"
when="true"
shell="sh"
format = "[$output\u001B\\[K]($style)" |
Beta Was this translation helpful? Give feedback.
-
Hello everybody, based on a question on our Discord channel, the following displays a (pseudo) random emoji at your prompt: ScreenshotCustom Command ScriptFor a how to use the custom script, please take a look a the configuration->custom-commands section of the documentation. You can update the [custom.emoji]
description = "Displays a (pseudo) random emoji for each prompt"
# change the content of the EMOJIS array to your liking and replace the
# number 12 with the number of items in the array, minus one
command = "EMOJIS=(⛵️ 🛰 🪐 🚀 🧡 🔭 🌍 💫 ☄️ ✨ 🌠 🌌 ⭐️); EMOJI_INDEX=$(( $RANDOM % 12 + 0 )); echo ${EMOJIS[$EMOJI_INDEX]}"
# if you are on windows, replace "true" with "1"
when = "true"
shell = ["bash", "--noprofile", "--norc"]
format = "$output" |
Beta Was this translation helpful? Give feedback.
-
zsh/bash/fish custom emoji similar to the first post, but not requiring an extra script [custom.zsh]
command = "echo 🚀"
when = """ test "$STARSHIP_SHELL" "==" "zsh" """
format = "$output"
[custom.bash]
command = "echo "
when = """ test "$STARSHIP_SHELL" "==" "bash" """
format = "$output"
[custom.fish]
command = "echo 🐟 "
when = """ test "$STARSHIP_SHELL" = "fish" """
format = "$output" |
Beta Was this translation helpful? Give feedback.
-
Show remote Git serverCustom Command ScriptDisplays a Nerd Font symbol of the location of the remote git. # ~/.config/starship.toml
[custom.giturl]
# disabled = true
description = "Display symbol for remote Git server"
command = "check-git-remote"
when = 'git rev-parse --is-inside-work-tree 2> /dev/null'
shell = ["bash", "--noprofile", "--norc"]
format = "at $output " #!/usr/bin/env bash
## place in your shell path with the name 'check-git-remote'
GIT_REMOTE=$(command git ls-remote --get-url 2> /dev/null)
if [[ "$GIT_REMOTE" =~ "github" ]]; then
GIT_REMOTE_SYMBOL=" "
elif [[ "$GIT_REMOTE" =~ "gitlab" ]]; then
GIT_REMOTE_SYMBOL=" "
elif [[ "$GIT_REMOTE" =~ "bitbucket" ]]; then
GIT_REMOTE_SYMBOL=" "
elif [[ "$GIT_REMOTE" =~ "git" ]]; then
GIT_REMOTE_SYMBOL=" "
else
GIT_REMOTE_SYMBOL=" "
fi
echo "$GIT_REMOTE_SYMBOL " You need to place a |
Beta Was this translation helpful? Give feedback.
-
Show system icons[custom.system_icons]
description = "Show system icons"
command = '([ $(uname -s) == "Darwin" ] && echo ) || ([ $(uname -s) == "Linux" ] && echo )'
symbol = "at"
format = "[$symbol]() [$output]($style) "
style = "bold"
shell = ["bash", "--noprofile", "--norc"]
when = "true" |
Beta Was this translation helpful? Give feedback.
-
Shows which version of python is currently active (if different from system python), keeping things as compact as possible. # Using a custom format to highlight current non-system python in a compact manner
# - 🐍: python from virtual env is active
# - 🦎: python from pyenv is active
[custom.py]
command = """ pv=$(python --version | grep -Eo "\\d+\\.\\d+"); if [ -n "$VIRTUAL_ENV" ]; then echo "🐍 $pv"; else echo "🦎 $pv"; fi """
style = "blue"
when = """ [[ -n "$VIRTUAL_ENV" || $PATH =~ /pyenv/ ]] """
shell = ["bash", "--noprofile", "--norc"] |
Beta Was this translation helpful? Give feedback.
-
Just some modification of @mickimnet custom Show remote git server ScreenshotCustom Command ScriptThis script just a little modification of the previous script which add the git host after the icon, I don't have enough understanding of bash scripting, so i think they are need an improvement. #!/bin/sh
# ~/.local/bin/getgithost
IFS="/"
GIT_REMOTE=$(command git ls-remote --get-url 2> /dev/null)
read -ra GIT_HOST <<< "$GIT_REMOTE"
if [[ "$GIT_REMOTE" =~ "github" ]]; then
GIT_REMOTE_SYMBOL=" "
elif [[ "$GIT_REMOTE" =~ "gitlab" ]]; then
GIT_REMOTE_SYMBOL=" "
elif [[ "$GIT_REMOTE" =~ "bitbucket" ]]; then
GIT_REMOTE_SYMBOL=" "
elif [[ "$GIT_REMOTE" =~ "git" ]]; then
GIT_REMOTE_SYMBOL=" "
else
GIT_REMOTE_SYMBOL=" localhost"
fi
echo "$GIT_REMOTE_SYMBOL${GIT_HOST[2]}"
IFS=" " The custom module declaration # ~/.config/starship/custom-module.toml
[custom.git_host]
command = 'getgithost'
when = 'git rev-parse --is-inside-work-tree 2> /dev/null'
shell = ["bash","--norc","--noprofile"]
style = "bright-yellow bold"
format = "at [$output]($style) " And then, i put it in the format = """
$username\
$hostname\
$shlvl\
$kubernetes\
${custom.dir}\
${custom.home_dir}\
$directory\
${custom.git_host}\
$git_branch\
$git_commit\
$git_state\
$git_status\
$hg_branch\
# other module
.
.
. |
Beta Was this translation helpful? Give feedback.
-
Ranger shell indicatorScreenshotCustom Command ScriptThis module shows if you are in a Ranger shell # ~/.config/starship.toml
[custom.ranger]
description = "shows if you are in a Ranger shell"
command = "echo 🤠"
when = ''' test -n "${RANGER_LEVEL}" '''
|
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
ScreenshotCustom Command ScriptJust setup starship for the first time. As I work with TeX I wanted a custom language for it # ~/.config/starship.toml
[custom.tex]
command = """tex --version | head -n 1 | cut --delimiter=" " --fields=2"""
detect_extensions = ['tex']
symbol = " " |
Beta Was this translation helpful? Give feedback.
-
WordPress LogoScreenshotDescriptionShows WordPress logo and version number. Configuration
LimitationsThe logo will be shown when the current working directory is under wp-admin/, wp-content/ or wp-includes/. |
Beta Was this translation helpful? Give feedback.
-
MPRIS now playingDescriptionSame thing as @korochun's Apple Music, but uses MPRIS on Linux Configuration
|
Beta Was this translation helpful? Give feedback.
-
Know if your system is on FIRE 🔥🔥🔥ScreenshotCustom Command ScriptChecks if the system is on FIRE. Note that this does cause an excessive ~0.3s lag in the prompt each time. #!/usr/bin/env bash
TEMP=$(sensors | grep -i "Core 1:" | awk '{print $3}' | cut -c 2-3)
CPU_USAGE=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1}')
RAM_USAGE=$(free | grep Mem | awk '{print $3/$2 * 100.0}')
SWAP_USAGE=$(free | grep Swap | awk '{print $3/$2 * 100.0}')
ROOT_USAGE=$(df -h | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | cut -d'%' -f1 | sed -n 2p)
HOME_USAGE=$(df -h | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | cut -d'%' -f1 | sed -n 3p)
FAN_SPEED=$(sensors | grep -i cpu_fan | awk '{print $2}')
if [ "$1" == "list" ]; then
echo "Temp: $TEMP°C"
echo "CPU Usage: $CPU_USAGE%"
echo "RAM Usage: $RAM_USAGE%"
echo "Swap Usage: $SWAP_USAGE%"
echo "Root Usage: $ROOT_USAGE%"
echo "Home Usage: $HOME_USAGE%"
echo "Fan Speed: $FAN_SPEED RPM"
fi
MAX_TEMP=70
MAX_CPU_USAGE=90
MAX_RAM_USAGE=90
MAX_SWAP_USAGE=90
MAX_ROOT_USAGE=85
MAX_HOME_USAGE=85
MAX_FAN_SPEED=3500
compare() {
echo "$1 > $2" | bc -l
}
if [ $(compare $TEMP $MAX_TEMP) -eq 1 ] || \
[ $(compare $CPU_USAGE $MAX_CPU_USAGE) -eq 1 ] || \
[ $(compare $RAM_USAGE $MAX_RAM_USAGE) -eq 1 ] || \
[ $(compare $SWAP_USAGE $MAX_SWAP_USAGE) -eq 1 ] || \
[ $(compare $ROOT_USAGE $MAX_ROOT_USAGE) -eq 1 ] || \
[ $(compare $HOME_USAGE $MAX_HOME_USAGE) -eq 1 ] || \
[ $(compare $FAN_SPEED $MAX_FAN_SPEED) -eq 1 ]; then
exit 0
else
exit 1
fi # ~/.config/starship.toml
[custom.hot]
description = "Check if the system is on FIRE"
when = "hot"
format = "🔥"
disabled = false |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Not sure if that is a known trick, but if you want some module to occupy its own dedicated line, but only when this module has something to display (another format = """
$directory\
${custom.kubernetes}\
$line_break\
$character"""
[kubernetes]
disabled = false
[custom.kubernetes]
command = 'printf "\e\n"; starship module kubernetes'
when = '[[ "${KUBECONFIG}" ]]' |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Google Cloud Compute VM instance external IP address:
|
Beta Was this translation helpful? Give feedback.
-
I recently released git-prompt-string 📍A shell agnostic git prompt written in Go. git-prompt-string provides an alternate format to starship's git configurations. See git-prompt-string#starship for additional info on configuring it with starship. See my dotfiles .config/starship.toml for my personal configuration used in the demo above. Another example: "$schema" = 'https://starship.rs/config-schema.json'
format = """
$directory\
${custom.git-prompt-string}\
$line_break\
[starship](green) \
[\\$](cyan) \
"""
[custom.git-prompt-string]
command = "git-prompt-string || :"
when = true
[directory]
home_symbol='~'
format = '[$path]($style)'
truncation_length = 0
truncate_to_repo = false
style = "yellow"
use_logical_path = true Note Starship will hide custom commands that fail with a non-zero exit code. To prevent this, add |
Beta Was this translation helpful? Give feedback.
-
Hi all, thanks a lot for the various examples I am working a lot with Angular and wanted to display the current version of the framework but without success So far I created the following PowerShell script: function Find-Angular-File {
$currentDirectory = Get-Location
$packageJsonFile = Get-ChildItem -Path $currentDirectory -Recurse -Filter 'package.json' -File | Select-Object -First 1
if ($packageJsonFile) {
$packageJson = Get-Content $packageJsonFile.FullName | ConvertFrom-Json
$angularVersion = $packageJson.dependencies.'@angular/core'
return $angularVersion
}
while ($currentDirectory.Parent) {
$currentDirectory = $currentDirectory.Parent
$packageJsonFile = Get-ChildItem -Path $currentDirectory -Filter 'package.json' -File | Select-Object -First 1
if ($packageJsonFile) {
$packageJson = Get-Content $packageJsonFile.FullName | ConvertFrom-Json
$angularVersion = $packageJson.dependencies.'@angular/core'
Write-Output $angularVersion
}
}
Write-Output $null
}
Find-Angular-File Which successfully prints either the version (i.e. I am attempting to add this to my configuration using the following settings: [custom.angular]
command = "~/.config/starship-scripts/find-angular-version.ps1"
shell = ['pwsh.exe', '-NoProfile', '-Command']
format = "using [\udb81\udebf $output](red)" Unfortunately, nothing shows up. I would greatly appreciate any advice to make this work! |
Beta Was this translation helpful? Give feedback.
-
ScreenshotCustom Command ScriptRelatively niche, but if you use Salesforce CLI regularly, this will show which Salesforce target you are currently authenticated against, with the logo to remind you what it's telling you. If not authenticated, it tells you that too. It has jq as a "dependency", as it was the easiest way to get the info from Salesforce's CLI. # ~/.config/starship.toml
[custom.sf]
description = "Salesforce extension"
detect_files = ["sfdx-project.json"]
style = "bold bright-blue"
symbol = " "
command = """value=$(sf config get target-org --json | jq -r '.result[0].value'); if [ "$value" != "null" ]; then echo "$value"; else echo "No Target Org"; fi"""
format = "using [$symbol$output ](bright-blue)" |
Beta Was this translation helpful? Give feedback.
-
Show Pacman and AUR updatesI was thinking it would be nice to know if you're due for an update and what better place than the terminal! Please upvote if you use, helps people find!
FormatThis is how I have mine set up in the picture (it's on the right) I excluded styling for simplicity. If you want the full setup then reply but mine's messy so I din't include it. right_format = """
...
${custom.pacman_updates}\
${custom.aur_updates}\
...
""" Pacman UpdatesFormat: [custom.pacman_updates]
command = """RATE=5; CACHE_FILE="${HOME}/.cache/pacman_update_count.txt"; write_updates () { echo "$(checkupdates --nocolor | wc -l)"" > $CACHE_FILE; }; if ! test -f $CACHE_FILE; then touch $CACHE_FILE && write_updates; fi; if test `find $CACHE_FILE -mmin +$RATE`; then write_updates; fi; echo "$(<$CACHE_FILE)""""
when = "true"
symbol = " "
shell = ["bash", "--noprofile", "--norc"]
format = "$symbol$output" AUR UpdatesFormat: [custom.aur_updates]
command = """RATE=5; CACHE_FILE="${HOME}/.cache/aur_update_count.txt"; write_updates () { echo "$(pacman -Qm | aur vercmp | wc -l)" > $CACHE_FILE; }; if ! test -f $CACHE_FILE; then touch $CACHE_FILE && write_updates; fi; if test `find $CACHE_FILE -mmin +$RATE`; then write_updates; fi; echo "$(<$CACHE_FILE)""""
when = "true"
symbol = " "
shell = ["bash", "--noprofile", "--norc"]
format = "$symbol$output" CombinedFormat: [custom.combined_updates]
command = """RATE=5; CACHE_FILE="${HOME}/.cache/aur_update_count.txt"; write_updates () { echo "$(($(checkupdates --nocolor | wc -l)))|$(($(pacman -Qm | aur vercmp | wc -l)))" > $CACHE_FILE; }; if ! test -f $CACHE_FILE; then touch $CACHE_FILE && write_updates; fi; if test `find $CACHE_FILE -mmin +$RATE`; then write_updates; fi; echo "$(<$CACHE_FILE)""""
when = "true"
symbol = " "
shell = ["bash", "--noprofile", "--norc"]
format = "$symbol $output" TotalFormat: [custom.total_updates]
command = """RATE=5; CACHE_FILE="${HOME}/.cache/aur_update_count.txt"; write_updates () { echo "checkupdates-with-aur | wc -l)))" > $CACHE_FILE; }; if ! test -f $CACHE_FILE; then touch $CACHE_FILE && write_updates; fi; if test `find $CACHE_FILE -mmin +$RATE`; then write_updates; fi; echo "$(<$CACHE_FILE)""""
when = "true"
symbol = " "
shell = ["bash", "--noprofile", "--norc"]
format = "$symbol $output" |
Beta Was this translation helpful? Give feedback.
-
Add file protocol hyperlink to
|
Beta Was this translation helpful? Give feedback.
-
Heyo Starship Fleet 👋,
I've seen a lot of people use custom commands to make modules that fit their needs. It would be great if we could share them here for others that may want to reuse them!
Here's the template to use to share custom commands:
Beta Was this translation helpful? Give feedback.
All reactions