style: format shell scripts

This commit is contained in:
github-actions[bot] 2025-02-25 12:36:22 +00:00
parent 8c5babe80a
commit 76b5fd4118
18 changed files with 231 additions and 242 deletions

View file

@ -4,7 +4,6 @@
# Sourced by user's zshrc if is Linux 在用户的 zshrc 中被引用
# Entry point in $DOTFILES/tools/zsh/common.zshrc (入口点)
if [ -n "$WAYLAND_DISPLAY" ]; then
alias clip="wl-copy"
alias paste="wl-paste"

View file

@ -8,15 +8,19 @@ if [ "$PERCENTAGE" = "" ]; then
fi
case "${PERCENTAGE}" in
9[0-9]|100) ICON=""
9[0-9] | 100)
ICON=""
;;
[6-8][0-9]) ICON=""
[6-8][0-9])
ICON=""
;;
[3-5][0-9]) ICON=""
[3-5][0-9])
ICON=""
;;
[1-2][0-9]) ICON=""
[1-2][0-9])
ICON=""
;;
*) ICON=""
*) ICON="" ;;
esac
if [[ "$CHARGING" != "" ]]; then

View file

@ -5,4 +5,3 @@
# https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting
sketchybar --set "$NAME" label="$(date '+%d日周%u %H:%M')"

View file

@ -2,7 +2,6 @@
music_info=$(curlie GET http://localhost:10767/api/v1/playback/now-playing | jq -r '"\(.info.name) - \(.info.artistName)"')
ICON=""
sketchybar --set $NAME label="$music_info" icon="$ICON"

View file

@ -7,13 +7,16 @@ if [ "$SENDER" = "volume_change" ]; then
VOLUME="$INFO"
case "$VOLUME" in
[6-9][0-9]|100) ICON="󰕾"
[6-9][0-9] | 100)
ICON="󰕾"
;;
[3-5][0-9]) ICON="󰖀"
[3-5][0-9])
ICON="󰖀"
;;
[1-9]|[1-2][0-9]) ICON="󰕿"
[1-9] | [1-2][0-9])
ICON="󰕿"
;;
*) ICON="󰖁"
*) ICON="󰖁" ;;
esac
sketchybar --set "$NAME" icon="$ICON" label="$VOLUME%"

View file

@ -42,9 +42,8 @@ sketchybar --default "${default[@]}"
# to indicate active and available mission control spaces.
SPACE_ICONS=("" "" "" "󰖟" "" "" "7" "8" "9" "10")
for i in "${!SPACE_ICONS[@]}"
do
sid="$(($i+1))"
for i in "${!SPACE_ICONS[@]}"; do
sid="$(($i + 1))"
space=(
space="$sid"
icon="${SPACE_ICONS[i]}"
@ -101,7 +100,6 @@ sketchybar --set music \
##### Force all scripts to run the first time (never do this in a script) #####
sketchybar --update
sketchybar --add event aerospace_workspace_change
for sid in $(aerospace list-workspaces --all); do

View file

@ -11,7 +11,7 @@ alias paste="pbpaste"
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/opt/homebrew/Caskroom/miniconda/base/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
__conda_setup="$('/opt/homebrew/Caskroom/miniconda/base/bin/conda' 'shell.zsh' 'hook' 2>/dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else

View file

@ -9,7 +9,6 @@ export IS_WSL=true
export ARCHFLAGS="-arch x86_64"
source $DOTFILES/platforms/wsl/winterop.zsh
### Misc ###
export PATH=/opt/bin:$PATH
@ -18,7 +17,7 @@ export PATH=/opt/bin:$PATH
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('$HOME/miniconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
__conda_setup="$('$HOME/miniconda3/bin/conda' 'shell.zsh' 'hook' 2>/dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else

View file

@ -27,7 +27,6 @@ alias ipy=ipython
alias g=lazygit
# lsd - modern ls
if command -v lsd >/dev/null 2>&1; then
alias ls='lsd'
@ -41,28 +40,26 @@ else
alias ll='ls -l'
fi
# Functions #
mkcd() {
mkdir -p $1 && cd $1
}
cdls(){
cdls() {
cd $1 && ls
}
tc(){
tc() {
touch $1 && code $1
}
tv(){
tv() {
touch $1 && nvim $1
}
mt(){
mt() {
mkdir -p $(dirname $1) && touch $1
}
mtv(){
mtv() {
mkdir -p $(dirname $1) && touch $1 && nvim $1
}
alias update="source $DOTFILES/scripts/update.zsh"
if command -v pacman >/dev/null 2>&1; then
@ -97,7 +94,6 @@ if command -v brew >/dev/null 2>&1; then
alias brewl="brew list"
fi
# `-s` suffix alias
# % readme.md -> glow readme.md
alias -s {md,markdown}=glow

View file

@ -12,7 +12,6 @@ SAVEHIST=10000
export LANG=zh_CN.UTF-8
export LC_ALL=zh_CN.UTF-8
# Manually manage plugins 手动管理插件
# Load zsh-syntax-highlighting before zsh-history-substring-search
# Reference: https://github.com/zsh-users/zsh-history-substring-search?tab=readme-ov-file#usage
@ -37,7 +36,6 @@ for plugin in "${plugins[@]}"; do
fi
done
# https://unix.stackexchange.com/questions/33994/
# Use `set -k` to mark leading `#` as a comment character
set -k

View file

@ -3,7 +3,6 @@
# Author: js0ny
# Sourced by user's zshrc 在用户的 zshrc 中被引用
# read key: `fish_key_reader`
# get current bindings: `bindkey`

View file

@ -3,8 +3,6 @@
# Author: js0ny
# Sourced by user's zshrc 在用户的 zshrc 中被引用
# Absolute navigation #
alias dotfiles="cd $DOTFILES && ls"
if [ "$IS_WSL" = true ]; then # IS_WSL is defined in $DOTFILES/platforms/wsl/zshrc
@ -28,19 +26,18 @@ if [ "$(uname)" = "Darwin" ]; then
alias gdrive="cd $HOME/Google Drive"
fi
if command -v zoxide >/dev/null 2>&1; then
eval "$(zoxide init zsh)"
# Relative navigation #
# Relative navigation #
alias ..="z .."
alias ...="z ../.."
alias ....="z ../../.."
alias .....="z ../../../.."
alias ......="z ../../../../.."
# Use `-` to jump to the previous directory
# Oh-My-Zsh defines a similar one
# Use `-` to jump to the previous directory
# Oh-My-Zsh defines a similar one
alias - "z -"
zls(){
zls() {
cd $1 && ls
}
else

View file

@ -3,6 +3,4 @@
# Author: js0ny
# Sourced by user's zshrc 在用户的 zshrc 中被引用
eval "$(starship init zsh)"

View file

@ -55,50 +55,50 @@ if [ "$(uname)" = "Linux" ]; then
fi
# Azure CLI
if command -v az > /dev/null; then
if command -v az >/dev/null; then
export AZURE_CONFIG_DIR="$XDG_DATA_HOME"/azure
fi
# Bun JS
# mv ~/.bun $XDG_DATA_HOME/bun
# ln -sf $XDG_DATA_HOME/bun/bin/bun ~/.local/bin/bun
if command -v bun > /dev/null; then
if command -v bun >/dev/null; then
export BUN_INSTALL="$XDG_DATA_HOME"/bun
export PATH="$BUN_INSTALL/bin:$PATH"
[ -s "$BUN_INSTALL/_bun" ] && source "$BUN_INSTALL/_bun"
fi
# Cargo
if command -v cargo > /dev/null; then
if command -v cargo >/dev/null; then
export CARGO_HOME="$XDG_DATA_HOME"/cargo
export PATH="$CARGO_HOME/bin:$PATH"
fi
# CGDB
if command -v cgdb > /dev/null; then
if command -v cgdb >/dev/null; then
export CGDB_DIR="$XDG_CONFIG_HOME"/cgdb
fi
# .NET
if command -v dotnet > /dev/null; then
if command -v dotnet >/dev/null; then
export DOTNET_CLI_HOME="$XDG_DATA_HOME"/dotnet
export PATH="$DOTNET_CLI_HOME/.dotnet/tools:$PATH"
fi
# Docker
if command -v docker > /dev/null; then
if command -v docker >/dev/null; then
export DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker
fi
# GnuPG
if command -v gpg > /dev/null; then
if command -v gpg >/dev/null; then
export GNUPGHOME="$XDG_DATA_HOME"/gnupg
fi
# Go
if command -v go > /dev/null; then
if command -v go >/dev/null; then
export GOPATH="$XDG_DATA_HOME"/go
export PATH="$GOPATH/bin:$PATH"
fi
# Julia
if command -v julia > /dev/null; then
if command -v julia >/dev/null; then
export JULIA_DEPOT_PATH="$XDG_DATA_HOME/julia:$JULIA_DEPOT_PATH"
fi
# Node.js
if command -v node > /dev/null; then
if command -v node >/dev/null; then
export NODE_REPL_HISTORY="$XDG_STATE_HOME"/node/repl_history
export TS_NODE_REPL_HISTORY="$XDG_STATE_HOME"/node/ts_node_repl_history
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc
@ -107,22 +107,22 @@ if command -v node > /dev/null; then
export NPM_CONFIG_TMP="$XDG_RUNTIME_DIR"/npm
fi
# Parallel
if command -v parallel > /dev/null; then
if command -v parallel >/dev/null; then
export PARALLEL_HOME="$XDG_CONFIG_HOME"/parallel
fi
# Python
# Works only with Python 3.13.0a3 and later
if command -v python3 > /dev/null; then
if command -v python3 >/dev/null; then
export PYTHON_HISTORY="$XDG_DATA_HOME"/python/history
fi
# GNU Screen
if command -v screen > /dev/null; then
if command -v screen >/dev/null; then
export SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc
export SCREENDIR="${XDG_RUNTIME_DIR}/screen"
fi
# Ruby Gem
# Ruby Gem
if command -v gem > /dev/null; then
if command -v gem >/dev/null; then
setopt nullglob
for dir in "$HOME/.local/share/gem/ruby/"*/bin; do
if [ -d "$dir" ]; then
@ -132,33 +132,33 @@ if command -v gem > /dev/null; then
unsetopt nullglob
fi
# Spacemacs
if command -v emacs > /dev/null; then
if command -v emacs >/dev/null; then
export SPACEMACSDIR="$XDG_CONFIG_HOME"/spacemacs
fi
# tldr
# Works only with C client (did not verify)
if command -v tldr > /dev/null; then
if command -v tldr >/dev/null; then
export TLDR_CACHE_DIR="$XDG_CACHE_HOME"/tldr
fi
# W3M
if command -v w3m > /dev/null; then
if command -v w3m >/dev/null; then
export W3M_DIR="$XDG_DATA_HOME"/w3m
fi
# Wakatime
if command -v wakatime > /dev/null; then
if command -v wakatime >/dev/null; then
export WAKATIME_HOME="$XDG_CONFIG_HOME/wakatime"
fi
# Wget
if command -v wget > /dev/null; then
if command -v wget >/dev/null; then
alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'
fi
# z
if command -v z > /dev/null; then
if command -v z >/dev/null; then
export _Z_DATA="$XDG_DATA_HOME/z"
fi
# zsh .zcompdump
# compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION"
# Vcpkg
if command -v vcpkg > /dev/null; then
if command -v vcpkg >/dev/null; then
export VCPKG_ROOT="$XDG_DATA_HOME"/vcpkg
fi

View file

@ -24,9 +24,9 @@ case "$(uname)" in
# macOS-specific configuration
source "$DOTFILES/platforms/mac/zshrc"
;;
# CYGWIN*|MINGW*|MSYS*)
# source "$DOTFILES/platform/wsl.zsh"
# ;;
# CYGWIN*|MINGW*|MSYS*)
# source "$DOTFILES/platform/wsl.zsh"
# ;;
esac
for file in $DOTFILES/tools/zsh/mod/*.zsh; do