diff --git a/fake_home/.bashrc b/fake_home/.bashrc index 7e755db..badb4f4 100644 --- a/fake_home/.bashrc +++ b/fake_home/.bashrc @@ -142,6 +142,6 @@ ex () source ~/.shell_aliases . "$HOME/.cargo/env" -export NVM_DIR="$HOME/.nvm" -[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm -[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion +# export NVM_DIR="$HOME/.nvm" +# [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm +# [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion diff --git a/fake_home/.local/share/Steam/steamapps/compatdata/2379780/pfx/drive_c/users/steamuser/AppData/Roaming/Balatro/Mods/EscapeExitButton.lua b/fake_home/.local/share/Steam/steamapps/compatdata/2379780/pfx/drive_c/users/steamuser/AppData/Roaming/Balatro/Mods/EscapeExitButton.lua deleted file mode 100644 index 558a695..0000000 --- a/fake_home/.local/share/Steam/steamapps/compatdata/2379780/pfx/drive_c/users/steamuser/AppData/Roaming/Balatro/Mods/EscapeExitButton.lua +++ /dev/null @@ -1,31 +0,0 @@ ---- STEAMODDED HEADER ---- MOD_NAME: Escape Exit Button ---- MOD_ID: EscapeExitButton ---- MOD_AUTHOR: [Steamo] ---- MOD_DESCRIPTION: Add an "Exit" button into the "Escape" menu - ----------------------------------------------- -------------MOD CODE ------------------------- - -function G.FUNCS.exit_button(arg_736_0) - G.SETTINGS.paused = true - - love.event.quit() -end - -local createOptionsRef = create_UIBox_options -function create_UIBox_options() - contents = createOptionsRef() - local exit_button = UIBox_button({ - minw = 5, - button = "exit_button", - label = { - "Exit Game" - } - }) - table.insert(contents.nodes[1].nodes[1].nodes[1].nodes, #contents.nodes[1].nodes[1].nodes[1].nodes + 1, exit_button) - return contents -end - ----------------------------------------------- -------------MOD CODE END---------------------- diff --git a/fake_home/.shell_aliases b/fake_home/.shell_aliases index 6c91894..9e532f4 100755 --- a/fake_home/.shell_aliases +++ b/fake_home/.shell_aliases @@ -219,7 +219,11 @@ function wf { if [[ "$@" != "" ]]; then local fzf_args="-q $@" fi - echo ~/wiki/"$(rg --with-filename --no-heading . ~/wiki | sed 's@/home/sage/wiki/@@' | fzf -i $fzf_args -1 --preview='bat ~/wiki/$(echo {} | sed "s/:.*//")' | sed 's/:.*//')" + local wiki_dir="$HOME/wiki/" + if [[ "$WIKI_DIR" != "" ]]; then + wiki_dir="$WIKI_DIR" + fi + echo $wiki_dir/"$(rg --with-filename --no-heading . "$wiki_dir" | sed "s@$wiki_dir@@" | fzf -i $fzf_args -1 --preview="bat $wiki_dir/\$(echo {} | sed 's/:.*//')" | sed 's/:.*//')" } function ws { @@ -230,7 +234,11 @@ function ws { } function ww { - ws $(rg --no-line-number --no-filename . ~/wiki | sed 's/[^a-zA-Z0-9]\+/\n/g' | grep -v "^$" | sort -f | uniq -ci | sort -hr | fzf -i | cut -c 9-) + local wiki_dir="$HOME/wiki/" + if [[ "$WIKI_DIR" != "" ]]; then + wiki_dir="$WIKI_DIR" + fi + ws $(rg --no-line-number --no-filename . "$wiki_dir" | sed 's/[^a-zA-Z0-9]\+/\n/g' | grep -v "^$" | sort -f | uniq -ci | sort -hr | fzf -i | cut -c 9-) } if command -v bat &> /dev/null; then diff --git a/fake_home/.zlogin b/fake_home/.zlogin index 17ae67d..08e5ac7 100644 --- a/fake_home/.zlogin +++ b/fake_home/.zlogin @@ -1,3 +1,17 @@ -date >> "$HOME/.tmp/getdot-log" -echo "~/zlogin, babyyy" >> "$HOME/.tmp/getdot-log" -RUN_GETDOT="true" GETDOT_ARGS="--skip-dconf" source "$HOME/.zshrc" +logfile="$HOME/.tmp/getdot-log" +# date >> "$logfile" +# echo "~/zlogin, babyyy" >> "$logfile" + +LOGIN_SYNC_DATE="$HOME/.bin/.login-dot-sync" + +touch $LOGIN_SYNC_DATE +login_sync_date="$(date '+%D')" +logged_date="$(cat "$LOGIN_SYNC_DATE")" + +if [[ "$login_sync_date" == "$logged_date" ]]; then + GETDOT_ARGS="--skip-dconf" source "$HOME/.zshrc" +else + RUN_GETDOT="true" GETDOT_ARGS="--skip-dconf" source "$HOME/.zshrc" +fi + +echo "$login_sync_date" > "$LOGIN_SYNC_DATE" diff --git a/fake_home/.zshrc b/fake_home/.zshrc index 5555443..00b5580 100644 --- a/fake_home/.zshrc +++ b/fake_home/.zshrc @@ -75,6 +75,8 @@ fi source ~/.shell_aliases source ~/.zsh_local +SYNC_LOCK_FILE="$HOME/.sync-lock" + # Ignores certain values/sections that shouldn't be synced function dconf-clean { local current_section="" @@ -148,15 +150,19 @@ function merge-hist { } function sync-history { + echo "Downloading shared history..." if ! scp -P 11275 'sage@sagev.space:~/histfile' "$HOME/.tmp/.histfile"; then + echo "Shared history download failed!" scp -P 11275 "$HOME/.histfile" 'sage@sagev.space:~/histfile' return fi + echo "Merging history files..." fc -W # Write to history file merge-hist "$HOME/.histfile" "$HOME/.tmp/.histfile" > "$HOME/.tmp/$(whoami).histfile" mv "$HOME/.tmp/$(whoami).histfile" "$HOME/.histfile" - scp -P 11275 "$HOME/.histfile" 'sage@sagev.space:~/histfile' fc -R # Read from new history file + echo "Uploading new shared history..." + scp -P 11275 "$HOME/.histfile" 'sage@sagev.space:~/histfile' } function install-extension { @@ -197,7 +203,46 @@ function load-extensions { done } -function pushdot { +function lock-wait { + local file="$1" + local seconds="$2" + local action="$3" + + if test -f "$file"; then + echo "Sync lockfile present at '$file'" + echo "Watching its output:" + tail -f "$file" & + tail_pid=$! + [[ "$action" == "" ]] || echo "Waiting for $action to finish" + for i in {0..$seconds}; do + sleep 1 + if ! test -f "$file"; then + kill $tail_pid &> /dev/null + echo + echo "Lock file at '$file' freed." + echo + break + fi + done + fi +} + +function lockfor { + local file="$1" + local seconds="$2" + + lock-wait "$file" "$seconds" + touch "$file" + $3 $4 $5 $6 $7 $8 $9 $10 + rm "$file" +} + + +function dot-lock-wait { + lock-wait "$SYNC_LOCK_FILE" 90 "ongoing sync" +} + +function _pushdot { cd "$DOT_DIR" || return 1 local res if ! git diff --quiet; then @@ -212,13 +257,17 @@ function pushdot { git push -u origin main fi fi - push-extensions - sync-history - push-dconf + push-extensions | tee -a "$SYNC_LOCK_FILE" + sync-history | tee -a "$SYNC_LOCK_FILE" + push-dconf | tee -a "$SYNC_LOCK_FILE" cd - return $res } +function pushdot { + lockfor "$SYNC_LOCK_FILE" 90 _pushdot $@ +} + function sync-dconf { if ! command -v dconf &> /dev/null; then echo "System does not use dconf" @@ -241,21 +290,25 @@ function sync-dconf { push-dconf } -function getdot { +function _getdot { if ! command -v scpace &> /dev/null; then echo "An alias for scpace has not been defined on this device!" return 1 fi cd "$DOT_DIR" || return 1 - git pull && ./copy.sh + git pull && ./copy.sh | tee -a "$SYNC_LOCK_FILE" - sync-history - load-extensions - [[ "$1" != "--skip-dconf" ]] && sync-dconf + sync-history | tee -a "$SYNC_LOCK_FILE" + load-extensions | tee -a "$SYNC_LOCK_FILE" + [[ "$1" != "--skip-dconf" ]] && sync-dconf | tee -a "$SYNC_LOCK_FILE" cd - > /dev/null } +function getdot { + lockfor "$SYNC_LOCK_FILE" 90 _getdot $@ +} + if which starship &> /dev/null; then eval "$(starship init zsh)" fi @@ -294,7 +347,7 @@ test -f "$HOME/.asdf/asdf.sh" && . "$HOME/.asdf/asdf.sh" test -f ~/.cargo/env && source ~/.cargo/env # bun completions -[ -s "/home/sage/.bun/_bun" ] && source "/home/sage/.bun/_bun" +[ -s "$HOME/.bun/_bun" ] && source "$HOME/.bun/_bun" # bun export BUN_INSTALL="$HOME/.bun"