diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..008de29 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +# $DOTFILES/.gitattributes +# Date: 2024-11-30 +# Author: contact@js0ny.net +skhdrc linguist-language=Shell diff --git a/.vscode/dotfiles.code-snippets b/.vscode/dotfiles.code-snippets new file mode 100644 index 0000000..5a49f9e --- /dev/null +++ b/.vscode/dotfiles.code-snippets @@ -0,0 +1,29 @@ +{ + // Place your .dotfiles 工作区 snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and + // description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope + // is left empty or omitted, the snippet gets applied to all languages. The prefix is what is + // used to trigger the snippet and the body will be expanded and inserted. Possible variables are: + // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. + // Placeholders with the same ids are connected. + // Example: + // "Print to console": { + // "scope": "javascript,typescript", + // "prefix": "log", + // "body": [ + // "console.log('$1');", + // "$2" + // ], + // "description": "Log output to console" + // } + "Dotfiles": { + "scope": "", + "prefix": "init", + "body": [ + "$LINE_COMMENT \\$DOTFILES/$RELATIVE_FILEPATH", + "$LINE_COMMENT Date: $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE", + "$LINE_COMMENT Author: contact@js0ny.net", + "$LINE_COMMENT $0", + ] + + } +} diff --git a/.vscode/settings.json b/.vscode/settings.json index a249144..abc78ff 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -13,6 +13,7 @@ "nvim/init.lua": "vim", "markdownlint.json": "markdownlint", ".wslconfig": "settings", + "skhdrc": "console" }, "material-icon-theme.folders.associations": { "bootstrap": "admin", diff --git a/bootstrap/set_symblink_unix.bash b/bootstrap/set_symblink_unix.bash index eef5d91..0b056ac 100644 --- a/bootstrap/set_symblink_unix.bash +++ b/bootstrap/set_symblink_unix.bash @@ -22,3 +22,11 @@ ln -sf $DOTFILES/common/zellij.config.kdl ~/.config/zellij/config.kdl # $DOTFILES/tools ln -sf $DOTFILES/tools/ipython $XDG_CONFIG_HOME/ipython ln -sf $DOTFILES/tools/nvim $XDG_CONFIG_HOME/nvim + +if [ $(uname) = "Darwin"]; then + mkdir -p ~/.config/karabiner $XDG_CONFIG_HOME/skhd $XDG_CONFIG_HOME/yabai $XDG_CONFIG_HOME/sketchybar + ln -sf $DOTFILES/platforms/mac/karabiner/karabiner.json ~/.config/karabiner/karabiner.json + ln -sf $DOTFILES/platforms/mac/skhdrc $XDG_CONFIG_HOME/skhd/skhdrc + ln -sf $DOTFILES/platforms/mac/sketchybarrc $XDG_CONFIG_HOME/sketchybar/sketchybarrc + ln -sf $DOTFILES/platforms/mac/yabairc $XDG_CONFIG_HOME/yabai/yabairc +fi diff --git a/platforms/mac/sketchybarrc b/platforms/mac/sketchybarrc new file mode 100755 index 0000000..bc8b5a6 --- /dev/null +++ b/platforms/mac/sketchybarrc @@ -0,0 +1,95 @@ +# $DOTFILES/platforms/mac/sketchybarrc +# Date: 2024-11-30 +# Author: contact@js0ny.net +# 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. +# For a (much) more advanced configuration example see my dotfiles: +# https://github.com/FelixKratz/dotfiles + +PLUGIN_DIR="$CONFIG_DIR/plugins" + +##### Bar Appearance ##### +# Configuring the general appearance of the bar. +# These are only some of the options available. For all options see: +# https://felixkratz.github.io/SketchyBar/config/bar +# If you are looking for other colors, see the color picker: +# https://felixkratz.github.io/SketchyBar/config/tricks#color-picker + +sketchybar --bar position=top height=40 blur_radius=30 color=0x40000000 + +##### Changing Defaults ##### +# We now change some default values, which are applied to all further items. +# For a full list of all available item properties see: +# https://felixkratz.github.io/SketchyBar/config/items + +default=( + padding_left=5 + padding_right=5 + icon.font="CaskaydiaCove Nerd Font:Bold:17.0" + label.font="CaskaydiaCove Nerd Font:Bold:14.0" + icon.color=0xffffffff + label.color=0xffffffff + icon.padding_left=4 + icon.padding_right=4 + label.padding_left=4 + label.padding_right=4 +) +sketchybar --default "${default[@]}" + +##### Adding Mission Control Space Indicators ##### +# Let's add some mission control spaces: +# 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") +for i in "${!SPACE_ICONS[@]}" +do + sid="$(($i+1))" + space=( + space="$sid" + icon="${SPACE_ICONS[i]}" + icon.padding_left=7 + icon.padding_right=7 + background.color=0x40ffffff + background.corner_radius=5 + background.height=25 + label.drawing=off + script="$PLUGIN_DIR/space.sh" + click_script="yabai -m space --focus $sid" + ) + sketchybar --add space space."$sid" left --set space."$sid" "${space[@]}" +done + +##### Adding Left Items ##### +# We add some regular items to the left side of the bar, where +# 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 + +##### Adding Right Items ##### +# In the same way as the left items we can add items to the right side. +# Additional position (e.g. center) are available, see: +# https://felixkratz.github.io/SketchyBar/config/items#adding-items-to-sketchybar + +# Some items refresh on a fixed cycle, e.g. the clock runs its script once +# every 10s. Other items respond to events they subscribe to, e.g. the +# volume.sh script is only executed once an actual change in system audio +# volume is registered. More info about the event system can be found here: +# https://felixkratz.github.io/SketchyBar/config/events + +sketchybar --add item clock 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 + +##### Force all scripts to run the first time (never do this in a script) ##### +sketchybar --update diff --git a/platforms/mac/skhdrc b/platforms/mac/skhdrc new file mode 100644 index 0000000..48e0bc8 --- /dev/null +++ b/platforms/mac/skhdrc @@ -0,0 +1,35 @@ +# $DOTFILES/platforms/mac/skhdrc +# Date: 2024-11-30 +# Author: contact@js0ny.net + +# 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 + +# 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 diff --git a/platforms/mac/yabairc b/platforms/mac/yabairc new file mode 100644 index 0000000..d3fa357 --- /dev/null +++ b/platforms/mac/yabairc @@ -0,0 +1,51 @@ +#!/usr/bin/env sh +# $DOTFILES/platforms/mac/yabairc +# Date: 2024-11-30 +# Author: contact@js0ny.net +# TODO: Reorganize this file + +# +# for this to work you must configure sudo such that +# it will be able to run the command without password +# +# see this wiki page for information: +# - https://github.com/koekeishiya/yabai/wiki/Installing-yabai-(latest-release)#configure-scripting-addition +# +# yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa" +# sudo yabai --load-sa +# + +# global settings +yabai -m config \ + top_padding 40 \ + external_bar off:40:0 \ + menubar_opacity 1.0 \ + mouse_follows_focus off \ + focus_follows_mouse off \ + display_arrangement_order default \ + window_origin_display default \ + window_placement second_child \ + window_zoom_persist on \ + window_shadow on \ + window_animation_duration 0.0 \ + window_animation_easing ease_out_circ \ + window_opacity_duration 0.0 \ + active_window_opacity 1.0 \ + normal_window_opacity 0.90 \ + window_opacity off \ + insert_feedback_color 0xffd75f5f \ + split_ratio 0.50 \ + split_type auto \ + auto_balance off \ + top_padding 12 \ + bottom_padding 12 \ + left_padding 12 \ + right_padding 12 \ + window_gap 06 \ + layout bsp \ + mouse_modifier fn \ + mouse_action1 move \ + mouse_action2 resize \ + mouse_drop_action swap + +echo "yabai configuration loaded.." diff --git a/platforms/mac/zshrc b/platforms/mac/zshrc index ee504ee..cf41274 100644 --- a/platforms/mac/zshrc +++ b/platforms/mac/zshrc @@ -1,4 +1,6 @@ # $DOTFILES/platforms/mac/zshrc +# Date: 2024-11-30 +# Author: contact@js0ny.net # Sourced by user's zshrc if is macOS 在用户的 zshrc 中被引用,macOS 特定配置 # Entry point in $DOTFILES/tools/zsh/common.zshrc (入口点) diff --git a/tools/zsh/common.zshrc b/tools/zsh/common.zshrc index 3a46294..8cac855 100644 --- a/tools/zsh/common.zshrc +++ b/tools/zsh/common.zshrc @@ -1,4 +1,6 @@ -# $DOTFILES/zsh/common.zshrc +# $DOTFILES/tools/zsh/common.zshrc +# Date: 2024-11-30 +# Author: contact@js0ny.net # This is the entry point for all zsh configuration files # 这是所有zsh配置文件的入口点 diff --git a/tools/zsh/global.zshenv b/tools/zsh/global.zshenv index 32f2829..a9c1a49 100644 --- a/tools/zsh/global.zshenv +++ b/tools/zsh/global.zshenv @@ -1,4 +1,7 @@ # $DOTFILES/tools/zsh/global.zshenv +# Date: 2024-11-30 +# Author: contact@js0ny.net +# $DOTFILES/tools/zsh/global.zshenv # system-wide zshenv file 系统级别的 zshenv 文件,用于设置全局环境变量 # Location: diff --git a/tools/zsh/mod/alias.zsh b/tools/zsh/mod/alias.zsh index 1e55316..f9c51cd 100644 --- a/tools/zsh/mod/alias.zsh +++ b/tools/zsh/mod/alias.zsh @@ -1,4 +1,6 @@ # $DOTFILES/tools/zsh/mod/alias.zsh +# Date: 2024-11-30 +# Author: contact@js0ny.net # Sourced by user's zshrc 在用户的 zshrc 中被引用 # PowerShell Equivalent, for cross-platform compatibility @@ -29,10 +31,10 @@ alias sn="sudo nvim" # lsd - modern ls if command -v lsd > /dev/null; then - alias ls='lsd -A' + alias ls='lsd -A -I .DS_Store -I .git' alias l='lsd -lah' alias ll='lsd -l' - alias tree='lsd --tree' + alias tree='lsd --tree -I .DS_Store -I .git' fi # Functions # diff --git a/tools/zsh/mod/config.zsh b/tools/zsh/mod/config.zsh index eab28a6..20ec160 100644 --- a/tools/zsh/mod/config.zsh +++ b/tools/zsh/mod/config.zsh @@ -1,4 +1,6 @@ # $DOTFILES/tools/zsh/mod/config.zsh +# Date: 2024-11-30 +# Author: contact@js0ny.net # Sourced by user's zshrc 在用户的 zshrc 中被引用 # ZSH Config, no need to `export` these variables diff --git a/tools/zsh/mod/env.zsh b/tools/zsh/mod/env.zsh index bf0ef34..73beddd 100644 --- a/tools/zsh/mod/env.zsh +++ b/tools/zsh/mod/env.zsh @@ -1,4 +1,6 @@ # $DOTFILES/tools/zsh/mod/env.zsh +# Date: 2024-11-30 +# Author: contact@js0ny.net # Sourced by user's zshrc 在用户的 zshrc 中被引用 # This file stores only environment variables that only called by diff --git a/tools/zsh/mod/keymap.zsh b/tools/zsh/mod/keymap.zsh index 2242057..eac5169 100644 --- a/tools/zsh/mod/keymap.zsh +++ b/tools/zsh/mod/keymap.zsh @@ -1,4 +1,6 @@ # $DOTFILES/tools/zsh/mod/keymap.zsh +# Date: 2024-11-30 +# Author: contact@js0ny.net # Sourced by user's zshrc 在用户的 zshrc 中被引用 diff --git a/tools/zsh/mod/navi.zsh b/tools/zsh/mod/navi.zsh index 3793178..361d762 100644 --- a/tools/zsh/mod/navi.zsh +++ b/tools/zsh/mod/navi.zsh @@ -1,4 +1,6 @@ # $DOTFILES/tools/zsh/mod/navi.zsh +# Date: 2024-11-30 +# Author: contact@js0ny.net # Sourced by user's zshrc 在用户的 zshrc 中被引用 # Relative navigation # diff --git a/tools/zsh/mod/prompt.zsh b/tools/zsh/mod/prompt.zsh index be24212..01be5dc 100644 --- a/tools/zsh/mod/prompt.zsh +++ b/tools/zsh/mod/prompt.zsh @@ -1,4 +1,6 @@ # $DOTFILES/tools/zsh/mod/prompt.zsh +# Date: 2024-11-30 +# Author: contact@js0ny.net # Sourced by user's zshrc 在用户的 zshrc 中被引用 export STARSHIP_CONFIG=$DOTFILES/tools/starship/starship_zsh.toml diff --git a/tools/zsh/zshenv b/tools/zsh/zshenv index 585adf5..d390a44 100644 --- a/tools/zsh/zshenv +++ b/tools/zsh/zshenv @@ -1,4 +1,6 @@ # $DOTFILES/tools/zsh/zshenv +# Date: 2024-11-30 +# Author: contact@js0ny.net # User-specific environment variables for zsh 用户级别的 zsh 环境变量 # Location: