diff --git a/.config/ags/modules/indicators/indicatorvalues.js b/.config/ags/modules/indicators/indicatorvalues.js index 94b2d694b..4fde189b8 100644 --- a/.config/ags/modules/indicators/indicatorvalues.js +++ b/.config/ags/modules/indicators/indicatorvalues.js @@ -83,18 +83,22 @@ export default (monitor = 0) => { Utils.timeout(1000, updateAudioDevice); }), labelSetup: (self) => self.hook(Audio, (label) => { - label.label = `${Math.round(Audio.speaker?.volume * 100)}`; + const newDevice = (Audio.speaker?.name); + const updateValue = Math.round(Audio.speaker?.volume * 100); + if (!isNaN(updateValue)) { + if (newDevice === volumeIndicator.attribute.device && updateValue != label.label) { + Indicator.popup(1); + } + } + volumeIndicator.attribute.device = newDevice; + label.label = `${updateValue}`; }), progressSetup: (self) => self.hook(Audio, (progress) => { const updateValue = Audio.speaker?.volume; - const newDevice = (Audio.speaker?.name); if (!isNaN(updateValue)) { - if (newDevice === volumeIndicator.attribute.device && updateValue !== progress.value) { - Indicator.popup(1); - } - progress.value = updateValue; + if (updateValue > 1) progress.value = 1; + else progress.value = updateValue; } - volumeIndicator.attribute.device = newDevice; }), }); return MarginRevealer({ diff --git a/README.md b/README.md index 55287ba74..e15e5e577 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,12 @@ +
+

• overview •

+

+
+ +
Notable features @@ -20,6 +26,7 @@ - **AI Assisstant**: ChatGPT and Google Gemini - **Autogenerated colors** based on your wallpaper using [Material colors](https://m3.material.io/styles/color/the-color-system/key-colors-tones) - **Animations** that are natural and fluid + - **Transparent installation**: every command is shown before it's run
Instructions @@ -42,6 +49,20 @@
+
+ Software overview + + + | Software | Purpose | + | ------------- | ------------- | + | [Hyprland](https://github.com/hyprwm/hyprland) | The compositor (for noobs, you can just call it a window manager) | + | [AGS](https://github.com/Aylur/ags) | A GTK widget system, responsible for the status bar, sidebars, etc. | + | [Fuzzel](https://mark.stosberg.com/fuzzel-a-great-dmenu-and-rofi-altenrative-for-wayland/) | For clipboard and emoji picker | + + + - For a more comprehensive list of dependencies, see [scriptdata/dependencies.conf](https://github.com/end-4/dots-hyprland/blob/main/scriptdata/dependencies.conf) +
+
Help improve these dotfiles! @@ -49,7 +70,12 @@ - If you'd like to suggest fixes or a new widget, feel free to [open an issue](https://github.com/end-4/dots-hyprland/issues/new/choose)
-### [illogical_impulse](https://github.com/end-4/dots-hyprland/tree/illogical-impulse) +
+

• screenshots •

+

+
+ +### Main branch (*illogical-impulse*) **AI, on-screen indicators** ![image](https://github.com/end-4/dots-hyprland/assets/97237370/5e081770-0f1e-45c4-ad9c-3d19f488cd85) @@ -97,9 +123,11 @@ Desktop Preview ---- +
+

• thank you •

+

+
-## Thank you - [@clsty](https://github.com/clsty) for making an actually good install script + many other stuff that I neglect - [@midn8hustlr](https://github.com/midn8hustlr) for greatly improving the color generation system - AGS: [Aylur's config](https://github.com/Aylur/dotfiles), [kotontrion's config](https://github.com/kotontrion/dotfiles) @@ -107,11 +135,17 @@ - AI bots for providing useful examples - Open source contributors for their software and ricers for their insipration (would be a too long list to put here!) -## Stonks -- _thank you_ +
+

• stonks •

+

+
+ [![Stargazers over time](https://starchart.cc/end-4/dots-hyprland.svg?background=%230d1117&axis=%23e6edf3&line=%234759e7)](https://starchart.cc/end-4/dots-hyprland) +
+

• inspirations •

+

+
-## Inspirations - osu!lazer, Windows 11, Material Design 3, AvdanOS (concept) diff --git a/arch-packages/illogical-impulse-audio/PKGBUILD b/arch-packages/illogical-impulse-audio/PKGBUILD new file mode 100644 index 000000000..d2d1e7889 --- /dev/null +++ b/arch-packages/illogical-impulse-audio/PKGBUILD @@ -0,0 +1,14 @@ +pkgname=illogical-impulse-audio +pkgver=1.0 +pkgrel=1 +pkgdesc='Illogical Impulse Audio Dependencies' +arch=(any) +license=(None) +depends=( + pavucontrol + wireplumber + libdbusmenu-gtk3 + playerctl + swww +) + diff --git a/arch-packages/illogical-impulse-backlight/PKGBUILD b/arch-packages/illogical-impulse-backlight/PKGBUILD new file mode 100644 index 000000000..fe216262c --- /dev/null +++ b/arch-packages/illogical-impulse-backlight/PKGBUILD @@ -0,0 +1,11 @@ +pkgname=illogical-impulse-backlight +pkgver=1.0 +pkgrel=1 +pkgdesc='Illogical Impulse Backlight Dependencies' +arch=(any) +license=(None) +depends=( + brightnessctl + ddcutil +) + diff --git a/arch-packages/illogical-impulse-basic/PKGBUILD b/arch-packages/illogical-impulse-basic/PKGBUILD new file mode 100644 index 000000000..5027f7c3f --- /dev/null +++ b/arch-packages/illogical-impulse-basic/PKGBUILD @@ -0,0 +1,25 @@ +pkgname=illogical-impulse-basic +pkgver=1.0 +pkgrel=1 +pkgdesc='Illogical Impulse Basic Dependencies' +arch=(any) +license=(None) +depends=( + axel + bc + coreutils + cliphist + cmake + curl + fuzzel + rsync + wget + ripgrep + gojq + npm + meson + typescript + gjs + xdg-user-dirs +) + diff --git a/arch-packages/illogical-impulse-fonts-themes/PKGBUILD b/arch-packages/illogical-impulse-fonts-themes/PKGBUILD new file mode 100644 index 000000000..2cdffdd99 --- /dev/null +++ b/arch-packages/illogical-impulse-fonts-themes/PKGBUILD @@ -0,0 +1,20 @@ +pkgname=illogical-impulse-fonts-themes +pkgver=1.0 +pkgrel=1 +pkgdesc='Illogical Impulse Fonts and Theming Dependencies' +arch=(any) +license=(None) +depends=( + adw-gtk3-git + qt5ct + qt5-wayland + fontconfig + ttf-readex-pro + ttf-jetbrains-mono-nerd + ttf-material-symbols-variable-git + ttf-space-mono-nerd + fish + foot + starship +) + diff --git a/arch-packages/illogical-impulse-gnome/PKGBUILD b/arch-packages/illogical-impulse-gnome/PKGBUILD new file mode 100644 index 000000000..a2839f154 --- /dev/null +++ b/arch-packages/illogical-impulse-gnome/PKGBUILD @@ -0,0 +1,15 @@ +pkgname=illogical-impulse-gnome +pkgver=1.0 +pkgrel=1 +pkgdesc='Illogical Impulse GNOME Dependencies' +arch=(any) +license=(None) +depends=( + polkit-gnome + gnome-keyring + gnome-control-center + blueberry networkmanager + gammastep + gnome-bluetooth-3.0 +) + diff --git a/arch-packages/illogical-impulse-gtk/PKGBUILD b/arch-packages/illogical-impulse-gtk/PKGBUILD new file mode 100644 index 000000000..50a57d1c8 --- /dev/null +++ b/arch-packages/illogical-impulse-gtk/PKGBUILD @@ -0,0 +1,18 @@ +pkgname=illogical-impulse-gtk +pkgver=1.0 +pkgrel=1 +pkgdesc='Illogical Impulse GTK Dependencies' +arch=(any) +license=(None) +depends=( + webp-pixbuf-loader + gtk-layer-shell + gtk3 + gtksourceview3 + gobject-introspection + upower + yad + ydotool + xdg-user-dirs-gtk +) + diff --git a/arch-packages/illogical-impulse-microtex/PKGBUILD b/arch-packages/illogical-impulse-microtex/PKGBUILD new file mode 100644 index 000000000..90ceca2b2 --- /dev/null +++ b/arch-packages/illogical-impulse-microtex/PKGBUILD @@ -0,0 +1,13 @@ +pkgname=illogical-impulse-microtex +pkgver=1.0 +pkgrel=1 +pkgdesc='Illogical Impulse MicroTeX Dependencies' +arch=(any) +license=(None) +depends=( + tinyxml2 + gtkmm3 + gtksourceviewmm + cairomm +) + diff --git a/arch-packages/illogical-impulse-portal/PKGBUILD b/arch-packages/illogical-impulse-portal/PKGBUILD new file mode 100644 index 000000000..69c94c96c --- /dev/null +++ b/arch-packages/illogical-impulse-portal/PKGBUILD @@ -0,0 +1,12 @@ +pkgname=illogical-impulse-portal +pkgver=1.0 +pkgrel=1 +pkgdesc='Illogical Impulse XDG Desktop Portals' +arch=(any) +license=(None) +depends=( + xdg-desktop-portal + xdg-desktop-portal-gtk + xdg-desktop-portal-hyprland-git +) + diff --git a/arch-packages/illogical-impulse-pymyc-aur/PKGBUILD b/arch-packages/illogical-impulse-pymyc-aur/PKGBUILD new file mode 100644 index 000000000..969ea5fa3 --- /dev/null +++ b/arch-packages/illogical-impulse-pymyc-aur/PKGBUILD @@ -0,0 +1,13 @@ +pkgname=illogical-impulse-pymyc-aur +pkgver=1.0 +pkgrel=1 +pkgdesc='Illogical Impulse PyMYC Dependencies' +arch=(any) +license=(None) +depends=( + python-materialyoucolor-git + gradience-git + python-libsass + python-material-color-utilities +) + diff --git a/arch-packages/illogical-impulse-python/PKGBUILD b/arch-packages/illogical-impulse-python/PKGBUILD new file mode 100644 index 000000000..801e2829b --- /dev/null +++ b/arch-packages/illogical-impulse-python/PKGBUILD @@ -0,0 +1,14 @@ +pkgname=illogical-impulse-python +pkgver=1.0 +pkgrel=1 +pkgdesc='Illogical Impulse Python Dependencies' +arch=(any) +license=(None) +depends=( + python-build + python-pillow + python-pywal + python-setuptools-scm + python-wheel +) + diff --git a/arch-packages/illogical-impulse-screencapture/PKGBUILD b/arch-packages/illogical-impulse-screencapture/PKGBUILD new file mode 100644 index 000000000..ab5911fb9 --- /dev/null +++ b/arch-packages/illogical-impulse-screencapture/PKGBUILD @@ -0,0 +1,15 @@ +pkgname=illogical-impulse-screencapture +pkgver=1.0 +pkgrel=1 +pkgdesc='Illogical Impulse Screenshot and Recording Dependencies' +arch=(any) +license=(None) +depends=( + swappy + wf-recorder + grim + tesseract + tesseract-data-eng + slurp +) + diff --git a/arch-packages/illogical-impulse-widgets/PKGBUILD b/arch-packages/illogical-impulse-widgets/PKGBUILD new file mode 100644 index 000000000..5ae723789 --- /dev/null +++ b/arch-packages/illogical-impulse-widgets/PKGBUILD @@ -0,0 +1,18 @@ +pkgname=illogical-impulse-widgets +pkgver=1.0 +pkgrel=1 +pkgdesc='Illogical Impulse Widget Dependencies' +arch=(any) +license=(None) +depends=( + dart-sass + python-pywayland + python-psutil + hypridle-git + hyprlock-git + wlogout + wl-clipboard + hyprpicker-git + anyrun-git +) + diff --git a/install.sh b/install.sh index c4ed16da7..40c07bf23 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,7 @@ #!/usr/bin/env bash cd "$(dirname "$0")" export base="$(pwd)" +source ./scriptdata/environment-variables source ./scriptdata/functions source ./scriptdata/installers source ./scriptdata/options @@ -13,7 +14,7 @@ printf "\e[34m[$0]: Hi there! Before we start:\n" printf 'This script 1. only works for ArchLinux and Arch-based distros.\n' printf ' 2. does not handle system-level/hardware stuff like Nvidia drivers\n' printf "\e[31m" -printf "Please CONFIRM that you HAVE ALREADY BACKED UP \"$HOME/.config/\" and \"$HOME/.local/\" folders!\n" +printf "Please CONFIRM that you HAVE ALREADY BACKED UP \"$XDG_CONFIG_HOME\" and \"$HOME/.local/\" folders!\n" printf "\e[0m" printf "Enter capital \"YES\" (without quotes) to continue:" read -p " " p @@ -80,12 +81,45 @@ if ! command -v yay >/dev/null 2>&1;then else AUR_HELPER=yay fi -if $ask;then - # execute per element of the array $pkglist - for i in "${pkglist[@]}";do v $AUR_HELPER -S --needed $i;done +# Install extra packages from dependencies.conf as declared by the user +if (( ${#pkglist[@]} != 0 )); then + if $ask; then + # execute per element of the array $pkglist + for i in "${pkglist[@]}";do v $AUR_HELPER -S --needed $i;done + else + # execute for all elements of the array $pkglist in one line + v $AUR_HELPER -S --needed --noconfirm ${pkglist[*]} + fi +fi + +# Convert old dependencies to non explicit dependencies so that they can be orphaned if not in meta packages +set-explicit-to-implicit() { + remove_bashcomments_emptylines ./scriptdata/previous_dependencies.conf ./cache/old_deps_stripped.conf + readarray -t old_deps_list < ./cache/old_deps_stripped.conf + pacman -Qeq > ./cache/pacman_explicit_packages + readarray -t explicitly_installed < ./cache/pacman_explicit_packages + + echo "Attempting to set previously explicitly installed deps as implicit..." + for i in "${explicitly_installed[@]}"; do for j in "${old_deps_list[@]}"; do + [ "$i" = "$j" ] && $AUR_HELPER -D --asdeps "$i" + done; done + + return 0 +} + +$ask && echo "Attempt to set previously explicitly installed deps as implicit? " +$ask && showfun set-explicit-to-implicit +v set-explicit-to-implicit + + +# Install core dependencies from the meta-packages +metapkgs=(arch-packages/illogical-impulse-{audio,backlight,basic,fonts-themes,gnome,gtk,microtex,portal,python,screencapture,widgets}) +if $ask; then + # execute for every meta package + for i in "${metapkgs[@]}";do v $AUR_HELPER -Bi --needed --answerclean=n $i;done else - # execute for all elements of the array $pkglist in one line - v $AUR_HELPER -S --needed --noconfirm ${pkglist[*]} + # execute for all meta packages at once + v $AUR_HELPER -Bi --needed --answerclean=n --noconfirm ${metapkgs[@]} fi @@ -101,6 +135,18 @@ case $SKIP_HYPR_AUR in ;; esac +install-pymyc-aur() { + # Yay is bugged and destroys the PKGBUILD if you specify to cleanBuild with the -Bi flag, so we install the deps manually. + # If we install the deps using --asdeps we can remove them recursively by removing the metapackage. + installflags="-S --answerclean=a --asdeps" + $ask || installflags="$installflags --noconfirm" + $AUR_HELPER $installflags ${pymyc[@]} + + pushd arch-packages/illogical-impulse-pymyc-aur + makepkg -si + popd +} + # https://github.com/end-4/dots-hyprland/issues/428#issuecomment-2081690658 # https://github.com/end-4/dots-hyprland/issues/428#issuecomment-2081701482 # https://github.com/end-4/dots-hyprland/issues/428#issuecomment-2081707099 @@ -108,11 +154,8 @@ pymyc=(python-materialyoucolor-git gradience-git python-libsass python-material- case $SKIP_PYMYC_AUR in true) sleep 0;; *) - if $ask;then - v $AUR_HELPER -S --answerclean=a ${pymyc[@]} - else - v $AUR_HELPER -S --answerclean=a --noconfirm ${pymyc[@]} - fi + $ask && showfun install-pymyc-aur + v install-pymyc-aur ;; esac @@ -201,7 +244,7 @@ if $ask_MicroTeX;then showfun install-MicroTeX;v install-MicroTeX;fi printf "\e[36m[$0]: 3. Copying + Configuring\e[0m\n" # In case some folders does not exists -v mkdir -p "$HOME"/.{config,cache,local/{bin,share}} +v mkdir -p $XDG_BIN_HOME $XDG_CACHE_HOME $XDG_CONFIG_HOME $XDG_DATA_HOME # `--delete' for rsync to make sure that # original dotfiles and new ones in the SAME DIRECTORY @@ -212,10 +255,10 @@ case $SKIP_MISCCONF in true) sleep 0;; *) for i in $(find .config/ -mindepth 1 -maxdepth 1 ! -name 'ags' ! -name 'fish' ! -name 'hypr' -exec basename {} \;); do - i=".config/$i" - echo "[$0]: Found target: $i" - if [ -d "$i" ];then v rsync -av --delete "$i/" "$HOME/$i/" - elif [ -f "$i" ];then v rsync -av "$i" "$HOME/$i" +# i=".config/$i" + echo "[$0]: Found target: .config/$i" + if [ -d ".config/$i" ];then v rsync -av --delete ".config/$i/" "$XDG_CONFIG_HOME/$i/" + elif [ -f ".config/$i" ];then v rsync -av ".config/$i" "$XDG_CONFIG_HOME/$i" fi done ;; @@ -224,7 +267,7 @@ esac case $SKIP_FISH in true) sleep 0;; *) - v rsync -av --delete .config/fish/ "$HOME"/.config/fish/ + v rsync -av --delete .config/fish/ "$XDG_CONFIG_HOME"/fish/ ;; esac @@ -232,8 +275,8 @@ esac case $SKIP_AGS in true) sleep 0;; *) - v rsync -av --delete --exclude '/user_options.js' .config/ags/ "$HOME"/.config/ags/ - t="$HOME/.config/ags/user_options.js" + v rsync -av --delete --exclude '/user_options.js' .config/ags/ "$XDG_CONFIG_HOME"/ags/ + t="$XDG_CONFIG_HOME/ags/user_options.js" if [ -f $t ];then echo -e "\e[34m[$0]: \"$t\" already exists.\e[0m" # v cp -f .config/ags/user_options.js $t.new @@ -250,8 +293,8 @@ esac case $SKIP_HYPRLAND in true) sleep 0;; *) - v rsync -av --delete --exclude '/custom' --exclude '/hyprland.conf' .config/hypr/ "$HOME"/.config/hypr/ - t="$HOME/.config/hypr/hyprland.conf" + v rsync -av --delete --exclude '/custom' --exclude '/hyprland.conf' .config/hypr/ "$XDG_CONFIG_HOME"/hypr/ + t="$XDG_CONFIG_HOME/hypr/hyprland.conf" if [ -f $t ];then echo -e "\e[34m[$0]: \"$t\" already exists.\e[0m" v cp -f .config/hypr/hyprland.conf $t.new @@ -261,7 +304,7 @@ case $SKIP_HYPRLAND in v cp .config/hypr/hyprland.conf $t existed_hypr_conf=n fi - t="$HOME/.config/hypr/custom" + t="$XDG_CONFIG_HOME/hypr/custom" if [ -d $t ];then echo -e "\e[34m[$0]: \"$t\" already exists, will not do anything.\e[0m" else @@ -274,7 +317,7 @@ esac # some foldes (eg. .local/bin) should be processed separately to avoid `--delete' for rsync, # since the files here come from different places, not only about one program. -v rsync -av ".local/bin/" "$HOME/.local/bin/" +v rsync -av ".local/bin/" "$XDG_BIN_HOME" # Dark mode by default v gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' @@ -284,7 +327,7 @@ sleep 1 try hyprctl reload existed_zsh_conf=n -grep -q 'source ~/.config/zshrc.d/dots-hyprland.zsh' ~/.zshrc && existed_zsh_conf=y +grep -q 'source ${XDG_CONFIG_HOME:-~/.config}/zshrc.d/dots-hyprland.zsh' ~/.zshrc && existed_zsh_conf=y ##################################################################################### printf "\e[36m[$0]: Finished. See the \"Import Manually\" folder and grab anything you need.\e[0m\n" @@ -299,11 +342,11 @@ printf "\e[36mPress \e[30m\e[46m Super+/ \e[0m\e[36m for a list of keybinds\e[0m printf "\n" case $existed_ags_opt in - y) printf "\n\e[33m[$0]: Warning: \"~/.config/ags/user_options.js\" already existed before and we didn't overwrite it. \e[0m\n" -# printf "\e[33mPlease use \"~/.config/ags/user_options.js.new\" as a reference for a proper format.\e[0m\n" + y) printf "\n\e[33m[$0]: Warning: \"$XDG_CONFIG_HOME/ags/user_options.js\" already existed before and we didn't overwrite it. \e[0m\n" +# printf "\e[33mPlease use \"$XDG_CONFIG_HOME/ags/user_options.js.new\" as a reference for a proper format.\e[0m\n" ;;esac case $existed_hypr_conf in - y) printf "\n\e[33m[$0]: Warning: \"~/.config/hypr/hyprland.conf\" already existed before and we didn't overwrite it. \e[0m\n" - printf "\e[33mPlease use \"~/.config/hypr/hyprland.conf.new\" as a reference for a proper format.\e[0m\n" - printf "\e[33mIf this is your first time installation, you must overwrite \"~/.config/hypr/hyprland.conf\" with \"~/.config/hypr/hyprland.conf.new\".\e[0m\n" + y) printf "\n\e[33m[$0]: Warning: \"$XDG_CONFIG_HOME/hypr/hyprland.conf\" already existed before and we didn't overwrite it. \e[0m\n" + printf "\e[33mPlease use \"$XDG_CONFIG_HOME/hypr/hyprland.conf.new\" as a reference for a proper format.\e[0m\n" + printf "\e[33mIf this is your first time installation, you must overwrite \"$XDG_CONFIG_HOME/hypr/hyprland.conf\" with \"$XDG_CONFIG_HOME/hypr/hyprland.conf.new\".\e[0m\n" ;;esac diff --git a/scriptdata/dependencies.conf b/scriptdata/dependencies.conf index 167dcc2d8..6abf4ff94 100644 --- a/scriptdata/dependencies.conf +++ b/scriptdata/dependencies.conf @@ -1,40 +1,6 @@ ### This file supports bash-style comments, and blank lines. -### PKGs on same line will be send to `yay` together, unless `-f` is specified. +### PKGs on same line will be sent to `yay` together, unless `-f` is specified. -### Ones which need cleanbuild (see install.sh): -# hyprland-git -# python-materialyoucolor-git gradience-git python-libsass python-material-color-utilities +### Most dependencies have been moved to meta packages as declared in arch-packages. +### Use this file for declaring extra dependencies which you need but are not declared by default. -### Basic -axel bc coreutils cliphist cmake curl fuzzel rsync wget ripgrep gojq jq npm meson typescript gjs xdg-user-dirs - -# Make deps of MicroTeX -tinyxml2 gtkmm3 gtksourceviewmm cairomm - -### Python -# Add `python-setuptools-scm` and `python-wheel` explicitly to fix #197 -python-build python-pillow python-pywal python-setuptools-scm python-wheel - -### Basic graphic env -xdg-desktop-portal xdg-desktop-portal-gtk xdg-desktop-portal-hyprland-git - -### Player and Audio -pavucontrol wireplumber libdbusmenu-gtk3 playerctl swww - -### GTK -webp-pixbuf-loader gtk-layer-shell gtk3 gtksourceview3 gobject-introspection upower yad ydotool xdg-user-dirs-gtk - -### Gnome -polkit-gnome gnome-keyring gnome-control-center blueberry networkmanager gammastep gnome-bluetooth-3.0 - -### Backlight -brightnessctl ddcutil - -### Widgets -dart-sass python-pywayland python-psutil hypridle-git hyprlock-git wlogout wl-clipboard hyprpicker-git anyrun-git - -### Fonts and Themes -adw-gtk3-git qt5ct qt5-wayland fontconfig ttf-readex-pro ttf-jetbrains-mono-nerd ttf-material-symbols-variable-git ttf-space-mono-nerd fish foot starship - -### Screenshot and Recoder -swappy wf-recorder grim tesseract tesseract-data-eng slurp diff --git a/scriptdata/environment-variables b/scriptdata/environment-variables new file mode 100644 index 000000000..b2e752c62 --- /dev/null +++ b/scriptdata/environment-variables @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +XDG_BIN_HOME=${XDG_BIN_HOME:-$HOME/.local/bin} +XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache} +XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config} +XDG_DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share} +XDG_STATE_HOME=${XDG_STATE_HOME:-$HOME/.local/state} + diff --git a/scriptdata/previous_dependencies.conf b/scriptdata/previous_dependencies.conf new file mode 100644 index 000000000..103fe6eb6 --- /dev/null +++ b/scriptdata/previous_dependencies.conf @@ -0,0 +1,78 @@ +### This file contains a list of dependencies which were previously explicitly installed that are now installed using meta packages +### Must be one package per line as it needs to be compared against the explicitly installed list from pacman +axel +bc +coreutils +cliphist +cmake +curl +fuzzel +rsync +wget +ripgrep +gojq +npm +meson +typescript +gjs +xdg-user-dirs +tinyxml2 +gtkmm3 +gtksourceviewmm +cairomm +python-build +python-pillow +python-pywal +python-setuptools-scm +python-wheel +xdg-desktop-portal +xdg-desktop-portal-gtk +xdg-desktop-portal-hyprland-git +pavucontrol +wireplumber +libdbusmenu-gtk3 +playerctl +swww +webp-pixbuf-loader +gtk-layer-shell +gtk3 +gtksourceview3 +gobject-introspection +upower +yad +ydotool +xdg-user-dirs-gtk +polkit-gnome +gnome-keyring +gnome-control-center +blueberry +gammastep +gnome-bluetooth-3.0 +brightnessctl +ddcutil +dart-sass +python-pywayland +python-psutil +hypridle-git +hyprlock-git +wlogout +wl-clipboard +hyprpicker-git +anyrun-git +adw-gtk3-git +qt5ct +qt5-wayland +fontconfig +ttf-readex-pro +ttf-jetbrains-mono-nerd +ttf-material-symbols-variable-git +ttf-space-mono-nerd +fish +foot +starship +swappy +wf-recorder +grim +tesseract +tesseract-data-eng +slurp diff --git a/uninstall.sh b/uninstall.sh index d70d59570..c467f838d 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -1,5 +1,6 @@ #!/usr/bin/env bash cd "$(dirname "$0")" +source ./scriptdata/environment-variables function v() { echo -e "[$0]: \e[32mNow executing:\e[0m" @@ -11,8 +12,7 @@ printf 'Hi there!\n' printf 'This script 1. will uninstall [end-4/dots-hyprland > illogical-impulse] dotfiles\n' printf ' 2. will try to revert *mostly everything* installed using install.sh, so it'\''s pretty destructive\n' printf ' 3. has not been tested, use at your own risk.\n' -printf ' 4. assumes you have default xdg dirs (for example config folder in ~/.config).\n' -printf ' 5. will show all commands that it runs.\n' +printf ' 4. will show all commands that it runs.\n' printf 'Ctrl+C to exit. Enter to continue.\n' read -r set -e @@ -22,12 +22,12 @@ set -e printf '\e[36mRemoving copied config and local folders...\n\e[97m' for i in ags fish fontconfig foot fuzzel hypr mpv wlogout "starship.toml" rubyshot - do v rm -rf "$HOME/.config/$i" + do v rm -rf "$XDG_CONFIG_HOME/$i" done -v rm -rf "$HOME/.local/bin/fuzzel-emoji" -v rm -rf "$HOME/.cache/ags" -v sudo rm -rf "$HOME/.local/state/ags" +v rm -rf "$XDG_BIN_HOME/fuzzel-emoji" +v rm -rf "$XDG_CACHE_HOME/ags" +v sudo rm -rf "$XDG_STATE_HOME/ags" ############################################################################################################################## @@ -41,15 +41,15 @@ v sudo rm -rf "$HOME/.local/state/ags" # Undo Step 1: Remove added user from video, i2c, and input groups and remove yay packages printf '\e[36mRemoving user from video, i2c, and input groups and removing packages...\n\e[97m' user=$(whoami) -v sudo deluser "$user" video -v sudo deluser "$user" i2c -v sudo deluser "$user" input +v sudo gpasswd -d "$user" video +v sudo gpasswd -d "$user" i2c +v sudo gpasswd -d "$user" input v sudo rm /etc/modules-load.d/i2c-dev.conf ############################################################################################################################## read -p "Do you want to uninstall packages used by the dotfiles?\nCtrl+C to exit, or press Enter to proceed" # Removing installed yay packages and dependencies -v yay -Rns adw-gtk3-git brightnessctl cava ddcutil foot fuzzel gjs gojq gradience-git grim gtk-layer-shell hyprland-git lexend-fonts-git libdbusmenu-gtk3 plasma-browser-integration playerctl python-build python-material-color-utilities python-poetry python-pywal ripgrep sassc swww slurp starship swayidle hyprlock-git tesseract ttf-jetbrains-mono-nerd ttf-material-symbols-variable-git ttf-space-mono-nerd typescript webp-pixbuf-loader wl-clipboard wlogout yad ydotool +v yay -Rns hyprland-git illogical-impulse-{audio,backlight,basic,fonts-themes,gnome,gtk,microtex,portal,pymyc-aur,python,screencapture,widgets} plasma-browser-integration printf '\e[36mUninstall Complete.\n\e[97m' diff --git a/update-dots.sh b/update-dots.sh index edeeba126..743a03526 100644 --- a/update-dots.sh +++ b/update-dots.sh @@ -2,6 +2,8 @@ # This script updates the dotfiles by fetching the latest version from the Git repository and then replacing files # that have not been modified by the user to preserve changes. The remaining files will be replaced with the new ones. +source ./scriptdata/environment-variables + set -euo pipefail cd "$(dirname "$0")" export base="$(pwd)" @@ -16,7 +18,7 @@ MAGENTA="\033[0;35m" RESET="\033[0m" # Define paths to update -folders=(".config" ".local") +folders=(".config" ".local/bin" ".local/share" ".local/state") excludes=(".config/hypr/custom" ".config/ags/user_options.js" ".config/hypr/hyprland.conf") get_checksum() { @@ -36,6 +38,27 @@ file_in_excludes() { return 1 } +get_destination() { + # Get the correct destination of the file based on XDG base dirs + local file="$1" + local localdir="$(echo $file | cut -d/ -f1-2)" + local everything_else="$(echo $file | cut -d/ -f3-)" + # Check if path is config + if [ "$(echo $file | cut -d/ -f1)" = ".config" ]; then + printf "$XDG_CONFIG_HOME/$(echo $file | cut -d/ -f2-)" + + # Local directory + elif [ "$localdir" = ".local/bin" ]; then + printf "$XDG_BIN_HOME/$everything_else" + + # There are no files in either of the following right now, but putting it here just in case as .local was specified + elif [ "$localdir" = ".local/share" ]; then + printf "$XDG_DATA_HOME/$everything_else" + elif [ "$localdir" = ".local/state" ]; then + printf "$XDG_STATE_HOME/$everything_else" + fi +} + # Greetings! cat << 'EOF' ################################################################################################### @@ -80,14 +103,14 @@ modified_files=() # Find all files in the specified folders and their subfolders while IFS= read -r -d '' file; do # If the file is not in the home directory, skip it - if [[ ! -f "$HOME/$file" ]] || file_in_excludes "$file"; then + if [[ ! -f "$(get_destination $file)" ]] || file_in_excludes "$file"; then echo -e "${YELLOW}Skipping $file${RESET}" continue fi # Calculate checksums base_checksum=$(get_checksum "$base/$file") - home_checksum=$(get_checksum "$HOME/$file") + home_checksum=$(get_checksum "$(get_destination $file)") # Compare checksums and add to modified_files if necessary if [[ $base_checksum != $home_checksum ]]; then @@ -180,10 +203,10 @@ if ! git pull; then find "$temp_folder/$folder" -print0 | while IFS= read -r -d '' file; do file=${file//$temp_folder\//} if [[ -d "$temp_folder/$file" ]]; then - mkdir -p "$HOME/$file" + mkdir -p "$(get_destination $file)" fi if [[ -f "$temp_folder/$file" ]] && ! file_in_excludes "$file" && [[ ! " ${modified_files[*]} " =~ " $file " ]]; then - destination="$HOME/$file" + destination=$(get_destination $file) echo -e "${BLUE}Replacing $destination ...${RESET}" mkdir -p "$(dirname "$destination")" cp -f "$temp_folder/$file" "$destination" @@ -218,8 +241,9 @@ if ! git pull; then # Remove files for file in "${files_to_remove[@]}"; do echo -e "${YELLOW}Removing $file ...${RESET}" - if [[ -f "$HOME/$file" ]]; then - rm -rf "$HOME/$file" + homefile="$(get_destination $file)" + if [[ -f "$homefile" ]]; then + rm -rf "$homefile" fi done @@ -258,8 +282,9 @@ done # Remove files for file in "${files_to_remove[@]}"; do echo -e "${YELLOW}Removing $file ...${RESET}" - if [[ -f "$HOME/$file" ]]; then - rm -rf "$HOME/$file" + homefile=$(get_destination $file) + if [[ -f "$homefile" ]]; then + rm -rf "$homefile" fi done @@ -268,10 +293,10 @@ done for folder in "${folders[@]}"; do find "$folder" -print0 | while IFS= read -r -d '' file; do if [[ -d "$file" ]]; then - mkdir -p "$HOME/$file" + mkdir -p "$(get_destination $file)" fi if [[ -f "$file" ]] && ! file_in_excludes "$file" && [[ ! " ${modified_files[*]} " =~ " $file " ]]; then - destination="$HOME/$file" + destination="$(get_destination $file)" echo -e "${BLUE}Replacing \"$destination\" ...${RESET}" mkdir -p "$(dirname "$destination")" cp -f "$base/$file" "$destination"