From 64e667bdbfa3c40f5d7b0c5d84395ae2a28d434a Mon Sep 17 00:00:00 2001 From: 0xdilshan <257371012+0xdilshan@users.noreply.github.com> Date: Fri, 27 Feb 2026 19:17:15 +0200 Subject: [PATCH 1/6] feat: added alias for .zshrc.local --- .zshrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.zshrc b/.zshrc index 169ada3..f11c13d 100644 --- a/.zshrc +++ b/.zshrc @@ -187,6 +187,7 @@ _edit() { sconf() { _edit "${XDG_CONFIG_HOME:-$HOME/.config}/starship.toml" } zconf() { _edit "${ZDOTDIR:-$HOME}/.zshrc" } +zlocal() { _edit "${ZDOTDIR:-$HOME}/.zshrc.local" } alias reload='exec zsh' # --- Git Shortcuts --- From f04a5a15fe2098d5b815bd050fbd4e6ecabce1d5 Mon Sep 17 00:00:00 2001 From: 0xdilshan <257371012+0xdilshan@users.noreply.github.com> Date: Sat, 28 Feb 2026 17:33:40 +0200 Subject: [PATCH 2/6] feat: added clipboard utils installation & better os detection --- install.sh | 100 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 89 insertions(+), 11 deletions(-) diff --git a/install.sh b/install.sh index 75cb363..cdb38e9 100644 --- a/install.sh +++ b/install.sh @@ -50,6 +50,7 @@ echo -e "${CYAN}>>> Initiating Z-Shift Environment Deployment...${NC}" # ============================================================================= OS_TYPE="unknown" DISTRO="unknown" +DISTRO_LIKE="unknown" if [[ "$OSTYPE" == "darwin"* ]]; then OS_TYPE="macos" @@ -58,42 +59,73 @@ elif [ -f /etc/os-release ]; then OS_TYPE="linux" # shellcheck disable=SC1091 . /etc/os-release - DISTRO="$ID" + DISTRO="${ID:-unknown}" + DISTRO_LIKE="${ID_LIKE:-unknown}" # Catches derivatives (e.g. ID_LIKE="debian") fi echo -e "${BLUE}Detected OS: ${OS_TYPE} (${DISTRO})${NC}" +# Resolve distro family from ID or ID_LIKE +_resolve_distro_family() { + local id="$1" + local id_like="$2" + + case "$id" in + ubuntu|debian|pop|kali|linuxmint|raspbian|elementary|zorin) + echo "debian" ;; + arch|manjaro|endeavouros|garuda|artix) + echo "arch" ;; + fedora|rhel|centos|rocky|almalinux|nobara) + echo "fedora" ;; + opensuse*|suse*) + echo "suse" ;; + *) + # Fall back to ID_LIKE for unrecognised derivatives + case "$id_like" in + *debian*|*ubuntu*) echo "debian" ;; + *arch*) echo "arch" ;; + *fedora*|*rhel*) echo "fedora" ;; + *suse*) echo "suse" ;; + *) echo "unknown" ;; + esac + ;; + esac +} + +DISTRO_FAMILY="$(_resolve_distro_family "$DISTRO" "$DISTRO_LIKE")" + install_pkg() { local pkgs=("$@") echo -e "${YELLOW}Installing: ${pkgs[*]}...${NC}" - case $DISTRO in - ubuntu|debian|pop|kali|linuxmint) + case "$DISTRO_FAMILY" in + debian) export DEBIAN_FRONTEND=noninteractive sudo apt-get update -qq -y > /dev/null sudo apt-get install -qq -y "${pkgs[@]}" > /dev/null ;; - arch|manjaro|endeavouros) + arch) sudo pacman -Sy --quiet --noconfirm --needed "${pkgs[@]}" > /dev/null ;; - fedora|rhel|centos) + fedora) sudo dnf install -q -y "${pkgs[@]}" > /dev/null ;; - opensuse*|suse) + suse) sudo zypper install -q -y "${pkgs[@]}" > /dev/null ;; macos) brew install -q "${pkgs[@]}" > /dev/null ;; *) - echo -e "${RED}Unsupported distribution: $DISTRO${NC}" + echo -e "${RED}Unsupported distribution: ${DISTRO} (family: ${DISTRO_FAMILY})${NC}" + echo -e "${RED}Please install the following packages manually: ${pkgs[*]}${NC}" exit 1 ;; esac } # ============================================================================= -# 1. PRE-REQUISITES (Homebrew for MacOS) +# 1. PRE-REQUISITES (Homebrew for macOS) # ============================================================================= if [[ "$OS_TYPE" == "macos" ]]; then if ! command -v brew &> /dev/null; then @@ -101,6 +133,7 @@ if [[ "$OS_TYPE" == "macos" ]]; then /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" > /dev/null || { echo -e "${RED}Homebrew installation failed.${NC}"; exit 1 } + # Support both Apple Silicon (/opt/homebrew) and Intel (/usr/local) paths if [ -f "/opt/homebrew/bin/brew" ]; then eval "$(/opt/homebrew/bin/brew shellenv)" elif [ -f "/usr/local/bin/brew" ]; then @@ -114,12 +147,57 @@ fi # ============================================================================= echo -e "${YELLOW}Installing base dependencies...${NC}" -COMMON_DEPS=(git curl unzip zsh) +COMMON_DEPS=(git curl wget unzip zsh gnupg) if [[ "$OS_TYPE" == "macos" ]]; then - install_pkg git curl wget unzip zsh + install_pkg "${COMMON_DEPS[@]}" else - install_pkg wget gnupg "${COMMON_DEPS[@]}" + install_pkg "${COMMON_DEPS[@]}" +fi + +# ============================================================================= +# 2.1 CLIPBOARD UTILITY +# ============================================================================= +# macOS ships with pbcopy/pbpaste natively — no installation required. +# Linux needs xclip (X11) or wl-clipboard (Wayland) for clipboard access. +if [[ "$OS_TYPE" == "linux" ]]; then + echo -e "${YELLOW}Installing clipboard utility...${NC}" + + # Detect display server: Wayland takes priority, fall back to X11 + if [[ -n "$WAYLAND_DISPLAY" ]]; then + echo -e "${BLUE}Wayland detected — installing wl-clipboard${NC}" + case "$DISTRO_FAMILY" in + debian) install_pkg wl-clipboard ;; + arch) install_pkg wl-clipboard ;; + fedora) install_pkg wl-clipboard ;; + suse) install_pkg wl-clipboard ;; + esac + elif [[ -n "$DISPLAY" ]]; then + echo -e "${BLUE}X11 detected — installing xclip${NC}" + case "$DISTRO_FAMILY" in + debian) install_pkg xclip ;; + arch) install_pkg xclip ;; + fedora) install_pkg xclip ;; + suse) install_pkg xclip ;; + esac + else + # Headless / TTY-only: install both so the env is ready for either + echo -e "${YELLOW}No display server detected (headless/TTY) — installing xclip + wl-clipboard as fallback${NC}" + case "$DISTRO_FAMILY" in + debian) install_pkg xclip wl-clipboard ;; + arch) install_pkg xclip wl-clipboard ;; + fedora) install_pkg xclip wl-clipboard ;; + suse) install_pkg xclip wl-clipboard ;; + esac + fi + + # Verify at least one clipboard tool landed + if ! command -v xclip &>/dev/null && ! command -v wl-copy &>/dev/null; then + echo -e "${RED}Warning: no clipboard utility found after installation.${NC}" + echo -e "${RED}You may need to install xclip or wl-clipboard manually.${NC}" + else + echo -e "${GREEN}Clipboard utility installed successfully.${NC}" + fi fi # ============================================================================= From 32c8303d456dc4dd0ab33454b8a4dfa195a25241 Mon Sep 17 00:00:00 2001 From: 0xdilshan <257371012+0xdilshan@users.noreply.github.com> Date: Sat, 28 Feb 2026 18:08:10 +0200 Subject: [PATCH 3/6] fix: ci failures due to display server detection logic --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index cdb38e9..99b269f 100644 --- a/install.sh +++ b/install.sh @@ -164,7 +164,7 @@ if [[ "$OS_TYPE" == "linux" ]]; then echo -e "${YELLOW}Installing clipboard utility...${NC}" # Detect display server: Wayland takes priority, fall back to X11 - if [[ -n "$WAYLAND_DISPLAY" ]]; then + if [[ -n "${WAYLAND_DISPLAY:-}" ]]; then echo -e "${BLUE}Wayland detected — installing wl-clipboard${NC}" case "$DISTRO_FAMILY" in debian) install_pkg wl-clipboard ;; @@ -172,7 +172,7 @@ if [[ "$OS_TYPE" == "linux" ]]; then fedora) install_pkg wl-clipboard ;; suse) install_pkg wl-clipboard ;; esac - elif [[ -n "$DISPLAY" ]]; then + elif [[ -n "${DISPLAY:-}" ]]; then echo -e "${BLUE}X11 detected — installing xclip${NC}" case "$DISTRO_FAMILY" in debian) install_pkg xclip ;; From 5d096ea873485041f048a9fd31fc2154c457e2ba Mon Sep 17 00:00:00 2001 From: 0xdilshan <257371012+0xdilshan@users.noreply.github.com> Date: Sat, 28 Feb 2026 18:14:25 +0200 Subject: [PATCH 4/6] fix: macos ci cleanup --- install.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 99b269f..b6be19a 100644 --- a/install.sh +++ b/install.sh @@ -34,7 +34,7 @@ fi TEMP_DIRS=() cleanup() { - for d in "${TEMP_DIRS[@]}"; do + for d in "${TEMP_DIRS[@]-}"; do [ -n "$d" ] && [ -d "$d" ] && rm -rf "$d" done } @@ -55,6 +55,7 @@ DISTRO_LIKE="unknown" if [[ "$OSTYPE" == "darwin"* ]]; then OS_TYPE="macos" DISTRO="macos" + DISTRO_FAMILY="macos" elif [ -f /etc/os-release ]; then OS_TYPE="linux" # shellcheck disable=SC1091 @@ -92,7 +93,10 @@ _resolve_distro_family() { esac } -DISTRO_FAMILY="$(_resolve_distro_family "$DISTRO" "$DISTRO_LIKE")" +# Do not overwrite macOS family +if [[ "$OS_TYPE" != "macos" ]]; then + DISTRO_FAMILY="$(_resolve_distro_family "$DISTRO" "$DISTRO_LIKE")" +fi install_pkg() { local pkgs=("$@") From 57ab800b6bcaff8a1a995062d36b823afb38afe2 Mon Sep 17 00:00:00 2001 From: 0xdilshan <257371012+0xdilshan@users.noreply.github.com> Date: Sat, 28 Feb 2026 18:33:54 +0200 Subject: [PATCH 5/6] fix: initialize DISTRO_FAMILY --- install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install.sh b/install.sh index b6be19a..62fa1e8 100644 --- a/install.sh +++ b/install.sh @@ -51,6 +51,7 @@ echo -e "${CYAN}>>> Initiating Z-Shift Environment Deployment...${NC}" OS_TYPE="unknown" DISTRO="unknown" DISTRO_LIKE="unknown" +DISTRO_FAMILY="unknown" if [[ "$OSTYPE" == "darwin"* ]]; then OS_TYPE="macos" From 0c527e5955a8f65ae8b9f4e27d8584f17ad3a546 Mon Sep 17 00:00:00 2001 From: 0xdilshan <257371012+0xdilshan@users.noreply.github.com> Date: Sat, 28 Feb 2026 18:43:34 +0200 Subject: [PATCH 6/6] fix: install_pkg error handling --- install.sh | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 62fa1e8..bc42e0f 100644 --- a/install.sh +++ b/install.sh @@ -106,20 +106,38 @@ install_pkg() { case "$DISTRO_FAMILY" in debian) export DEBIAN_FRONTEND=noninteractive - sudo apt-get update -qq -y > /dev/null - sudo apt-get install -qq -y "${pkgs[@]}" > /dev/null + sudo apt-get update -qq -y > /dev/null || { + echo -e "${RED}Failed: apt-get update${NC}" + exit 1 + } + sudo apt-get install -qq -y "${pkgs[@]}" > /dev/null || { + echo -e "${RED}Failed to install ${pkgs[*]} via apt-get${NC}" + exit 1 + } ;; arch) - sudo pacman -Sy --quiet --noconfirm --needed "${pkgs[@]}" > /dev/null + sudo pacman -Sy --quiet --noconfirm --needed "${pkgs[@]}" > /dev/null || { + echo -e "${RED}Failed to install ${pkgs[*]} via pacman${NC}" + exit 1 + } ;; fedora) - sudo dnf install -q -y "${pkgs[@]}" > /dev/null + sudo dnf install -q -y "${pkgs[@]}" > /dev/null || { + echo -e "${RED}Failed to install ${pkgs[*]} via dnf${NC}" + exit 1 + } ;; suse) - sudo zypper install -q -y "${pkgs[@]}" > /dev/null + sudo zypper install -q -y "${pkgs[@]}" > /dev/null || { + echo -e "${RED}Failed to install ${pkgs[*]} via zypper${NC}" + exit 1 + } ;; macos) - brew install -q "${pkgs[@]}" > /dev/null + brew install -q "${pkgs[@]}" > /dev/null || { + echo -e "${RED}Failed to install ${pkgs[*]} via brew${NC}" + exit 1 + } ;; *) echo -e "${RED}Unsupported distribution: ${DISTRO} (family: ${DISTRO_FAMILY})${NC}"