Merge branch 'master' of github.com:js0ny/dotfiles

This commit is contained in:
js0ny 2024-12-05 20:09:01 +00:00
commit 2fa5801448
39 changed files with 1025 additions and 379 deletions

View file

@ -0,0 +1,11 @@
// ~/Library/Keybindings/DefaultKeyBinding.dict
{
// Colemak Vim Style Arrows
"^h" = "moveBackward:";
"^n" = "moveDown:";
"^e" = "moveUp:";
"^i" = "moveForward:";
// Colemak Vim Style Home/End, Insert & Append
"^l" = "moveToBeginningOfLine:";
"^a" = "moveToEndOfLine:";
}

View file

@ -0,0 +1,28 @@
#!/bin/sh
PERCENTAGE="$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1)"
CHARGING="$(pmset -g batt | grep 'AC Power')"
if [ "$PERCENTAGE" = "" ]; then
exit 0
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=""
esac
if [[ "$CHARGING" != "" ]]; then
ICON=""
fi
# The item invoking this script (name $NAME) will get its icon and label
# updated with the current battery status
sketchybar --set "$NAME" icon="$ICON" label="${PERCENTAGE}%"

View file

@ -0,0 +1,8 @@
#!/bin/sh
# The $NAME variable is passed from sketchybar and holds the name of
# the item invoking this script:
# https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting
sketchybar --set "$NAME" label="$(date '+%d日周%u %H:%M')"

View file

@ -0,0 +1,10 @@
#!/bin/sh
# Some events send additional information specific to the event in the $INFO
# variable. E.g. the front_app_switched event sends the name of the newly
# focused application in the $INFO variable:
# https://felixkratz.github.io/SketchyBar/config/events#events-and-scripting
if [ "$SENDER" = "front_app_switched" ]; then
sketchybar --set "$NAME" label="$INFO"
fi

View file

@ -0,0 +1,8 @@
#!/bin/bash
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

@ -0,0 +1,7 @@
#!/bin/sh
# The $SELECTED variable is available for space components and indicates if
# the space invoking this script (with name: $NAME) is currently selected:
# https://felixkratz.github.io/SketchyBar/config/components#space----associate-mission-control-spaces-with-an-item
sketchybar --set "$NAME" background.drawing="$SELECTED"

View file

@ -0,0 +1,20 @@
#!/bin/sh
# The volume_change event supplies a $INFO variable in which the current volume
# percentage is passed to the script.
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="󰖁"
esac
sketchybar --set "$NAME" icon="$ICON" label="$VOLUME%"
fi

View file

@ -1,6 +1,6 @@
# $DOTFILES/platforms/mac/sketchybarrc
# Date: 2024-11-30
# Author: contact@js0ny.net
# Author: js0ny
# TODO: Reorganize this file
# This is a demo config to showcase some of the most important commands.
# It is meant to be changed and configured, as it is intentionally kept sparse.
@ -41,7 +41,7 @@ sketchybar --default "${default[@]}"
# https://felixkratz.github.io/SketchyBar/config/components#space----associate-mission-control-spaces-with-an-item
# to indicate active and available mission control spaces.
SPACE_ICONS=("1" "2" "3" "4" "5" "6" "7" "8" "9" "10")
SPACE_ICONS=("" "" "" "󰖟" "" "" "7" "8" "9" "10")
for i in "${!SPACE_ICONS[@]}"
do
sid="$(($i+1))"
@ -89,7 +89,7 @@ sketchybar --add item clock center \
--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
--add item apple_music right
sketchybar --add item music right
sketchybar --set music \

View file

@ -1,36 +1,19 @@
# $DOTFILES/platforms/mac/skhdrc
# Date: 2024-11-30
# Author: contact@js0ny.net
# Author: js0ny
# Location: $XDG_CONFIG_HOME/skhd/skhdrc
# Linking:
# ln -sf $DOTFILES/platforms/mac/skhdrc $XDG_CONFIG_HOME/skhd/skhdrc
# Navigation
cmd - h : yabai -m window --focus west
cmd - n : yabai -m window --focus south
cmd - e : yabai -m window --focus north
cmd - i : yabai -m window --focus east
alt - h : yabai -m window --focus west
alt - n : yabai -m window --focus south
alt - e : yabai -m window --focus north
alt - i : yabai -m window --focus east
# Moving windows
shift + cmd - h : yabai -m window --warp west
shift + cmd - n : yabai -m window --warp south
shift + cmd - e : yabai -m window --warp north
shift + cmd - i : yabai -m window --warp east
shift + alt - h : \
yabai -m window --resize left:-20:0 ; \
yabai -m window --resize right:-20:0
shift + alt - n : \
yabai -m window --resize bottom:0:20 ; \
yabai -m window --resize top:0:20
shift + alt - e : \
yabai -m window --resize top:0:-20 ; \
yabai -m window --resize bottom:0:-20
shift + alt - i : \
yabai -m window --resize right:20:0 ; \
yabai -m window --resize left:20:0
shift + alt - h : yabai -m window --warp west
shift + alt - n : yabai -m window --warp south
shift + alt - e : yabai -m window --warp north
shift + alt - i : yabai -m window --warp east

View file

@ -1,7 +1,7 @@
#!/usr/bin/env sh
# $DOTFILES/platforms/mac/yabairc
# Date: 2024-11-30
# Author: contact@js0ny.net
# Author: js0ny
# TODO: Reorganize this file
#

View file

@ -1,6 +1,6 @@
# $DOTFILES/platforms/mac/zshrc
# Date: 2024-11-30
# Author: contact@js0ny.net
# Author: js0ny
# Sourced by user's zshrc if is macOS 在用户的 zshrc 中被引用macOS 特定配置
# Entry point in $DOTFILES/tools/zsh/common.zshrc (入口点)
@ -25,3 +25,4 @@ fi
unset __conda_setup
# <<< conda initialize <<<
alias start-twm="source $DOTFILES/scripts/__twm_osx_start.zsh"

View file

@ -1,6 +1,6 @@
# $DOTFILES/platforms\win\Microsoft.PowerShell_profile.ps1
# Date: 2024-12-01
# Author: contact@js0ny.net
# Author: js0ny
# PowerShell profile for Windows
### Load Configs ###

View file

@ -1,6 +1,6 @@
# $DOTFILES\platforms\win\wslconfig
# Date: 2024-12-01
# Author: contact@js0ny.net
# Author: js0ny
# Config Files (mainly for networking) for WSL2 (Windows Subsystem for Linux 2)
# 适用于 Windows 的 Linux 子系统 2 的配置文件(主要用于网络)

View file

@ -1,6 +1,6 @@
# $DOTFILES/platforms/wsl/zshrc
# Date: 2024-12-01
# Author: contact@js0ny.net
# Author: js0ny
# Sourced by user's zshrc if is WSL 在用户的 zshrc 中被引用WSL 特定配置
# Entry point in $DOTFILES/tools/zsh/common.zshrc (入口点)