diff --git a/.config/conky/conky.conf b/.config/iterm2/conky/conky.conf similarity index 100% rename from .config/conky/conky.conf rename to .config/iterm2/conky/conky.conf diff --git a/.config/libreoffice/4/user/config/javasettings_Linux_X86_64.xml b/.config/libreoffice/4/user/config/javasettings_Linux_X86_64.xml deleted file mode 100644 index 7f6ca74a..00000000 --- a/.config/libreoffice/4/user/config/javasettings_Linux_X86_64.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - -Oracle Corporation -file:///usr/lib/jvm/java-11-openjdk -11.0.20.1 -0 -1 -660069006C0065003A002F002F002F007500730072002F006C00690062002F006A0076006D002F006A006100760061002D00310031002D006F00700065006E006A0064006B002F006C00690062002F007300650072007600650072002F006C00690062006A0076006D002E0073006F000A002F007500730072002F006C00690062002F006A0076006D002F006A006100760061002D00310031002D006F00700065006E006A0064006B002F006C00690062002F0061006D006400360034002F0063006C00690065006E0074003A002F007500730072002F006C00690062002F006A0076006D002F006A006100760061002D00310031002D006F00700065006E006A0064006B002F006C00690062002F0061006D006400360034002F007300650072007600650072003A002F007500730072002F006C00690062002F006A0076006D002F006A006100760061002D00310031002D006F00700065006E006A0064006B002F006C00690062002F0061006D006400360034002F006E00610074006900760065005F0074006800720065006100640073003A002F007500730072002F006C00690062002F006A0076006D002F006A006100760061002D00310031002D006F00700065006E006A0064006B002F006C00690062002F0061006D006400360034000A00 - - diff --git a/.config/zsh/aliases b/.config/zsh/aliases index 394f0bc4..ee0a46c5 100644 --- a/.config/zsh/aliases +++ b/.config/zsh/aliases @@ -255,19 +255,12 @@ if [[ "$OSTYPE" == "linux"* ]]; then fi if [[ "$DISTRO" == "arch" || "$DISTRO" == "manjaro" ]]; then - flags="-S --noconfirm --needed" - # shellcheck disable=SC2139 - alias \$pac="sudo pacman $flags" - # shellcheck disable=SC2139 - alias \$yay="yay $flags" + \$pac() { sudo pacman -S --noconfirm --needed "$@"; } + \$yay() { yay -S --noconfirm --needed "$@"; } fi if [[ "$DISTRO" == "ubuntu"* ]]; then - # This works, its generally not recomended since now i cannot access variable with the same name, but that does not matter to me - flags="-y" - apt="sudo apt-get $flags install" - # shellcheck disable=SC2139,SC2086 - alias \$apt="$apt" + \$apt() { sudo apt-get -y install "$@"; } fi fi diff --git a/.gitignore b/.gitignore index 5b0227e6..9a1ab115 100644 --- a/.gitignore +++ b/.gitignore @@ -318,6 +318,7 @@ .config/libreoffice/4/user/GraphicsRenderTests.log .config/libreoffice/4/user/autotext/ .config/libreoffice/4/user/basic/ +.config/libreoffice/4/user/config/javasettings_Linux_X86_64.xml .config/libreoffice/4/user/database/ .config/libreoffice/4/user/extensions/ .config/libreoffice/4/user/gallery/ diff --git a/.local/scripts/bootstrap/arch_functions b/.local/scripts/bootstrap/arch_functions index e78b70c2..692529b4 100644 --- a/.local/scripts/bootstrap/arch_functions +++ b/.local/scripts/bootstrap/arch_functions @@ -34,6 +34,7 @@ base_install () { gcc # C++ gdb # Debugging C++ git + github-cli # GitHub CLI npm python python-pipenv diff --git a/.local/scripts/bootstrap/mac_functions b/.local/scripts/bootstrap/mac_functions index 1df10e55..6fa033e8 100755 --- a/.local/scripts/bootstrap/mac_functions +++ b/.local/scripts/bootstrap/mac_functions @@ -31,6 +31,7 @@ mac_install () { eza # ls on steroids (exa replacement) flex fzf # Fuzzy finder + gh # GitHub CLI git go gpg diff --git a/.local/scripts/bootstrap/tmp/emacs_ubuntu.sh b/.local/scripts/bootstrap/tmp/emacs_ubuntu.sh deleted file mode 100755 index cc034110..00000000 --- a/.local/scripts/bootstrap/tmp/emacs_ubuntu.sh +++ /dev/null @@ -1,8 +0,0 @@ -#! /usr/bin/env bash - -scripts="$HOME/.local/scripts" -source "$scripts/bootstrap/ubuntu_functions" - - -emacs_install - diff --git a/.local/scripts/bootstrap/ubuntu_functions b/.local/scripts/bootstrap/ubuntu_functions index 44996296..f9defc87 100644 --- a/.local/scripts/bootstrap/ubuntu_functions +++ b/.local/scripts/bootstrap/ubuntu_functions @@ -18,6 +18,7 @@ base_install () { file fonts-powerline fzf # Fuzzy finder + gh # GitHub CLI git git-lfs gnome-shell diff --git a/.local/scripts/bootstrap/uninstall_arch b/.local/scripts/bootstrap/uninstall_arch new file mode 100755 index 00000000..8dc5d6f0 --- /dev/null +++ b/.local/scripts/bootstrap/uninstall_arch @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# Arch bootstrap UNINSTALL +# Author: https://github.com/cuberhaus +set -euo pipefail + +### VARIABLES +scripts="$HOME/.local/scripts" +source "$scripts/bootstrap/base_functions" +source "$scripts/bootstrap/uninstall_tui" +source "$scripts/bootstrap/uninstall_arch_functions" + +### UNINSTALLATION +run_selected_uninstalls "Arch Uninstaller" \ + base_uninstall "Base packages (cmake, bat, fzf, kitty, vim, ...)" OFF \ + arch_uninstall "Arch drivers & services (NVIDIA, CUPS, Bluetooth)" OFF \ + i3_uninstall "i3 window manager (i3-gaps, i3blocks, rofi, ...)" OFF \ + xmonad_uninstall "xmonad window manager (xmobar, trayer, dmenu)" OFF \ + vim_uninstall "Vim / Neovim extras (ctags, formatters, ...)" OFF \ + laptop_uninstall "Laptop packages (TLP)" OFF \ + dwall_uninstall "Dynamic wallpapers" OFF \ + papirus_uninstall "Papirus folder icons" OFF \ + emacs_uninstall "Emacs & Doom Emacs" OFF + +if [ "$(basename "$SHELL")" == "zsh" ]; then + info "Currently using zsh. To revert to bash, run: chsh -s \$(which bash)" +fi + +info "Uninstallation complete. A system reboot is recommended." diff --git a/.local/scripts/bootstrap/uninstall_arch_functions b/.local/scripts/bootstrap/uninstall_arch_functions new file mode 100644 index 00000000..e2bf2a9c --- /dev/null +++ b/.local/scripts/bootstrap/uninstall_arch_functions @@ -0,0 +1,151 @@ +#! /usr/bin/env bash +# Arch bootstrap UNINSTALL functions +# Author: https://github.com/cuberhaus + +pac_remove="sudo pacman -Rns --noconfirm" +yay_remove="yay -Rns --noconfirm" + +############################################################### +# => Base packages uninstall +############################################################### +base_uninstall() { + info "Uninstalling base packages..." + + $pac_remove cmake opencl-headers bazel cudnn cuda conky \ + adapta-gtk-theme arc-gtk-theme arc-icon-theme \ + bat biber breeze calibre cron dconf-editor dex discord dnsutils github-cli \ + dunst eza exfat-utils file-roller firefox fzf gcc gdb \ + gnome-calculator gnome-font-viewer gnome-keyring gtk2 gtk3 \ + gucharmap gvim hardinfo cpu-x htop inotify-tools kcolorchooser \ + kdiff3 kitty kvantum-qt5 laptop-detect \ + libmythes mythes-en mythes-es \ + libreoffice-still libreoffice-still-ca lxappearance ncdu \ + nemo nemo-fileroller nemo-preview nemo-seahorse nemo-share \ + net-tools nilfs-utils nomacs noto-fonts-emoji npm ntfs-3g \ + okular papirus-icon-theme partitionmanager perl-file-mimeinfo \ + playerctl polkit polkit-gnome python python-pipenv python3 \ + qt5ct ranger rclone reflector remmina freerdp libvncserver \ + ruby seahorse speedcrunch stow svn the_silver_searcher \ + thunderbird tmux transmission-gtk trash-cli \ + ttf-dejavu ttf-liberation ttf-droid ttf-ubuntu-font-family ttf-roboto noto-fonts \ + tumbler ffmpegthumbnailer raw-thumbnailer udftools udiskie \ + dolphin udisks2 vlc w3m wget wireshark wmctrl xclip xdg-user-dirs \ + xfce4-clipman-plugin xorg xorg-xinit xss-lock yarn zsh \ + zathura-cb zathura-djvu zathura-pdf-mupdf zathura-ps zathura \ + kalk solaar telegram obsidian virt-viewer || true + + # AUR packages + $yay_remove caffeine-ng florence downgrade balena-etcher-appimage \ + woeusb-ng betterlockscreen google-chrome microsoft-edge-stable-bin \ + libreoffice-extension-languagetool timeshift tomighty ttf-ms-fonts || true + + git config --global --unset credential.helper || true +} + +############################################################### +# => Arch-specific packages uninstall +############################################################### +arch_uninstall() { + info "Uninstalling Arch-specific packages..." + + $pac_remove xorg-xrandr arandr autorandr \ + linux-headers nvidia nvidia-utils xf86-video-intel mesa lib32-mesa \ + lib32-nvidia-utils nvidia-settings \ + cups system-config-printer \ + bluez bluez-utils blueberry \ + lightdm-gtk-greeter lightdm lightdm-gtk-greeter-settings \ + networkmanager nm-connection-editor || true + + $yay_remove pulseaudio-modules-bt || true + + # Disable services (ignore errors if already disabled) + sudo systemctl disable org.cups.cupsd.service 2>/dev/null || true + sudo systemctl disable bluetooth.service 2>/dev/null || true + sudo systemctl disable lightdm.service 2>/dev/null || true + sudo systemctl disable NetworkManager.service 2>/dev/null || true +} + +############################################################### +# => i3 uninstall +############################################################### +i3_uninstall() { + info "Uninstalling i3..." + + $pac_remove acpi awk bc upower feh flameshot i3-gaps i3blocks \ + light picom rofi yad xdotool zenity \ + perl-anyevent-i3 python-dbus || true + + $yay_remove cava kbdd-git || true +} + +############################################################### +# => xmonad uninstall +############################################################### +xmonad_uninstall() { + info "Uninstalling xmonad..." + + $pac_remove dmenu trayer xmobar xmonad-contrib xorg-xmessage || true + + sudo rm -f /etc/pacman.d/hooks/xmonad.hook +} + +############################################################### +# => Vim/neovim uninstall +############################################################### +vim_uninstall() { + info "Uninstalling vim/neovim extras..." + + $pac_remove neovim ctags astyle autopep8 yapf cmake-format shfmt \ + stylish-haskell tidy python-pip || true + + sudo npm uninstall -g neovim js-beautify remark-cli 2>/dev/null || true + sudo gem uninstall neovim 2>/dev/null || true +} + +############################################################### +# => Laptop packages uninstall +############################################################### +laptop_uninstall() { + info "Uninstalling laptop packages..." + + $pac_remove tlp || true + sudo systemctl disable tlp.service 2>/dev/null || true +} + +############################################################### +# => Dynamic wallpapers uninstall +############################################################### +dwall_uninstall() { + info "Removing dynamic wallpapers..." + sudo rm -rf /usr/share/dynamic-wallpaper 2>/dev/null || true + rm -rf "$HOME/.local/share/dynamic-wallpaper" 2>/dev/null || true +} + +############################################################### +# => Papirus folders uninstall +############################################################### +papirus_uninstall() { + info "Removing papirus-folders..." + if [ -x /usr/local/bin/papirus-folders ]; then + wget -qO- https://git.io/papirus-folders-install | env uninstall=true sh || true + fi +} + +############################################################### +# => Emacs uninstall +############################################################### +emacs_uninstall() { + info "Uninstalling Emacs..." + + systemctl --user disable emacs 2>/dev/null || true + + $pac_remove emacs-nativecomp aspell aspell-ca aspell-de aspell-en aspell-es \ + ispell pandoc languagetool mplayer shellcheck python-pipenv prettier \ + ripgrep fd || true + + sudo npm uninstall -g markdownlint textlint 2>/dev/null || true + + rm -rf "$HOME/.emacs.d" 2>/dev/null || true + rm -rf "$HOME/.config/doom-emacs" 2>/dev/null || true + rm -f "$HOME/.config/chemacs/profile" 2>/dev/null || true +} diff --git a/.local/scripts/bootstrap/uninstall_mac b/.local/scripts/bootstrap/uninstall_mac new file mode 100755 index 00000000..c92c1a8b --- /dev/null +++ b/.local/scripts/bootstrap/uninstall_mac @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# macOS bootstrap UNINSTALL +# Author: https://github.com/cuberhaus +set -euo pipefail + +### VARIABLES +scripts="$HOME/.local/scripts" +source "$scripts/bootstrap/base_functions" +source "$scripts/bootstrap/uninstall_tui" +source "$scripts/bootstrap/uninstall_mac_functions" + +### UNINSTALLATION +run_selected_uninstalls "macOS Uninstaller" \ + cli_uninstall "CLI tools (bat, fzf, ripgrep, stow, ...)" OFF \ + fonts_uninstall "Nerd Fonts (Fira Code, Iosevka, Meslo, ...)" OFF \ + gui_apps_uninstall "GUI applications (Chrome, Spotify, VS Code, ...)" OFF \ + vim_uninstall "Vim / Neovim (macvim, neovim, plugins)" OFF \ + brew_cleanup "Run brew cleanup" OFF + +info "Uninstallation complete." +info "To fully remove Homebrew itself, run:" +info " /bin/bash -c \"\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)\"" diff --git a/.local/scripts/bootstrap/uninstall_mac_functions b/.local/scripts/bootstrap/uninstall_mac_functions new file mode 100644 index 00000000..74586800 --- /dev/null +++ b/.local/scripts/bootstrap/uninstall_mac_functions @@ -0,0 +1,78 @@ +#! /usr/bin/env bash +# macOS bootstrap UNINSTALL functions +# Author: https://github.com/cuberhaus + +############################################################### +# => CLI tools uninstall +############################################################### +cli_uninstall() { + info "Uninstalling CLI tools..." + + local formulae=( + ack astyle bat bison cmake eza flex fzf gh git go gpg htop llvm mono + ncdu neofetch p7zip pinentry-mac pkg-config ranger w3m rclone + ripgrep smimesign sox stow swig the_silver_searcher unrar wget yarn + ) + + for pkg in "${formulae[@]}"; do + brew uninstall "$pkg" 2>/dev/null || true + done +} + +############################################################### +# => Fonts uninstall +############################################################### +fonts_uninstall() { + info "Uninstalling fonts..." + + local fonts=( + font-fira-code-nerd-font + font-inconsolata-nerd-font + font-iosevka-nerd-font + font-meslo-lg-nerd-font + ) + + for font in "${fonts[@]}"; do + brew uninstall "$font" 2>/dev/null || true + done +} + +############################################################### +# => GUI applications uninstall +############################################################### +gui_apps_uninstall() { + info "Uninstalling GUI applications..." + + local casks=( + caffeine ballast calibre ccleaner discord google-chrome + karabiner-elements kitty mos rectangle spotify sublime-text + texstudio the-unarchiver tomighty transmission visual-studio-code + vlc whatsapp anki notion notion-calendar obsidian todoist + ) + + for cask in "${casks[@]}"; do + brew uninstall --cask "$cask" 2>/dev/null || true + done +} + +############################################################### +# => Vim/neovim uninstall +############################################################### +vim_uninstall() { + info "Uninstalling vim/neovim..." + + brew uninstall macvim 2>/dev/null || true + brew uninstall neovim 2>/dev/null || true + + sudo npm uninstall -g neovim 2>/dev/null || true + python3 -m pip uninstall -y pynvim 2>/dev/null || true + sudo gem uninstall neovim 2>/dev/null || true +} + +############################################################### +# => Homebrew cleanup +############################################################### +brew_cleanup() { + info "Running brew cleanup..." + brew cleanup --prune=all 2>/dev/null || true +} diff --git a/.local/scripts/bootstrap/uninstall_manjaro b/.local/scripts/bootstrap/uninstall_manjaro new file mode 100755 index 00000000..319c187f --- /dev/null +++ b/.local/scripts/bootstrap/uninstall_manjaro @@ -0,0 +1,29 @@ +#!/usr/bin/env bash +# Manjaro bootstrap UNINSTALL +# Author: https://github.com/cuberhaus +set -euo pipefail + +### VARIABLES +scripts="$HOME/.local/scripts" +source "$scripts/bootstrap/base_functions" +source "$scripts/bootstrap/uninstall_tui" +source "$scripts/bootstrap/uninstall_arch_functions" +source "$scripts/bootstrap/uninstall_manjaro_functions" + +### UNINSTALLATION +run_selected_uninstalls "Manjaro Uninstaller" \ + base_uninstall "Base packages (cmake, bat, fzf, kitty, vim, ...)" OFF \ + arch_uninstall "Arch drivers & services (NVIDIA, CUPS, Bluetooth)" OFF \ + arch_and_manjaro_uninstall "Shared Arch/Manjaro (printers, Samba)" OFF \ + manjaro_uninstall "Manjaro snaps & packages (IDEs, Spotify, ...)" OFF \ + i3_uninstall "i3 window manager (i3-gaps, i3blocks, rofi, ...)" OFF \ + xmonad_uninstall "xmonad window manager (xmobar, trayer, dmenu)" OFF \ + vim_uninstall "Vim / Neovim extras (ctags, formatters, ...)" OFF \ + emacs_uninstall "Emacs & Doom Emacs" OFF \ + laptop_uninstall "Laptop packages (TLP)" OFF + +if [ "$(basename "$SHELL")" == "zsh" ]; then + info "Currently using zsh. To revert to bash, run: chsh -s \$(which bash)" +fi + +info "Uninstallation complete. A system reboot is recommended." diff --git a/.local/scripts/bootstrap/uninstall_manjaro_functions b/.local/scripts/bootstrap/uninstall_manjaro_functions new file mode 100644 index 00000000..da977b69 --- /dev/null +++ b/.local/scripts/bootstrap/uninstall_manjaro_functions @@ -0,0 +1,36 @@ +#! /usr/bin/env bash +# Manjaro bootstrap UNINSTALL functions +# Author: https://github.com/cuberhaus + +pac_remove="sudo pacman -Rns --noconfirm" +yay_remove="yay -Rns --noconfirm" + +############################################################### +# => Manjaro-specific packages uninstall +############################################################### +manjaro_uninstall() { + info "Uninstalling Manjaro-specific packages..." + + sudo snap remove intellij-idea-ultimate 2>/dev/null || true + sudo snap remove pycharm-professional 2>/dev/null || true + sudo snap remove spotify 2>/dev/null || true + sudo snap remove sublime-merge 2>/dev/null || true + sudo snap remove sublime-text 2>/dev/null || true + sudo snap remove whatsie 2>/dev/null || true + sudo snap remove zotero-snap 2>/dev/null || true + + $pac_remove cinnamon-screensaver manjaro-pipewire || true +} + +############################################################### +# => Arch+Manjaro shared packages uninstall +############################################################### +arch_and_manjaro_uninstall() { + info "Uninstalling shared Arch/Manjaro packages..." + + $pac_remove hplip || true + $yay_remove epson-inkjet-printer-escpr || true + + sudo gpasswd -d "$USER" sambashare 2>/dev/null || true + git config --global --unset credential.helper || true +} diff --git a/.local/scripts/bootstrap/uninstall_tui b/.local/scripts/bootstrap/uninstall_tui new file mode 100644 index 00000000..9512a6ff --- /dev/null +++ b/.local/scripts/bootstrap/uninstall_tui @@ -0,0 +1,129 @@ +#! /usr/bin/env bash +# TUI checklist helper for uninstall scripts +# Tries whiptail, then dialog, then a plain-text fallback. +# Author: https://github.com/cuberhaus + +# show_checklist TITLE TAG1 DESC1 ON/OFF TAG2 DESC2 ON/OFF ... +# Displays a checkbox list and prints the selected tags (space-separated) +# to stdout. Returns 1 if the user cancels. +show_checklist() { + local title="$1"; shift + local -a items=("$@") + local count=$(( ${#items[@]} / 3 )) + local height=$(( count + 8 )) + (( height < 15 )) && height=15 + (( height > 24 )) && height=24 + + if command -v whiptail &>/dev/null; then + _checklist_whiptail "$title" "$height" "$count" "${items[@]}" + elif command -v dialog &>/dev/null; then + _checklist_dialog "$title" "$height" "$count" "${items[@]}" + else + _checklist_text "$title" "${items[@]}" + fi +} + +_checklist_whiptail() { + local title="$1" height="$2" count="$3"; shift 3 + local result + result=$(whiptail --title "$title" \ + --checklist "Use SPACE to toggle, ENTER to confirm:" \ + "$height" 76 "$count" "$@" 3>&1 1>&2 2>&3) || return 1 + echo "$result" | tr -d '"' +} + +_checklist_dialog() { + local title="$1" height="$2" count="$3"; shift 3 + # dialog expects on/off in lowercase + local -a fixed=() + for arg in "$@"; do + case "$arg" in + ON) fixed+=("on") ;; + OFF) fixed+=("off") ;; + *) fixed+=("$arg") ;; + esac + done + local tmpfile + tmpfile=$(mktemp) + dialog --title "$title" \ + --checklist "Use SPACE to toggle, ENTER to confirm:" \ + "$height" 76 "$count" "${fixed[@]}" 2>"$tmpfile" + local rc=$? + local result + result=$(<"$tmpfile") + rm -f "$tmpfile" + (( rc != 0 )) && return 1 + echo "$result" | tr -d '"' +} + +_checklist_text() { + local title="$1"; shift + local -a tags=() descs=() defaults=() + while (( $# >= 3 )); do + tags+=("$1"); descs+=("$2"); defaults+=("$3") + shift 3 + done + + echo "" >&2 + echo "=== $title ===" >&2 + echo "" >&2 + local j + for (( j = 0; j < ${#tags[@]}; j++ )); do + local marker=" " + [[ "${defaults[$j]}" == "ON" ]] && marker="*" + printf " [%s] %d) %s\n" "$marker" $(( j + 1 )) "${descs[$j]}" >&2 + done + echo "" >&2 + echo "Enter numbers to uninstall (space-separated), 'all' for [*] defaults, or 'q' to cancel:" >&2 + read -r selection + + [[ "$selection" == "q" || "$selection" == "Q" ]] && return 1 + + local -a selected=() + if [[ "$selection" == "all" || -z "$selection" ]]; then + for (( j = 0; j < ${#tags[@]}; j++ )); do + [[ "${defaults[$j]}" == "ON" ]] && selected+=("${tags[$j]}") + done + else + for num in $selection; do + local idx=$(( num - 1 )) + if (( idx >= 0 && idx < ${#tags[@]} )); then + selected+=("${tags[$idx]}") + fi + done + fi + echo "${selected[*]}" +} + +# run_selected_uninstalls TITLE TAG1 DESC1 ON/OFF TAG2 DESC2 ON/OFF ... +# Shows the checklist, asks for final confirmation, then calls each +# selected tag as a bash function. +run_selected_uninstalls() { + local title="$1"; shift + local choices + choices=$(show_checklist "$title" "$@") || { + info "Uninstallation aborted." + exit 0 + } + + if [[ -z "$choices" ]]; then + info "Nothing selected. Exiting." + exit 0 + fi + + info "Selected: $choices" + echo "" + read -r -p "Proceed with uninstallation? [y/N] " confirm + if [[ ! "$confirm" =~ ^([yY][eE][sS]|[yY])$ ]]; then + info "Uninstallation aborted." + exit 0 + fi + + for func in $choices; do + if declare -f "$func" &>/dev/null; then + "$func" + else + warn "Unknown component: $func — skipping." + fi + done +} diff --git a/.local/scripts/bootstrap/uninstall_ubuntu b/.local/scripts/bootstrap/uninstall_ubuntu new file mode 100755 index 00000000..deee2d33 --- /dev/null +++ b/.local/scripts/bootstrap/uninstall_ubuntu @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +# Ubuntu bootstrap UNINSTALL +# Author: https://github.com/cuberhaus +set -euo pipefail + +### VARIABLES +scripts="$HOME/.local/scripts" +source "$scripts/bootstrap/base_functions" +source "$scripts/bootstrap/uninstall_tui" +source "$scripts/bootstrap/uninstall_ubuntu_functions" + +### UNINSTALLATION +run_selected_uninstalls "Ubuntu Uninstaller" \ + base_uninstall "Base packages (build-essential, git, zsh, ...)" OFF \ + ubuntu_gui_uninstall "Ubuntu GUI apps (calibre, VLC, RStudio, ...)" OFF \ + chrome_uninstall "Google Chrome" OFF \ + snaps_uninstall "Snap packages (VS Code, Discord, IDEs, ...)" OFF \ + emacs_uninstall "Emacs & Doom Emacs" OFF \ + vim_uninstall "Vim / Neovim extras" OFF \ + brew_uninstall "Homebrew" OFF \ + cleanup "Run apt autoremove cleanup" OFF + +if [ "$(basename "$SHELL")" == "zsh" ]; then + info "Currently using zsh. To revert to bash, run: chsh -s \$(which bash)" +fi + +info "Uninstallation complete. A system reboot is recommended." diff --git a/.local/scripts/bootstrap/uninstall_ubuntu_functions b/.local/scripts/bootstrap/uninstall_ubuntu_functions new file mode 100644 index 00000000..088acc2f --- /dev/null +++ b/.local/scripts/bootstrap/uninstall_ubuntu_functions @@ -0,0 +1,108 @@ +#! /usr/bin/env bash +# Ubuntu bootstrap UNINSTALL functions +# Author: https://github.com/cuberhaus + +apt_remove="sudo apt-get remove --purge -y" +apt_autoremove="sudo apt-get autoremove -y" + +############################################################### +# => Base packages uninstall +############################################################### +base_uninstall() { + info "Uninstalling base packages..." + + $apt_remove autoconf automake bat build-essential cmake curl eza file \ + fonts-powerline fzf git gh gnome-shell htop inkscape laptop-detect \ + libgtk-3-dev ncdu neovim nodejs npm optipng pkg-config python3 \ + python3-pip ranger w3m rclone ruby-dev samba-common-bin sassc \ + silversearcher-ag stow subversion tmux vim-gtk yarn zsh eog sshfs || true + + git config --global --unset credential.helper || true +} + +############################################################### +# => Ubuntu GUI packages uninstall +############################################################### +ubuntu_gui_uninstall() { + info "Uninstalling Ubuntu GUI packages..." + + $apt_remove lxappearance arc-theme audacity calibre \ + cpu-checker qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils \ + gnome-screensaver gparted pavucontrol thunderbird timeshift \ + transmission vlc caffeine dconf-editor r-base || true + + # RStudio + sudo dpkg -r rstudio 2>/dev/null || true +} + +############################################################### +# => Google Chrome uninstall +############################################################### +chrome_uninstall() { + info "Uninstalling Google Chrome..." + $apt_remove google-chrome-stable || true +} + +############################################################### +# => Snaps uninstall +############################################################### +snaps_uninstall() { + info "Uninstalling snaps..." + + sudo snap remove code 2>/dev/null || true + sudo snap remove discord 2>/dev/null || true + sudo snap remove intellij-idea-professional 2>/dev/null || true + sudo snap remove pycharm-professional 2>/dev/null || true + sudo snap remove skype 2>/dev/null || true + sudo snap remove slack 2>/dev/null || true + sudo snap remove spotify 2>/dev/null || true + sudo snap remove sublime-merge 2>/dev/null || true + sudo snap remove sublime-text 2>/dev/null || true + sudo snap remove walc 2>/dev/null || true +} + +############################################################### +# => Emacs uninstall +############################################################### +emacs_uninstall() { + info "Uninstalling Emacs..." + + $apt_remove emacs-gtk tar fd-find clang libtool || true + + rm -rf "$HOME/.emacs.d" 2>/dev/null || true + rm -rf "$HOME/.config/doom-emacs" 2>/dev/null || true + rm -f "$HOME/.config/chemacs/profile" 2>/dev/null || true +} + +############################################################### +# => Vim/neovim uninstall +############################################################### +vim_uninstall() { + info "Uninstalling vim/neovim extras..." + + sudo npm uninstall -g neovim 2>/dev/null || true + python3 -m pip uninstall -y pynvim 2>/dev/null || true + sudo gem uninstall neovim 2>/dev/null || true +} + +############################################################### +# => Homebrew uninstall +############################################################### +brew_uninstall() { + if ! command -v brew &>/dev/null; then + info "Homebrew not found, skipping." + return + fi + + info "Uninstalling Homebrew..." + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" || true +} + +############################################################### +# => Cleanup +############################################################### +cleanup() { + info "Running apt cleanup..." + sudo apt-get update + $apt_autoremove +} diff --git a/.local/scripts/bootstrap/uninstall_work b/.local/scripts/bootstrap/uninstall_work new file mode 100755 index 00000000..a90e6b7c --- /dev/null +++ b/.local/scripts/bootstrap/uninstall_work @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# Work machine bootstrap UNINSTALL (Asus ROG Strix / Ubuntu + NVIDIA) +# Author: https://github.com/cuberhaus +set -euo pipefail + +### VARIABLES +scripts="$HOME/.local/scripts" +source "$scripts/bootstrap/base_functions" +source "$scripts/bootstrap/uninstall_tui" +source "$scripts/bootstrap/uninstall_work_functions" + +### UNINSTALLATION +run_selected_uninstalls "Work Machine Uninstaller" \ + nvidia_uninstall "NVIDIA drivers & tools" OFF \ + dev_tools_uninstall "Development tools (build-essential, git, ...)" OFF \ + node_uninstall "Node.js & global npm packages" OFF \ + python_uninstall "Python, pip & pipx packages" OFF \ + docker_uninstall "Docker CE & compose" OFF \ + gui_apps_uninstall "GUI apps (Chrome, VS Code, Cursor, Spotify, ...)" OFF + +if [ "$(basename "$SHELL")" == "zsh" ]; then + info "Currently using zsh. To revert to bash, run: chsh -s \$(which bash)" +fi + +info "Uninstallation complete. A system reboot is recommended." diff --git a/.local/scripts/bootstrap/uninstall_work_functions b/.local/scripts/bootstrap/uninstall_work_functions new file mode 100755 index 00000000..47c402b2 --- /dev/null +++ b/.local/scripts/bootstrap/uninstall_work_functions @@ -0,0 +1,114 @@ +#! /usr/bin/env bash +# Work machine bootstrap UNINSTALL functions +# Author: https://github.com/cuberhaus + +apt_remove="sudo apt-get remove --purge -y" +apt_autoremove="sudo apt-get autoremove -y" + +############################################################### +# => Revert ROG Strix shutdown fix +############################################################### +shutdown_restore() { + # If the script has an uninstall or revert mechanism, use it here. + info "Skipping shutdown_fix reversal as it modifies GRUB and requires manual review." +} + +############################################################### +# => NVIDIA drivers uninstall +############################################################### +nvidia_uninstall() { + info "Uninstalling NVIDIA tools..." + $apt_remove ubuntu-drivers-common nvidia-settings nvidia-prime || true +} + +############################################################### +# => Core dev tools uninstall +############################################################### +dev_tools_uninstall() { + info "Uninstalling dev tools..." + $apt_remove build-essential cmake curl git jq tree wget zsh stow vim-gtk3 neovim \ + bat eza fzf htop ncdu ranger ripgrep fd-find silversearcher-ag w3m shellcheck \ + unzip eog flameshot rclone sshfs gh hardinfo cpu-x neofetch || true + + # Unset global git config + git config --global --unset credential.helper || true +} + +############################################################### +# => Node.js uninstall +############################################################### +node_uninstall() { + info "Uninstalling Node.js and global packages..." + sudo npm uninstall -g cline markdownlint-cli2 || true + $apt_remove nodejs || true + + # Remove NodeSource repo + sudo rm -f /etc/apt/sources.list.d/nodesource.list + sudo rm -f /etc/apt/keyrings/nodesource.gpg +} + +############################################################### +# => Python uninstall +############################################################### +python_uninstall() { + info "Uninstalling Python and pipx packages..." + $apt_remove python3 python3-pip python3-venv pipx || true + + # Uninstall vim-vint + python3 -m pip uninstall -y vim-vint || true + + # Uninstall all pipx packages + if command -v pipx &>/dev/null; then + pipx uninstall-all || true + fi +} + +############################################################### +# => Docker CE uninstall +############################################################### +docker_uninstall() { + info "Uninstalling Docker..." + $apt_remove docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin || true + + # Remove Docker apt repo and key + sudo rm -f /etc/apt/sources.list.d/docker.list + sudo rm -f /etc/apt/keyrings/docker.gpg + + # Remove user from docker group + sudo gpasswd -d "$USER" docker || true +} + +############################################################### +# => GUI applications uninstall +############################################################### +gui_apps_uninstall() { + info "Uninstalling GUI applications..." + + # apt packages + $apt_remove firefox vlc google-chrome-stable code antigravity warp-terminal \ + libreoffice caffeine dconf-editor libfuse2 || true + + # Snaps + sudo snap remove obsidian || true + sudo snap remove spotify || true + sudo snap remove discord || true + sudo snap remove walc || true + sudo snap remove sublime-text || true + sudo snap remove sublime-merge || true + + # Remove VS Code repo + sudo rm -f /etc/apt/sources.list.d/vscode.list + sudo rm -f /etc/apt/keyrings/packages.microsoft.gpg + + # Remove Antigravity repo + sudo rm -f /etc/apt/sources.list.d/antigravity.list + sudo rm -f /etc/apt/keyrings/antigravity-repo-key.gpg + + # Cursor AppImage removal + rm -f "$HOME/Applications/cursor.AppImage" + rm -f "$HOME/.local/share/applications/cursor.desktop" + + # Clean up apt caches + sudo apt-get update + $apt_autoremove +} diff --git a/.local/scripts/bootstrap/work b/.local/scripts/bootstrap/work index b0c24163..fdb15597 100755 --- a/.local/scripts/bootstrap/work +++ b/.local/scripts/bootstrap/work @@ -28,6 +28,14 @@ docker_install gcloud_install gui_apps_install +current_scale=$(gsettings get org.gnome.desktop.interface text-scaling-factor 2>/dev/null || echo "1.0") +if [[ "$current_scale" != "1.3" ]]; then + read -r -p "Do you have a high DPI screen? [y/N] " hidpi + if [[ "$hidpi" =~ ^([yY][eE][sS]|[yY])$ ]]; then + high_dpi_screen + fi +fi + if [ "$(basename "$SHELL")" != "zsh" ]; then chsh -s "$(which zsh)" fi diff --git a/.local/scripts/bootstrap/work_functions b/.local/scripts/bootstrap/work_functions index 5aeeba23..a9533316 100644 --- a/.local/scripts/bootstrap/work_functions +++ b/.local/scripts/bootstrap/work_functions @@ -61,6 +61,7 @@ dev_tools_install() { bat # Better cat eza # Better ls (exa replacement) fzf # Fuzzy finder + gh # GitHub CLI htop # System monitor ncdu # Disk usage analyzer ranger # File manager @@ -79,9 +80,15 @@ dev_tools_install() { sshfs # Mount remote filesystems over SSH net-tools # Network utilities (ifconfig, netstat, etc.) nmap # Network exploration and security auditing + + # Hardware info + hardinfo # GUI hardware info & benchmarks + cpu-x # CPU-Z style hardware viewer + neofetch # Terminal system info summary ) $apt "${packages[@]}" + # Git config git config --global credential.helper store } @@ -341,6 +348,38 @@ EOF info "VS Code already installed, skipping." fi + # Obsidian + if ! command -v obsidian &>/dev/null; then + info "Installing Obsidian..." + sudo snap install obsidian --classic + else + info "Obsidian already installed, skipping." + fi + + # Cursor (AI IDE — AppImage) + if [ ! -f "$HOME/Applications/cursor.AppImage" ] || [ "$(stat -c%s "$HOME/Applications/cursor.AppImage")" -lt 1048576 ]; then + info "Installing Cursor..." + $apt libfuse2 + mkdir -p "$HOME/Applications" + local cursor_url + cursor_url=$(curl -fsSL "https://www.cursor.com/api/download?platform=linux-x64&releaseTrack=stable" | jq -r '.downloadUrl') + curl -fsSL "$cursor_url" -o "$HOME/Applications/cursor.AppImage" + chmod +x "$HOME/Applications/cursor.AppImage" + # Desktop entry + cat > "$HOME/.local/share/applications/cursor.desktop" </dev/null; then info "Installing Antigravity..." @@ -380,8 +419,42 @@ EOF info "Claude Code already installed, skipping." fi - # ── Phase 5: snaps ─────────────────────────────────────────── - snap list obsidian &>/dev/null 2>&1 || sudo snap install obsidian --classic - snap list spotify &>/dev/null 2>&1 || sudo snap install spotify - snap list discord &>/dev/null 2>&1 || sudo snap install discord + # LibreOffice (full office suite) + $apt libreoffice + + # Caffeine (prevent screen from going to sleep) + $apt caffeine + + # GNOME advanced settings + $apt dconf-editor + + # Sublime Text + snap list sublime-text &>/dev/null 2>&1 || sudo snap install sublime-text --classic + + # Sublime Merge + snap list sublime-merge &>/dev/null 2>&1 || sudo snap install sublime-merge --classic + + # Walc (WhatsApp Linux client) + snap list walc &>/dev/null 2>&1 || sudo snap install walc + + # Spotify and Discord (snap) + snap list spotify &>/dev/null 2>&1 || sudo snap install spotify + snap list discord &>/dev/null 2>&1 || sudo snap install discord +} + +############################################################### +# => High DPI screen tweaks (GNOME) +############################################################### + +# This has some problems with some apps that are seen very tiny, it is definitely not the perfect solution +high_dpi_screen() { + # To fix high dpi screens, two options, go to 200% scaling, or fractional scaling, fractional scaling causes blurry text, more power usage, lower speed. + + # We instead increase text scaling + gsettings set org.gnome.desktop.interface text-scaling-factor 1.3 + + # Increase cursor size Settings-> Accesibility -> Cursor size -> Medium + gsettings set org.gnome.desktop.interface cursor-size 35 + # Set icons to Large 'small' to set it smaller + gsettings set org.gnome.shell.extensions.ding icon-size 'large' } diff --git a/.local/scripts/bootstrap/xterm-256color-italic.terminfo b/.local/scripts/bootstrap/xterm-256color-italic.terminfo deleted file mode 100644 index 68407aee..00000000 --- a/.local/scripts/bootstrap/xterm-256color-italic.terminfo +++ /dev/null @@ -1,4 +0,0 @@ -# A xterm-256color based TERMINFO that adds the escape sequences for italic. -xterm-256color-italic|xterm with 256 colors and italic, - sitm=\E[3m, ritm=\E[23m, - use=xterm-256color, diff --git a/.zshenv b/.zshenv index a024e581..b8205f16 100644 --- a/.zshenv +++ b/.zshenv @@ -32,6 +32,10 @@ fi # TO CHECK IF PATH FOR APPS WORK OPEN OKULAR OR QT5 SETTINGS # fi +if [ -d "$HOME/.npm-global/bin" ] ; then + PATH="$HOME/.npm-global/bin:$PATH" +fi + if [ -d "$HOME/.local/scripts/bin" ] ; then PATH="$HOME/.local/scripts/bin:$PATH" fi diff --git a/Makefile b/Makefile index 1958cb8b..695c2943 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ STOW := stow STOW_DIR := $(shell pwd) TARGET := $(HOME) -.PHONY: help install uninstall restow dry-run lint check fix hooks update submodules antigen-update skip-worktree bootstrap-arch bootstrap-manjaro bootstrap-ubuntu bootstrap-mac bootstrap-work +.PHONY: help install uninstall restow dry-run lint check fix hooks update submodules antigen-update skip-worktree bootstrap-arch bootstrap-manjaro bootstrap-ubuntu bootstrap-mac bootstrap-work uninstall-arch uninstall-manjaro uninstall-ubuntu uninstall-mac uninstall-work help: ## Show this help @grep -E '^[a-zA-Z_-]+:.*##' $(MAKEFILE_LIST) | \ @@ -117,3 +117,22 @@ bootstrap-mac: ## Run macOS bootstrap bootstrap-work: ## Run work machine bootstrap (Ubuntu + NVIDIA) bash .local/scripts/bootstrap/work + +# --------------------------------------------------------------------------- +# Uninstall (OS-specific) +# --------------------------------------------------------------------------- + +uninstall-arch: ## Run Arch uninstaller + bash .local/scripts/bootstrap/uninstall_arch + +uninstall-manjaro: ## Run Manjaro uninstaller + bash .local/scripts/bootstrap/uninstall_manjaro + +uninstall-ubuntu: ## Run Ubuntu uninstaller + bash .local/scripts/bootstrap/uninstall_ubuntu + +uninstall-mac: ## Run macOS uninstaller + bash .local/scripts/bootstrap/uninstall_mac + +uninstall-work: ## Run work machine uninstaller + bash .local/scripts/bootstrap/uninstall_work