diff --git a/bin/swap_mode.sh b/bin/swap_mode.sh index 2130c0c..31cf960 100755 --- a/bin/swap_mode.sh +++ b/bin/swap_mode.sh @@ -6,26 +6,37 @@ GHOSTTY_CONF="${HOME}/.config/ghostty/config" [ -f "$NVIM_CONF" ] || { echo "Missing $NVIM_CONF"; exit 1; } [ -f "$GHOSTTY_CONF" ] || { echo "Missing $GHOSTTY_CONF"; exit 1; } -# Toggle Ghostty theme between zenwritten-dark and zenwritten-light -sed -E -i '' \ - -e 's/^([[:space:]]*theme[[:space:]]*=[[:space:]]*)zenwritten-dark/\1zenwritten-light/' \ - -e 't' \ - -e 's/^([[:space:]]*theme[[:space:]]*=[[:space:]]*)zenwritten-light/\1zenwritten-dark/' \ - "$GHOSTTY_CONF" - -# Toggle Neovim vim.g.light_mode true/false -sed -E -i '' \ - -e 's/(vim\.g\.light_mode[[:space:]]*=[[:space:]]*)true/\1false/' \ - -e 't' \ - -e 's/(vim\.g\.light_mode[[:space:]]*=[[:space:]]*)false/\1true/' \ - "$NVIM_CONF" - -# Determine new mode from Ghostty theme -if grep -Eq '^\s*theme\s*=\s*zenwritten-light' "$GHOSTTY_CONF"; then +set_light_mode() { + sed -E -i '' 's/^([[:space:]]*theme[[:space:]]*=[[:space:]]*)zenwritten-dark/\1zenwritten-light/' "$GHOSTTY_CONF" + sed -E -i '' 's/(vim.g.light_mode[[:space:]]*=[[:space:]]*).*/\1true/' "$NVIM_CONF" MODE="light" -else +} + +set_dark_mode() { + sed -E -i '' 's/^([[:space:]]*theme[[:space:]]*=[[:space:]]*)zenwritten-light/\1zenwritten-dark/' "$GHOSTTY_CONF" + sed -E -i '' 's/(vim.g.light_mode[[:space:]]*=[[:space:]]*).*/\1false/' "$NVIM_CONF" MODE="dark" -fi +} + +toggle_mode() { + if grep -Eq '^\s*theme\s*=\s*zenwritten-light' "$GHOSTTY_CONF"; then + set_dark_mode + else + set_light_mode + fi +} + +case "$1" in + light) + set_light_mode + ;; + dark) + set_dark_mode + ;; + toggle|*) + toggle_mode + ;; +esac # Reload neovim theme if [ "$MODE" = "light" ]; then @@ -36,24 +47,13 @@ fi for dir in "${XDG_RUNTIME_DIR:-}" "${TMPDIR:-/tmp}" "/tmp" "$HOME/.local/state/nvim"; do [ -d "$dir" ] || continue find "$dir" -type s -name 'nvim*' 2>/dev/null | while read -r sock; do - if command -v timeout >/dev/null 2>&1; then - timeout 1s nvim --server "$sock" --remote-send "$keys" >/dev/null 2>&1 || true - else - ( nvim --server "$sock" --remote-send "$keys" >/dev/null 2>&1 & ) - fi + timeout 1s nvim --server "$sock" --remote-send "$keys" >/dev/null 2>&1 || true done done # Reload Ghostty: send SIGUSR2 to running ghostty processes (macOS/Linux) -if command -v pkill >/dev/null 2>&1; then - pkill -USR2 -x ghostty 2>/dev/null || true -elif command -v killall >/dev/null 2>&1; then - killall -USR2 ghostty 2>/dev/null || true -else - pids=$(pgrep -x ghostty 2>/dev/null || true) - [ -n "${pids:-}" ] && kill -USR2 $pids || true -fi +pkill -USR2 -x ghostty 2>/dev/null echo "Switched to ${MODE} mode" diff --git a/deploy.sh b/deploy.sh index aae4b4f..72b9b88 100755 --- a/deploy.sh +++ b/deploy.sh @@ -33,7 +33,7 @@ deploy_links() { if [ -L "$dest_link" ]; then echo "Replacing existing symlink: $dest_link" rm "$dest_link" - # If it's a directory or file, back it up. + # If it's a directory or file, back it up. else echo "Backing up existing entry: $dest_link -> ${dest_link}.bak" mv "$dest_link" "${dest_link}.bak" @@ -45,7 +45,7 @@ deploy_links() { # Create the new symlink. echo "Linking: $dest_link -> $abs_src_path" - ln -s "$abs_src_path" "$dest_link" + ln -s "$abs_src_path" "$dest_link" done echo "Done." echo @@ -57,5 +57,6 @@ deploy_links "$PROJECT_ROOT/bin" "$HOME/bin" "bin" deploy_links "$PROJECT_ROOT/home" "$HOME" "home" deploy_links "$PROJECT_ROOT/config" "$HOME/.config" "config" deploy_links "$PROJECT_ROOT/wallpapers" "$HOME/media/wallpapers" "wallpapers" +deploy_links "$PROJECT_ROOT/gemini" "$HOME/.gemini" "gemini" echo "All deployments complete!" diff --git a/gemini/GEMINI.md b/gemini/GEMINI.md new file mode 100644 index 0000000..eaebfeb --- /dev/null +++ b/gemini/GEMINI.md @@ -0,0 +1,32 @@ +# Gemini Global Configuration + +This document outlines my general preferences for working with Gemini. + +## General Principles + +- **Programming Style**: Please use a functional programming style whenever possible and appropriate for the language. +- **Immutability**: Favor immutable data structures and variables where practical. +- **Verification**: Do not run tests or build commands. I will handle verification myself. +- **Dependencies**: If a new third-party library is needed, propose it and wait for my explicit approval before adding it to the project. +- **Documentation**: Use descriptive function and variable names to make code self-documenting. Doc comments should generally only be used for functions that are part of a public or library API. +- **Handling Ambiguity**: If a request is unclear or could be interpreted in multiple ways, always stop and ask for clarification. +- **Logging**: Unless instructed otherwise, add descriptive logging statements for errors. For logical flows, add messages like "Starting {logic}" and "Successfully completed {logic}". +- **API Design**: While not a primary task, prefer `snake_case` for JSON field names. Above all, always remain consistent with the conventions of the current project. + + +## Language-Specific Guidelines + +### Formatting +- **Java**: Adhere to the Google Java Style Guide. +- **C++**: Use the default formatting provided by `clangd`. +- **Python**: Format code using the `black` code formatter. +- **Rust**: Format code using the default `rust-fmt` configuration. + +### Error Handling +- **Rust**: Always return a `Result` type instead of panicking. +- **Java & Python**: Throw exceptions for error conditions. +- **C++**: Use a "Look Before You Leap" (LBYL) approach, checking preconditions to avoid errors. + +### Functional Programming +- **Java**: Prioritize the use of functional features like the Stream API. +- **C++**: Prioritize the use of modern C++ features that support a functional style, such as lambdas and ranges. diff --git a/home/.profile b/home/.profile new file mode 100644 index 0000000..f0b0284 --- /dev/null +++ b/home/.profile @@ -0,0 +1,6 @@ +. "$HOME/.cargo/env" + +[ -f "/home/aselimov/.ghcup/env" ] && . "/home/aselimov/.ghcup/env" # ghcup-env + +export PATH="$PATH:/usr/local/cuda-12.8/bin:$HOME/bin" +export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda-12.8/lib64" diff --git a/home/.xprofile b/home/.xprofile new file mode 100755 index 0000000..f0b0284 --- /dev/null +++ b/home/.xprofile @@ -0,0 +1,6 @@ +. "$HOME/.cargo/env" + +[ -f "/home/aselimov/.ghcup/env" ] && . "/home/aselimov/.ghcup/env" # ghcup-env + +export PATH="$PATH:/usr/local/cuda-12.8/bin:$HOME/bin" +export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda-12.8/lib64" diff --git a/home/.zshrc b/home/.zshrc index d7e36d3..0051c18 100644 --- a/home/.zshrc +++ b/home/.zshrc @@ -24,9 +24,22 @@ export XKB_DEFAULT_OPTIONS="caps:escape" export PASSWORD_STORE_CHARACTER_SET='a-zA-Z0-9+\-$!*_=' export XDEB_PKGROOT=${HOME}/.config/xdeb -# Add cuda to path -#export PATH="$PATH:/usr/local/cuda-12.8/bin" -export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/cuda-12.8/lib64" +#============================================================================== +# OS-Specific Configuration +#============================================================================== + +if [ "$(uname)" = "Darwin" ]; then + export PATH="$PATH:/opt/homebrew/bin" + alias ls="gls --classify --group-directories-first --color" + alias gemini="(source ~/.gemini_project && gemini)" + export NVIM_JDTLS_JAVA_HOME="/Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home/" + # I only start tmux by default on Mac because of dwm+swallow patch + if [[ -z "$TMUX" ]] && [[ -n "$PS1" ]]; then + tmux attach -t dev || tmux new -s dev + fi +else + alias ls="ls --classify --group-directories-first --color" +fi #============================================================================== # Aliases @@ -40,7 +53,7 @@ alias clip2png="xclip -selection clipboard -target image/png -out" load_env() { set -a - . "$1" + . "./$1" set +a } @@ -93,12 +106,18 @@ npm() { [ -f "/home/aselimov/.ghcup/env" ] && . "/home/aselimov/.ghcup/env" # ghcup-env # pyenv -if [ $(which pyenv 2>&1 1>/dev/null) ]; then +if command -v pyenv >/dev/null 2>&1; then export PYENV_ROOT="$HOME/.pyenv" [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init - zsh)" fi +# jenv +if command -v jenv >/dev/null 2>&1; then + export PATH="$HOME/.jenv/bin:$PATH" + eval "$(jenv init -)" +fi + # starship eval "$(starship init zsh)" diff --git a/wallpapers/real-pics/10-11.jpg b/wallpapers/real-pics/10-11.jpg new file mode 100644 index 0000000..b3dabb6 Binary files /dev/null and b/wallpapers/real-pics/10-11.jpg differ diff --git a/wallpapers/real-pics/wp9453682-4k-el-capitan-wallpapers.jpg b/wallpapers/real-pics/wp9453682-4k-el-capitan-wallpapers.jpg new file mode 100644 index 0000000..d072d82 Binary files /dev/null and b/wallpapers/real-pics/wp9453682-4k-el-capitan-wallpapers.jpg differ