Last active
July 18, 2025 09:24
-
-
Save luisadha/5848e6b6af43cde1867cbea06ccabe2f to your computer and use it in GitHub Desktop.
prompt minimal with bash-preexec
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get_beat_time() { | |
local epoch=$(date +%s) | |
# Offset to BMT (UTC+1) | |
local bmt=$((epoch + 3600)) | |
# Took secs since midnight (BMT) | |
local sec_since_midnight=$(( bmt % 86400 )) | |
local beat=$(( sec_since_midnight * 1000 / 86400 )) | |
printf "%03d\n" "$beat" | |
} | |
cigarettesAfterSex() { | |
printf "🚬" | |
} | |
indicatorRuler() { | |
hr - | sed 's/-/^/2'; | |
} | |
blackDynamitePY() { | |
local rel | |
rel=$(python3 -c 'import os; print(os.path.relpath(os.getcwd(), os.environ["HOME"]))') | |
rel="${rel//../🧨💣}" | |
printf "%s " "$rel" | |
########\n | |
} | |
blackDynamite() { | |
local rel cwd | |
cwd="$PWD" | |
rel="${cwd/#$HOME/}" # Hilangkan prefix $HOME | |
rel="${rel#/}" # Hilangkan '/' di awal | |
rel="${rel//../🧨💣}" # Ganti '..' jadi emoji | |
printf "\n %s " "${rel:-~}" # Kalau kosong, berarti direktori HOME | |
} | |
export PROMPT_COMMAND="$PROMPT_COMMAND;cigarettesAfterSex" | |
[[ "$PS1" == '\s-\v\$ ' ]] && PS1='\[\e[0;32m\]\[\e[0m\]\[\e[0;97m\]\[\e[0m\]$(get_beat_time) ' | |
preexec_functions+=(indicatorRuler) | |
precmd_functions+=(blackDynamitePY) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment