added quickshell and updated zsh
This commit is contained in:
120
home/zsh/init.zsh
Normal file
120
home/zsh/init.zsh
Normal file
@@ -0,0 +1,120 @@
|
||||
# Path configuration
|
||||
export PATH="$HOME/.local/bin:$HOME/bin:$HOME/.cargo/bin:$PNPM_HOME:$PATH"
|
||||
|
||||
if [ -d "$HOME/Tools/xilinx/Vivado/2023.1/bin" ]; then
|
||||
export PATH="$HOME/Tools/xilinx/Vivado/2023.1/bin:$PATH"
|
||||
fi
|
||||
|
||||
# Miniconda / conda profile hook if installed
|
||||
if [ -f /opt/miniconda3/etc/profile.d/conda.sh ]; then
|
||||
source /opt/miniconda3/etc/profile.d/conda.sh
|
||||
fi
|
||||
|
||||
# Environment modules support if available
|
||||
if (( ${+functions[module]} )) || [ -f /etc/modules/init/zsh ]; then
|
||||
[ -f /etc/modules/init/zsh ] && source /etc/modules/init/zsh
|
||||
module use --append "$HOME/.config/modulefiles" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# Auto-tmux configuration
|
||||
use_auto_tmux () {
|
||||
! ([ -z "$DISPLAY" ] && [ -z "$WAYLAND_DISPLAY" ] || $(pgrep -x "i3" > /dev/null || pgrep -x "sway" > /dev/null || pgrep -x "Hyprland" > /dev/null))
|
||||
}
|
||||
|
||||
if use_auto_tmux; then
|
||||
export ZSH_TMUX_AUTOSTART=true
|
||||
export ZSH_TMUX_AUTOCONNECT=false
|
||||
export ZSH_TMUX_AUTOQUIT=true
|
||||
else
|
||||
export ZSH_TMUX_AUTOSTART=false
|
||||
export ZSH_TMUX_AUTOCONNECT=false
|
||||
export ZSH_TMUX_AUTOQUIT=false
|
||||
fi
|
||||
|
||||
if [[ -n "$TMUX" ]]; then
|
||||
tmux-window-name() {
|
||||
if [ -n "$TMUX_PLUGIN_MANAGER_PATH" ] && [ -f "$TMUX_PLUGIN_MANAGER_PATH/tmux-window-name/scripts/rename_session_windows.py" ]; then
|
||||
("$TMUX_PLUGIN_MANAGER_PATH/tmux-window-name/scripts/rename_session_windows.py" &)
|
||||
fi
|
||||
}
|
||||
autoload -Uz add-zsh-hook
|
||||
add-zsh-hook chpwd tmux-window-name
|
||||
fi
|
||||
|
||||
# Custom helper functions
|
||||
rebuild () {
|
||||
local action="${1:-switch}"
|
||||
shift 2>/dev/null || true
|
||||
|
||||
local config_dir="${FLAKE_CONFIG:-$HOME/NixOS-Configs}"
|
||||
local host="hades"
|
||||
local target="$config_dir#$host"
|
||||
|
||||
case "$action" in
|
||||
switch|test|boot)
|
||||
echo "==> Running: sudo nixos-rebuild $action --flake $target $*"
|
||||
sudo nixos-rebuild "$action" --flake "$target" "$@"
|
||||
;;
|
||||
build|dry-build|dry-run|dry-activate)
|
||||
local act="$action"
|
||||
[[ "$action" == "dry-run" ]] && act="dry-build"
|
||||
echo "==> Running: nixos-rebuild $act --flake $target $*"
|
||||
nixos-rebuild "$act" --flake "$target" "$@"
|
||||
;;
|
||||
help|-h|--help)
|
||||
echo "Usage: rebuild [switch|test|boot|build|dry-build] [extra nixos-rebuild options]"
|
||||
echo ""
|
||||
echo "Commands:"
|
||||
echo " switch Build, activate, and make default boot entry (default)"
|
||||
echo " test Build and activate without creating a boot entry"
|
||||
echo " boot Build and make default boot entry without activating"
|
||||
echo " build Build system to ./result without activating or sudo"
|
||||
echo " dry-build Show what would be built/fetched"
|
||||
;;
|
||||
*)
|
||||
echo "==> Running: sudo nixos-rebuild $action --flake $target $*"
|
||||
sudo nixos-rebuild "$action" --flake "$target" "$@"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
perlmutter_pass () {
|
||||
echo -n 'bw master password: '
|
||||
read -s MASTER_PASS
|
||||
echo
|
||||
echo -n 'Copying passkey...'
|
||||
echo "$(echo "$MASTER_PASS" | bw get password iris.nersc.gov 2>/dev/null)$(echo "$MASTER_PASS" | bw get totp iris.nersc.gov 2>/dev/null)" | wl-copy
|
||||
echo 'Done.'
|
||||
}
|
||||
|
||||
compiler_explorer () {
|
||||
docker run -d -p 10240:10240 --name compiler-explorer madduci/docker-compiler-explorer
|
||||
}
|
||||
|
||||
airplay_server () {
|
||||
uxplay -p 10000 -nh -n "$(hostname)" -restrict -allow 88:66:5A:76:32:F5 -allow C4:AC:AA:76:B7:80
|
||||
}
|
||||
|
||||
zathura_md () {
|
||||
cat "$1" | pandoc -f markdown -t pdf | zathura -
|
||||
}
|
||||
|
||||
fooocus () {
|
||||
if [ -f "$HOME/Tools/Fooocus/entry_with_update.py" ]; then
|
||||
"$HOME/.conda/envs/fooocus/bin/python" "$HOME/Tools/Fooocus/entry_with_update.py"
|
||||
else
|
||||
echo "Fooocus not found at $HOME/Tools/Fooocus"
|
||||
fi
|
||||
}
|
||||
|
||||
# Per-host / system local overrides fallback
|
||||
if [ -f "$HOME/.config/zsh/$(hostname)/env.sh" ]; then
|
||||
source "$HOME/.config/zsh/$(hostname)/env.sh"
|
||||
elif [ -f "$HOME/.zshrc.local" ]; then
|
||||
source "$HOME/.zshrc.local"
|
||||
fi
|
||||
|
||||
# Fetch / Banner on interactive terminal start
|
||||
if [[ -o interactive ]] && [ -z "$TMUX" ] && command -v pfetch >/dev/null 2>&1; then
|
||||
pfetch
|
||||
fi
|
||||
Reference in New Issue
Block a user