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,10 +4,9 @@
|
|||
# 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"
|
||||
alias clip="wl-copy"
|
||||
alias paste="wl-paste"
|
||||
elif [ -n "$DISPLAY" ]; then
|
||||
alias clip="xclip"
|
||||
alias clip="xclip"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
# chmod +x ~/.config/sketchybar/plugins/aerospace.sh
|
||||
|
||||
if [ "$1" = "$FOCUSED_WORKSPACE" ]; then
|
||||
sketchybar --set $NAME background.drawing=on
|
||||
sketchybar --set $NAME background.drawing=on
|
||||
else
|
||||
sketchybar --set $NAME background.drawing=off
|
||||
sketchybar --set $NAME background.drawing=off
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -8,15 +8,19 @@ if [ "$PERCENTAGE" = "" ]; then
|
|||
fi
|
||||
|
||||
case "${PERCENTAGE}" in
|
||||
9[0-9]|100) ICON=""
|
||||
;;
|
||||
[6-8][0-9]) ICON=""
|
||||
;;
|
||||
[3-5][0-9]) ICON=""
|
||||
;;
|
||||
[1-2][0-9]) ICON=""
|
||||
;;
|
||||
*) ICON=""
|
||||
9[0-9] | 100)
|
||||
ICON=""
|
||||
;;
|
||||
[6-8][0-9])
|
||||
ICON=""
|
||||
;;
|
||||
[3-5][0-9])
|
||||
ICON=""
|
||||
;;
|
||||
[1-2][0-9])
|
||||
ICON=""
|
||||
;;
|
||||
*) ICON="" ;;
|
||||
esac
|
||||
|
||||
if [[ "$CHARGING" != "" ]]; then
|
||||
|
|
|
|||
|
|
@ -5,4 +5,3 @@
|
|||
# https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting
|
||||
|
||||
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)"')
|
||||
|
||||
|
||||
ICON=""
|
||||
|
||||
sketchybar --set $NAME label="$music_info" icon="$ICON"
|
||||
|
|
|
|||
|
|
@ -7,13 +7,16 @@ if [ "$SENDER" = "volume_change" ]; then
|
|||
VOLUME="$INFO"
|
||||
|
||||
case "$VOLUME" in
|
||||
[6-9][0-9]|100) ICON=""
|
||||
;;
|
||||
[3-5][0-9]) ICON=""
|
||||
;;
|
||||
[1-9]|[1-2][0-9]) ICON=""
|
||||
;;
|
||||
*) ICON=""
|
||||
[6-9][0-9] | 100)
|
||||
ICON=""
|
||||
;;
|
||||
[3-5][0-9])
|
||||
ICON=""
|
||||
;;
|
||||
[1-9] | [1-2][0-9])
|
||||
ICON=""
|
||||
;;
|
||||
*) ICON="" ;;
|
||||
esac
|
||||
|
||||
sketchybar --set "$NAME" icon="$ICON" label="$VOLUME%"
|
||||
|
|
|
|||
|
|
@ -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]}"
|
||||
|
|
@ -65,10 +64,10 @@ done
|
|||
# only the properties deviating from the current defaults need to be set
|
||||
|
||||
sketchybar --add item chevron left \
|
||||
--set chevron icon= label.drawing=off \
|
||||
--add item front_app left \
|
||||
--set front_app icon.drawing=off script="$PLUGIN_DIR/front_app.sh" \
|
||||
--subscribe front_app front_app_switched
|
||||
--set chevron icon= label.drawing=off \
|
||||
--add item front_app left \
|
||||
--set front_app icon.drawing=off script="$PLUGIN_DIR/front_app.sh" \
|
||||
--subscribe front_app front_app_switched
|
||||
|
||||
##### Adding Right Items #####
|
||||
# In the same way as the left items we can add items to the right side.
|
||||
|
|
@ -82,37 +81,36 @@ sketchybar --add item chevron left \
|
|||
# https://felixkratz.github.io/SketchyBar/config/events
|
||||
|
||||
sketchybar --add item clock center \
|
||||
--set clock update_freq=10 icon= script="$PLUGIN_DIR/clock.sh" \
|
||||
--add item volume right \
|
||||
--set volume script="$PLUGIN_DIR/volume.sh" \
|
||||
--subscribe volume volume_change \
|
||||
--add item battery right \
|
||||
--set battery update_freq=120 script="$PLUGIN_DIR/battery.sh" \
|
||||
--subscribe battery system_woke power_source_change \
|
||||
--add item apple_music right
|
||||
--set clock update_freq=10 icon= script="$PLUGIN_DIR/clock.sh" \
|
||||
--add item volume right \
|
||||
--set volume script="$PLUGIN_DIR/volume.sh" \
|
||||
--subscribe volume volume_change \
|
||||
--add item battery right \
|
||||
--set battery update_freq=120 script="$PLUGIN_DIR/battery.sh" \
|
||||
--subscribe battery system_woke power_source_change \
|
||||
--add item apple_music right
|
||||
|
||||
sketchybar --add item music right
|
||||
sketchybar --set music \
|
||||
script="$PLUGIN_DIR/music.sh" \
|
||||
update_freq=5 \
|
||||
label.color=0xffd7ba7d \
|
||||
background.corner_radius=5
|
||||
script="$PLUGIN_DIR/music.sh" \
|
||||
update_freq=5 \
|
||||
label.color=0xffd7ba7d \
|
||||
background.corner_radius=5
|
||||
|
||||
##### 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
|
||||
sketchybar --add item space.$sid left \
|
||||
--subscribe space.$sid aerospace_workspace_change \
|
||||
--set space.$sid \
|
||||
background.color=0x44ffffff \
|
||||
background.corner_radius=5 \
|
||||
background.height=20 \
|
||||
background.drawing=off \
|
||||
label="$sid" \
|
||||
click_script="aerospace workspace $sid" \
|
||||
script="$CONFIG_DIR/plugins/aerospace.sh $sid"
|
||||
sketchybar --add item space.$sid left \
|
||||
--subscribe space.$sid aerospace_workspace_change \
|
||||
--set space.$sid \
|
||||
background.color=0x44ffffff \
|
||||
background.corner_radius=5 \
|
||||
background.height=20 \
|
||||
background.drawing=off \
|
||||
label="$sid" \
|
||||
click_script="aerospace workspace $sid" \
|
||||
script="$CONFIG_DIR/plugins/aerospace.sh $sid"
|
||||
done
|
||||
|
|
|
|||
|
|
@ -11,15 +11,15 @@ 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"
|
||||
eval "$__conda_setup"
|
||||
else
|
||||
if [ -f "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh" ]; then
|
||||
. "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh"
|
||||
else
|
||||
export PATH="/opt/homebrew/Caskroom/miniconda/base/bin:$PATH"
|
||||
fi
|
||||
if [ -f "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh" ]; then
|
||||
. "/opt/homebrew/Caskroom/miniconda/base/etc/profile.d/conda.sh"
|
||||
else
|
||||
export PATH="/opt/homebrew/Caskroom/miniconda/base/bin:$PATH"
|
||||
fi
|
||||
fi
|
||||
unset __conda_setup
|
||||
# <<< conda initialize <<<
|
||||
|
|
|
|||
|
|
@ -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,15 +17,15 @@ 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"
|
||||
eval "$__conda_setup"
|
||||
else
|
||||
if [ -f "$HOME/miniconda3/etc/profile.d/conda.sh" ]; then
|
||||
. "$HOME/miniconda3/etc/profile.d/conda.sh"
|
||||
else
|
||||
export PATH="$HOME/miniconda3/bin:$PATH"
|
||||
fi
|
||||
if [ -f "$HOME/miniconda3/etc/profile.d/conda.sh" ]; then
|
||||
. "$HOME/miniconda3/etc/profile.d/conda.sh"
|
||||
else
|
||||
export PATH="$HOME/miniconda3/bin:$PATH"
|
||||
fi
|
||||
fi
|
||||
unset __conda_setup
|
||||
# <<< conda initialize <<<
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue