From e85e2c46b2eaa6b067cd4ead4a34be9cdbe3a6c3 Mon Sep 17 00:00:00 2001 From: Sohrab Behdani Date: Sun, 17 Nov 2024 01:47:17 +0330 Subject: [PATCH] updated pkgbuild, changed theme --- PKGBUILD | 6 +- build.sh | 1 + parch.install | 8 + .../parchlinux/zsh/functions/fireworks.zsh | 47 +- .../parchlinux/zsh/functions/typewriter.zsh | 34 +- .../parchlinux/zsh/theme/parch.zsh-theme | 498 ------------------ rootfs/usr/share/parchlinux/zsh/update.txt | 21 - rootfs/usr/share/parchlinux/zsh/zshrc-example | 14 +- 8 files changed, 87 insertions(+), 542 deletions(-) create mode 100644 parch.install delete mode 100644 rootfs/usr/share/parchlinux/zsh/theme/parch.zsh-theme delete mode 100644 rootfs/usr/share/parchlinux/zsh/update.txt diff --git a/PKGBUILD b/PKGBUILD index 87d9cf2..ae866ef 100755 --- a/PKGBUILD +++ b/PKGBUILD @@ -1,15 +1,17 @@ pkgname=parch-zsh-config pkgver=0.1 pkgrel=1 +pkgdir=/usr/share/parchlinux/zsh/ pkgdesc="ZSH config of parch" arch=('any') url="https://git.parchlinux.com/settings/parch-zsh-config" license=("GPL-3.0") -depends=("zsh") +depends=("zsh" "zsh-autosuggestions" "spaceship-prompt" "lolcat" "curl" "zsh-history-substring-search" "zsh-syntax-highlighting" "zsh-completions") source=("package.zip") sha256sums=('SKIP') - +install=parch.install build(){ + echo "building" } package() { diff --git a/build.sh b/build.sh index e878897..f0a592c 100755 --- a/build.sh +++ b/build.sh @@ -9,6 +9,7 @@ main () { mkdir -p build zip -r build/package.zip rootfs || ziperrorandexit cp PKGBUILD build + cp parch.install build cd build || return makepkg -sc cd .. diff --git a/parch.install b/parch.install new file mode 100644 index 0000000..71876d6 --- /dev/null +++ b/parch.install @@ -0,0 +1,8 @@ +post_install() { + cat /usr/share/parchlinux/zsh/install.txt +} + + +post_upgrade() { + post_install +} diff --git a/rootfs/usr/share/parchlinux/zsh/functions/fireworks.zsh b/rootfs/usr/share/parchlinux/zsh/functions/fireworks.zsh index 4719090..705ca58 100644 --- a/rootfs/usr/share/parchlinux/zsh/functions/fireworks.zsh +++ b/rootfs/usr/share/parchlinux/zsh/functions/fireworks.zsh @@ -1,8 +1,41 @@ -function fireworks() { - if ! command -v lolcat &>/dev/null || ! command -v pv &>/dev/null; then - echo "Install 'lolcat' and 'pv' to use this function: sudo pacman -S lolcat pv" - return 1 - fi +fireworks() { + # Check for lolcat + if ! command -v lolcat &>/dev/null; then + echo "Please install 'lolcat': sudo pacman -S lolcat" >&2 + return 1 + fi - echo "🎆🎇 BOOM! 🎆🎇" | pv -qL 10 | lolcat -} + # Simpler firework patterns + local -a firework=( + " * " + " * * * " + "* * * * *" + " | " + ) + + clear + while true; do + # Print some random fireworks + for ((i=0; i<3; i++)); do + position=$((RANDOM % 70)) + spaces=$(printf '%*s' $position '') + + for pattern in "${firework[@]}"; do + echo "${spaces}${pattern}" | lolcat -f + sleep 0.1 + done + + # Add explosion effect + echo "${spaces} * * * " | lolcat -f + echo "${spaces} * * * " | lolcat -f + echo "${spaces}* * *" | lolcat -f + sleep 0.2 + done + + # Check for keyboard input to exit + read -t 0.1 -n 1 input + if [[ $? -eq 0 ]]; then + break + fi + done + echo \ No newline at end of file diff --git a/rootfs/usr/share/parchlinux/zsh/functions/typewriter.zsh b/rootfs/usr/share/parchlinux/zsh/functions/typewriter.zsh index a2596b4..4c1ab30 100644 --- a/rootfs/usr/share/parchlinux/zsh/functions/typewriter.zsh +++ b/rootfs/usr/share/parchlinux/zsh/functions/typewriter.zsh @@ -1,12 +1,24 @@ -function typewriter() { - if [ -z "$1" ]; then - echo "Usage: typewriter " - return 1 - fi +typewriter() { + # Check if an argument is provided + if [ $# -eq 0 ]; then + echo "Usage: typewriter " >&2 + return 1 + fi - for ((i=0; i<${#1}; i++)); do - echo -n "${1:i:1}" - sleep 0.05 - done - echo -} + local text="$1" + local len + + # Get length of string in characters (not bytes) + len=$(echo -n "$text" | wc -m) + + # Iterate through each character using AWK + echo -n "$text" | awk '{ + split($0, chars, "") + for (i = 1; i <= length($0); i++) { + printf "%s", chars[i] + system("sleep 0.05") + fflush() + } + }' + echo +} \ No newline at end of file diff --git a/rootfs/usr/share/parchlinux/zsh/theme/parch.zsh-theme b/rootfs/usr/share/parchlinux/zsh/theme/parch.zsh-theme deleted file mode 100644 index a79d596..0000000 --- a/rootfs/usr/share/parchlinux/zsh/theme/parch.zsh-theme +++ /dev/null @@ -1,498 +0,0 @@ -#!/bin/zsh - -#ParchLinux zsh prompt - - - -# Formatting aliases -# (add more if you need) -reset=$'\e[0m' -bold=$'\e[1m' -faint=$'\e[2m' -italic=$'\e[3m' -underline=$'\e[4m' -invert=$'\e[7m' -# ... - -# Foreground color aliases -black=$'\e[30m' -red=$'\e[31m' -green=$'\e[32m' -yellow=$'\e[33m' -blue=$'\e[34m' -magenta=$'\e[35m' -cyan=$'\e[36m' -white=$'\e[37m' -light_black=$'\e[90m' -light_red=$'\e[91m' -light_green=$'\e[92m' -light_yellow=$'\e[93m' -light_blue=$'\e[94m' -light_magenta=$'\e[95m' -light_cyan=$'\e[96m' -light_white=$'\e[97m' - -# Background color aliases -black_back=$'\e[40m' -red_back=$'\e[41m' -green_back=$'\e[42m' -yellow_back=$'\e[43m' -blue_back=$'\e[44m' -magenta_back=$'\e[45m' -cyan_back=$'\e[46m' -white_back=$'\e[47m' -light_black_back=$'\e[100m' -light_red_back=$'\e[101m' -light_green_back=$'\e[102m' -light_yellow_back=$'\e[103m' -light_blue_back=$'\e[104m' -light_magenta_back=$'\e[105m' -light_cyan_back=$'\e[106m' -light_white_back=$'\e[107m' - -# Custom colors -# REF: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters -# orange_yellow=$'\e[38;5;214m' # example 8-bit color -# orange_brown=$'\e[38;2;191;116;46m' # example rgb color -# ... - -# Flags -! [ -z "$SSH_TTY$SSH_CONNECTION$SSH_CLIENT" ] -IS_SSH=$? # 0=true, 1=false - - - -# ------------------------------------------------------------------------------ -# Customization -# Use the following variables to customize the theme -# These variables can also be set in your ~/.zshrc after sourcing this file -# The style aliases for ANSI SGR codes (defined above) can be used there too - -# Info sources (enclose in single quotes as these will be eval'd, use empty string to hide segment) -HEADLINE_USER_CMD='echo $USER' -HEADLINE_HOST_CMD='hostname -s' # consider 'basename "$VIRTUAL_ENV"' to replace host with environment -HEADLINE_PATH_CMD='print -rP "%~"' -HEADLINE_GIT_BRANCH_CMD='headline_git_branch' -HEADLINE_GIT_STATUS_CMD='headline_git_status' - -# Info symbols (optional) -HEADLINE_USER_PREFIX='' -HEADLINE_HOST_PREFIX='' # consider " " -HEADLINE_PATH_PREFIX='' -HEADLINE_BRANCH_PREFIX='' - -# Info joints -HEADLINE_USER_BEGIN='' -if [ $IS_SSH = 0 ]; then HEADLINE_USER_BEGIN='=> '; fi -HEADLINE_USER_TO_HOST=' @ ' -HEADLINE_HOST_TO_PATH=': ' -HEADLINE_PATH_TO_BRANCH=' | ' # only used when no padding between and -HEADLINE_PATH_TO_PAD='' # used if padding between and -HEADLINE_PAD_TO_BRANCH='' # used if padding between and -HEADLINE_BRANCH_TO_STATUS=' [' -HEADLINE_STATUS_TO_STATUS='' # between each status section, consider "]" -HEADLINE_STATUS_END=']' - -# Info padding character -HEADLINE_PAD_CHAR=' ' # repeated for space between and - -# Info truncation symbol -HEADLINE_TRUNC_PREFIX='...' # shown where or is truncated, consider "…" - -# Info styles -HEADLINE_STYLE_DEFAULT='' # style applied to entire info line -HEADLINE_STYLE_JOINT=$light_black -HEADLINE_STYLE_USER=$bold$red -HEADLINE_STYLE_HOST=$bold$yellow -HEADLINE_STYLE_PATH=$bold$blue -HEADLINE_STYLE_BRANCH=$bold$cyan -HEADLINE_STYLE_STATUS=$bold$magenta - -# Info options -HEADLINE_INFO_MODE=precmd # precmd|prompt (whether info line is in PROMPT or printed by precmd) - # use "precmd" for window resize to work properly (but Ctrl+L doesn't show info line) - # use "prompt" for Ctrl+L to clear properly (but window resize eats previous output) - -# Separator options -HEADLINE_LINE_MODE=on # on|auto|off (whether to print the line above the prompt) - -# Separator character -HEADLINE_LINE_CHAR='_' # repeated for line above information - -# Separator styles -HEADLINE_STYLE_JOINT_LINE=$HEADLINE_STYLE_JOINT -HEADLINE_STYLE_USER_LINE=$HEADLINE_STYLE_USER -HEADLINE_STYLE_HOST_LINE=$HEADLINE_STYLE_HOST -HEADLINE_STYLE_PATH_LINE=$HEADLINE_STYLE_PATH -HEADLINE_STYLE_BRANCH_LINE=$HEADLINE_STYLE_BRANCH -HEADLINE_STYLE_STATUS_LINE=$HEADLINE_STYLE_STATUS - -# Git branch characters -HEADLINE_GIT_HASH=':' # hash prefix to distinguish from branch - -# Git status characters -# To set individual status styles use "%{$reset