Skip to content

Instantly share code, notes, and snippets.

@devproblemssolutions
Created January 20, 2026 10:08
Show Gist options
  • Select an option

  • Save devproblemssolutions/4106708b2b0fa54e814f2288d5e7ac5e to your computer and use it in GitHub Desktop.

Select an option

Save devproblemssolutions/4106708b2b0fa54e814f2288d5e7ac5e to your computer and use it in GitHub Desktop.
Mindful Terminal for Developers
# -----------------------------------------------------------------------------
# 🌿 Mindful Terminal
#
# Read more: https://www.devproblems.com/developer-mindfulness
#
# A simple shell script to trigger mindfulness prompts before long-running
# developer commands (npm install, docker build, etc).
#
# HOW IT WORKS:
# This script is SEQUENTIAL. It introduces a deliberate delay (default: 3s)
# to force a moment of pause before the actual command executes.
#
# INSTALLATION:
# 1. Copy this content.
# 2. Paste it at the bottom of your configuration file:
# - For recent macOS (Zsh): ~/.zshrc
# - For older macOS/Linux (Bash): ~/.bashrc
# 3. Run `source ~/.zshrc` (or ~/.bashrc) to apply.
# -----------------------------------------------------------------------------
# 1. THE CONTENT
# Selects a random mindful prompt to display
function trigger_mindfulness() {
local prompts=(
"🌬️ Take a deep breath in... hold... and let it go."
"πŸ‘€ Look away from the screen. Focus on something 20 feet away."
"πŸ’† Unclench your jaw. Drop your shoulders."
"πŸ’§ Have you had enough water today?"
"🧠 The code will be building soon. You can rest for a moment."
"🧘 Notice the silence between the keystrokes."
"🌲 Nature does not hurry, yet everything is accomplished."
)
# Pick a random quote
# (Logic works for both Zsh and Bash)
local msg="${prompts[$RANDOM % ${#prompts[@]} + 1]}"
if [ -z "$msg" ]; then msg=${prompts[0]}; fi
# Print the message
echo ""
echo "---------------------------------------------------"
echo -e " $msg"
echo "---------------------------------------------------"
echo ""
# THE DELAY
# We deliberately sleep for 3 seconds to force the pause.
# The actual command will NOT run until this sleep finishes.
sleep 3
}
# 2. THE WRAPPERS
# These intercept specific commands to check if they are "heavy" tasks.
# Node / NPM
npm() {
if [[ "$*" == *"install"* || "$*" == *"ci"* || "$*" == *"build"* ]]; then
trigger_mindfulness
fi
command npm "$@"
}
# Yarn
yarn() {
if [[ "$*" == *"install"* || "$*" == *"build"* || "$*" == *"add"* ]]; then
trigger_mindfulness
fi
command yarn "$@"
}
# PHP / Composer
composer() {
if [[ "$*" == *"install"* || "$*" == *"update"* ]]; then
trigger_mindfulness
fi
command composer "$@"
}
# Docker
docker() {
if [[ "$*" == *"build"* || "$*" == *"compose up"* ]]; then
trigger_mindfulness
fi
command docker "$@"
}
# iOS / CocoaPods
pod() {
if [[ "$*" == *"install"* || "$*" == *"update"* ]]; then
trigger_mindfulness
fi
command pod "$@"
}
# Rust / Cargo
cargo() {
if [[ "$*" == *"build"* ]]; then
trigger_mindfulness
fi
command cargo "$@"
}
# Git (Clone/GC can take a while)
git() {
if [[ "$*" == *"clone"* || "$*" == *"gc"* ]]; then
trigger_mindfulness
fi
command git "$@"
}
@devproblemssolutions
Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment