mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
style: format shell scripts
This commit is contained in:
parent
8c5babe80a
commit
76b5fd4118
18 changed files with 231 additions and 242 deletions
|
|
@ -4,7 +4,6 @@
|
||||||
# Sourced by user's zshrc if is Linux 在用户的 zshrc 中被引用
|
# Sourced by user's zshrc if is Linux 在用户的 zshrc 中被引用
|
||||||
# Entry point in $DOTFILES/tools/zsh/common.zshrc (入口点)
|
# Entry point in $DOTFILES/tools/zsh/common.zshrc (入口点)
|
||||||
|
|
||||||
|
|
||||||
if [ -n "$WAYLAND_DISPLAY" ]; then
|
if [ -n "$WAYLAND_DISPLAY" ]; then
|
||||||
alias clip="wl-copy"
|
alias clip="wl-copy"
|
||||||
alias paste="wl-paste"
|
alias paste="wl-paste"
|
||||||
|
|
|
||||||
|
|
@ -8,15 +8,19 @@ if [ "$PERCENTAGE" = "" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "${PERCENTAGE}" in
|
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
|
esac
|
||||||
|
|
||||||
if [[ "$CHARGING" != "" ]]; then
|
if [[ "$CHARGING" != "" ]]; then
|
||||||
|
|
|
||||||
|
|
@ -5,4 +5,3 @@
|
||||||
# https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting
|
# https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting
|
||||||
|
|
||||||
sketchybar --set "$NAME" label="$(date '+%d日周%u %H:%M')"
|
sketchybar --set "$NAME" label="$(date '+%d日周%u %H:%M')"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
music_info=$(curlie GET http://localhost:10767/api/v1/playback/now-playing | jq -r '"\(.info.name) - \(.info.artistName)"')
|
music_info=$(curlie GET http://localhost:10767/api/v1/playback/now-playing | jq -r '"\(.info.name) - \(.info.artistName)"')
|
||||||
|
|
||||||
|
|
||||||
ICON=""
|
ICON=""
|
||||||
|
|
||||||
sketchybar --set $NAME label="$music_info" icon="$ICON"
|
sketchybar --set $NAME label="$music_info" icon="$ICON"
|
||||||
|
|
|
||||||
|
|
@ -7,13 +7,16 @@ if [ "$SENDER" = "volume_change" ]; then
|
||||||
VOLUME="$INFO"
|
VOLUME="$INFO"
|
||||||
|
|
||||||
case "$VOLUME" in
|
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
|
esac
|
||||||
|
|
||||||
sketchybar --set "$NAME" icon="$ICON" label="$VOLUME%"
|
sketchybar --set "$NAME" icon="$ICON" label="$VOLUME%"
|
||||||
|
|
|
||||||
|
|
@ -42,8 +42,7 @@ sketchybar --default "${default[@]}"
|
||||||
# to indicate active and available mission control spaces.
|
# to indicate active and available mission control spaces.
|
||||||
|
|
||||||
SPACE_ICONS=("" "" "" "" "" "" "7" "8" "9" "10")
|
SPACE_ICONS=("" "" "" "" "" "" "7" "8" "9" "10")
|
||||||
for i in "${!SPACE_ICONS[@]}"
|
for i in "${!SPACE_ICONS[@]}"; do
|
||||||
do
|
|
||||||
sid="$(($i + 1))"
|
sid="$(($i + 1))"
|
||||||
space=(
|
space=(
|
||||||
space="$sid"
|
space="$sid"
|
||||||
|
|
@ -101,7 +100,6 @@ sketchybar --set music \
|
||||||
##### Force all scripts to run the first time (never do this in a script) #####
|
##### Force all scripts to run the first time (never do this in a script) #####
|
||||||
sketchybar --update
|
sketchybar --update
|
||||||
|
|
||||||
|
|
||||||
sketchybar --add event aerospace_workspace_change
|
sketchybar --add event aerospace_workspace_change
|
||||||
|
|
||||||
for sid in $(aerospace list-workspaces --all); do
|
for sid in $(aerospace list-workspaces --all); do
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@ export IS_WSL=true
|
||||||
export ARCHFLAGS="-arch x86_64"
|
export ARCHFLAGS="-arch x86_64"
|
||||||
source $DOTFILES/platforms/wsl/winterop.zsh
|
source $DOTFILES/platforms/wsl/winterop.zsh
|
||||||
|
|
||||||
|
|
||||||
### Misc ###
|
### Misc ###
|
||||||
|
|
||||||
export PATH=/opt/bin:$PATH
|
export PATH=/opt/bin:$PATH
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,6 @@ alias ipy=ipython
|
||||||
|
|
||||||
alias g=lazygit
|
alias g=lazygit
|
||||||
|
|
||||||
|
|
||||||
# lsd - modern ls
|
# lsd - modern ls
|
||||||
if command -v lsd >/dev/null 2>&1; then
|
if command -v lsd >/dev/null 2>&1; then
|
||||||
alias ls='lsd'
|
alias ls='lsd'
|
||||||
|
|
@ -41,7 +40,6 @@ else
|
||||||
alias ll='ls -l'
|
alias ll='ls -l'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Functions #
|
# Functions #
|
||||||
mkcd() {
|
mkcd() {
|
||||||
mkdir -p $1 && cd $1
|
mkdir -p $1 && cd $1
|
||||||
|
|
@ -62,7 +60,6 @@ mtv(){
|
||||||
mkdir -p $(dirname $1) && touch $1 && nvim $1
|
mkdir -p $(dirname $1) && touch $1 && nvim $1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
alias update="source $DOTFILES/scripts/update.zsh"
|
alias update="source $DOTFILES/scripts/update.zsh"
|
||||||
|
|
||||||
if command -v pacman >/dev/null 2>&1; then
|
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"
|
alias brewl="brew list"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# `-s` suffix alias
|
# `-s` suffix alias
|
||||||
# % readme.md -> glow readme.md
|
# % readme.md -> glow readme.md
|
||||||
alias -s {md,markdown}=glow
|
alias -s {md,markdown}=glow
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ SAVEHIST=10000
|
||||||
export LANG=zh_CN.UTF-8
|
export LANG=zh_CN.UTF-8
|
||||||
export LC_ALL=zh_CN.UTF-8
|
export LC_ALL=zh_CN.UTF-8
|
||||||
|
|
||||||
|
|
||||||
# Manually manage plugins 手动管理插件
|
# Manually manage plugins 手动管理插件
|
||||||
# Load zsh-syntax-highlighting before zsh-history-substring-search
|
# Load zsh-syntax-highlighting before zsh-history-substring-search
|
||||||
# Reference: https://github.com/zsh-users/zsh-history-substring-search?tab=readme-ov-file#usage
|
# 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
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
# https://unix.stackexchange.com/questions/33994/
|
# https://unix.stackexchange.com/questions/33994/
|
||||||
# Use `set -k` to mark leading `#` as a comment character
|
# Use `set -k` to mark leading `#` as a comment character
|
||||||
set -k
|
set -k
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
# Author: js0ny
|
# Author: js0ny
|
||||||
# Sourced by user's zshrc 在用户的 zshrc 中被引用
|
# Sourced by user's zshrc 在用户的 zshrc 中被引用
|
||||||
|
|
||||||
|
|
||||||
# read key: `fish_key_reader`
|
# read key: `fish_key_reader`
|
||||||
# get current bindings: `bindkey`
|
# get current bindings: `bindkey`
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@
|
||||||
# Author: js0ny
|
# Author: js0ny
|
||||||
# Sourced by user's zshrc 在用户的 zshrc 中被引用
|
# Sourced by user's zshrc 在用户的 zshrc 中被引用
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Absolute navigation #
|
# Absolute navigation #
|
||||||
alias dotfiles="cd $DOTFILES && ls"
|
alias dotfiles="cd $DOTFILES && ls"
|
||||||
if [ "$IS_WSL" = true ]; then # IS_WSL is defined in $DOTFILES/platforms/wsl/zshrc
|
if [ "$IS_WSL" = true ]; then # IS_WSL is defined in $DOTFILES/platforms/wsl/zshrc
|
||||||
|
|
@ -28,7 +26,6 @@ if [ "$(uname)" = "Darwin" ]; then
|
||||||
alias gdrive="cd $HOME/Google Drive"
|
alias gdrive="cd $HOME/Google Drive"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if command -v zoxide >/dev/null 2>&1; then
|
if command -v zoxide >/dev/null 2>&1; then
|
||||||
eval "$(zoxide init zsh)"
|
eval "$(zoxide init zsh)"
|
||||||
# Relative navigation #
|
# Relative navigation #
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,4 @@
|
||||||
# Author: js0ny
|
# Author: js0ny
|
||||||
# Sourced by user's zshrc 在用户的 zshrc 中被引用
|
# Sourced by user's zshrc 在用户的 zshrc 中被引用
|
||||||
|
|
||||||
|
|
||||||
eval "$(starship init zsh)"
|
eval "$(starship init zsh)"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue