diff --git a/setup.sh b/setup.sh index bbb4cd9..fe84e0e 100755 --- a/setup.sh +++ b/setup.sh @@ -23,12 +23,11 @@ set -e function pkg_inst () { log "Checking if $1 is installed..." - IS_INSTALLED=$(pacman -Q | grep $1) - if [[ -z "$IS_INSTALLED" ]]; then + if pacman -Qs $1; then + log "Found $IS_INSTALLED ...skipping" + else log "$1 not found. Installing..." paru -S $1 2>&1 | tee -a $LOG - else - log "Found $IS_INSTALLED ...skipping" fi } @@ -66,16 +65,16 @@ function inst_configs { if [[ $confirm_configs == "Y" ]]; then - cp -Rf $MOONARCH_DIR/home/config/alacritty $HOME/.config/alacritty + cp -Rf $MONARCHOS_DIR/home/config/alacritty $HOME/.config/alacritty chown $USER:$USER $HOME/.config/alacritty - cp -Rf $MOONARCH_DIR/home/config/dunst $HOME/.config/dunst + cp -Rf $MONARCHOS_DIR/home/config/dunst $HOME/.config/dunst chown $USER:$USER $HOME/.config/dunst - cp -Rf $MOONARCH_DIR/home/config/btop $HOME/.config/btop + cp -Rf $MONARCHOS_DIR/home/config/btop $HOME/.config/btop chown $USER:$USER $HOME/.config/btop - cp -Rf $MOONARCH_DIR/home/config/lsd $HOME/.config/lsd + cp -Rf $MONARCHOS_DIR/home/config/lsd $HOME/.config/lsd chown $USER:$USER $HOME/.config/lsd fi @@ -95,10 +94,13 @@ function inst_zsh { pkg_inst $key done - sudo install -C $MOONARCH_DIR/home/.zshrc $HOME/.zshrc + sudo install -C $MONARCHOS_DIR/home/.zshrc $HOME/.zshrc + rm -rf ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting + rm -rf ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k + rm -rf ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k chsh -s /usr/bin/zsh fi } @@ -113,14 +115,14 @@ function inst_basic_pkgs { if [[ $confirm_basics == "Y" ]]; then - declare -a pkg_list=(jq dunst network-manager-applet alarm-clock-applet man-db hardinfo networkmanager-openvpn udisks2 plocate vim alacritty gettext-hostname neovim lsd alsa-utils ponymix btop powertop polkit lxsession timeshift timeshift-autosnap pcmanfm librewolf) + declare -a pkg_list=(jq dunst network-manager-applet alarm-clock-applet man-db hardinfo networkmanager-openvpn udisks2 plocate vim alacritty gettext-hostname neovim lsd alsa-utils ponymix btop powertop polkit lxsession timeshift timeshift-autosnap pcmanfm librewolf-bin) for key in "${pkg_list[@]}" do pkg_inst $key done - cp $MOONARCH_DIR/usr/local/bin/volnote /usr/local/bin + sudo cp $MONARCHOS_DIR/usr/local/bin/volnote /usr/local/bin paru -S informant sudo informant read --all @@ -133,7 +135,9 @@ function inst_paru { echo "Installing AUR helper ${BOLD}paru${NORMAL}?" echo "${BOLD}paru${NORMAL} is mandatory." - if ! type paru > /dev/null; then + if command -v paru > /dev/null 2>&1; then + echo "${BOLD}paru ${NORMAL}already installed. Skipping..." + else echo -n "${BOLD}Continue?${NORMAL} (Y/N) " read confirm_paru 2>&1 | tee -a $LOG if [[ $confirm_paru == "Y" ]]; @@ -141,12 +145,14 @@ function inst_paru { sudo pacman -Syu --needed base-devel 2>&1 | tee -a $LOG sudo pacman -Syu rustup 2>&1 | tee -a $LOG rustup default stable 2>&1 | tee -a $LOG + rustup update - mkdir $MOONARCH_DIR/.cache - git clone https://aur.archlinux.org/paru.git $MOONARCH_DIR/.cache/paru-git - cd $MOONARCH_DIR/.cache/paru-git + mkdir $MONARCHOS_DIR/.cache + rm -rf $MONARCHOS_DIR/.cache/paru-git + git clone https://aur.archlinux.org/paru.git $MONARCHOS_DIR/.cache/paru-git + cd $MONARCHOS_DIR/.cache/paru-git makepkg -si - cd $MOONARCH_DIR + cd $MONARCHOS_DIR git pull @@ -157,9 +163,6 @@ function inst_paru { echo "exiting" exit 1 fi - - else - echo "${BOLD}paru ${NORMAL}already installed. Skipping..." fi } @@ -219,7 +222,7 @@ function inst_noise_supr { done mkdir -p $HOME/.config/pipewire/pipewire.conf.d/ - cp -f $MOONARCH_DIR/home/config/pipewire/pipewire.conf.d/99-input-denoising.conf $HOME/.config/pipewire/pipewire.conf.d/99-input-denoising.conf + cp -f $MONARCHOS_DIR/home/config/pipewire/pipewire.conf.d/99-input-denoising.conf $HOME/.config/pipewire/pipewire.conf.d/99-input-denoising.conf systemctl restart --user pipewire.service fi @@ -283,20 +286,20 @@ function set_gui { read confirm_gui if [[ $confirm_gui == "Y" ]]; then - declare -a pkg_list=(celluloid playerctl audacious font-manager viewnior thunar tumbler ffmpegthumbnailer pavucontrol viewnior ttf-hack-nerd ttf-joypixels sweet-cursor-theme-git catppuccin-gtk-theme-mocha flatery-icon-theme-git) + declare -a pkg_list=(celluloid playerctl audacious font-manager viewnior tumbler ffmpegthumbnailer pavucontrol viewnior ttf-hack-nerd ttf-joypixels sweet-cursor-theme-git catppuccin-gtk-theme-mocha flatery-icon-theme-git) for key in "${pkg_list[@]}" do pkg_inst $key done - cp -Rf $MOONARCH_DIR/home/config/gtk-3.0 $HOME/.config/gtk-3.0 + cp -Rf $MONARCHOS_DIR/home/config/gtk-3.0 $HOME/.config/gtk-3.0 chown $USER:$USER $HOME/.config/gtk-3.0 - cp -Rf $MOONARCH_DIR/home/config/gtk-4.0 $HOME/.config/gtk-4.0 + cp -Rf $MONARCHOS_DIR/home/config/gtk-4.0 $HOME/.config/gtk-4.0 chown $USER:$USER $HOME/.config/gtk-4.0 - install $MOONARCH_DIR/home/config/gtk-3.0/settings.ini $HOME/.config/gtk-3.0/settings.ini - install $MOONARCH_DIR/home/config/gtk-4.0/settings.ini $HOME/.config/gtk-4.0/settings.ini + install $MONARCHOS_DIR/home/config/gtk-3.0/settings.ini $HOME/.config/gtk-3.0/settings.ini + install $MONARCHOS_DIR/home/config/gtk-4.0/settings.ini $HOME/.config/gtk-4.0/settings.ini gsettings set org.gnome.desktop.interface gtk-theme "Catppuccin-Mocha-Standard-Lavender-Dark" gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark' @@ -304,16 +307,16 @@ function set_gui { gsettings set org.cinnamon.desktop.default-applications.terminal exec alacritty sudo mkdir -p /usr/local/share/fonts/ - sudo install -C $MOONARCH_DIR/usr/local/share/fonts/MonarchOS.ttf /usr/local/share/fonts/MonarchOS.ttf - sudo install -C $MOONARCH_DIR/usr/local/share/fonts/Icomoon-Feather.ttf /usr/local/share/fonts/Icomoon-Feather.ttf - sudo install -C $MOONARCH_DIR/etc/fonts/local.conf /etc/fonts/local.conf + sudo install -C $MONARCHOS_DIR/usr/local/share/fonts/MonarchOS.ttf /usr/local/share/fonts/MonarchOS.ttf + sudo install -C $MONARCHOS_DIR/usr/local/share/fonts/Icomoon-Feather.ttf /usr/local/share/fonts/Icomoon-Feather.ttf + sudo install -C $MONARCHOS_DIR/etc/fonts/local.conf /etc/fonts/local.conf fc-cache -f WALLPAPER_DIR=$HOME/Pictures/Wallpaper if [ ! -d "$WALLPAPER_DIR" ]; then mkdir -p $WALLPAPER_DIR fi - install -C $MOONARCH_DIR/home/Pictures/Wallpaper/MonarchOS.png $WALLPAPER_DIR/MonarchOS.png + install -C $MONARCHOS_DIR/home/Pictures/Wallpaper/MonarchOS.png $WALLPAPER_DIR/MonarchOS.png fi } @@ -330,7 +333,7 @@ function inst_rofi { pkg_inst $key done - cp -Rf $MOONARCH_DIR/home/config/rofi $HOME/.config/rofi + cp -Rf $MONARCHOS_DIR/home/config/rofi $HOME/.config/rofi chown $USER:$USER $HOME/.config/rofi fi } @@ -372,7 +375,7 @@ function inst_screenshot { pkg_inst $key done - cp -f $MOONARCH_DIR/usr/local/bin/hyprm-screenshot /usr/local/bin/ + sudo cp -f $MONARCHOS_DIR/usr/local/bin/hyprm-screenshot /usr/local/bin/ fi } @@ -383,27 +386,36 @@ function inst_hypr { read confirm_hypr if [[ $confirm_hypr == "Y" ]]; then - declare -a pkg_list=(wayland xorg-xwayland hyprland-git hypridle hyprlock hyprcursor-git hyprkeys hyprpicker swww waypaper-git xdg-desktop-portal-hyprland wdisplays waybar nwg-look cliphist wlogout) + declare -a pkg_list=(wayland xorg-xwayland hyprland-git hypridle hyprlock hyprcursor-git hyprkeys hyprpicker swww waypaper-git xdg-desktop-portal-hyprland wdisplays waybar nwg-look cliphist wlogout swayosd-git hyprlock) for key in "${pkg_list[@]}" do pkg_inst $key done - sudo cp -Rf $MOONARCH_DIR/etc/wlogout /etc/ + sudo cp -Rf $MONARCHOS_DIR/etc/wlogout /etc/ - cp -Rf $MOONARCH_DIR/home/config/hypr $HOME/.config/hypr + cp -Rf $MONARCHOS_DIR/home/config/hypr $HOME/.config/hypr chown $USER:$USER $HOME/.config/hypr - cp -Rf $MOONARCH_DIR/home/config/waybar $HOME/.config/waybar + cp -Rf $MONARCHOS_DIR/home/config/waybar $HOME/.config/waybar chown $USER:$USER $HOME/.config/waybar - cp -Rf $MOONARCH_DIR/home/config/swaylock $HOME/.config/swaylock - chown $USER:$USER $HOME/.config/swaylock - hyprctl setcursor Sweet-cursors 16 + if [ -z "$HYPRLAND_INSTANCE_SIGNATURE" ] + then + log "Hyprland not running, can't set cursor" + else + hyprctl setcursor Sweet-cursors 16 + fi - cp -Rf $MOONARCH_DIR/home/config/waypaper $HOME/.config/waypaper + cp -Rf $MONARCHOS_DIR/home/config/waypaper $HOME/.config/waypaper chown -R $USER:$USER $HOME/.config/waypaper sed -i "s|USERNAME|${USER}|g" $HOME/.config/waypaper/config.ini - swww img $WALLPAPER_DIR/MonarchOS.png + if [ -z "$HYPRLAND_INSTANCE_SIGNATURE" ] + then + log "Hyprland not running, can't set wallpaper" + else + swww-daemon & + swww img $WALLPAPER_DIR/MonarchOS.png + fi fi } @@ -420,16 +432,16 @@ function inst_bspwm { pkg_inst $key done - cp -Rf $MOONARCH_DIR/home/config/bspwm $HOME/.config/bspwm + cp -Rf $MONARCHOS_DIR/home/config/bspwm $HOME/.config/bspwm chown $USER:$USER $HOME/.config/bspwm - cp -Rf $MOONARCH_DIR/home/config/sxhkd $HOME/.config/sxhkd + cp -Rf $MONARCHOS_DIR/home/config/sxhkd $HOME/.config/sxhkd chown $USER:$USER $HOME/.config/sxhkd - cp -Rf $MOONARCH_DIR/home/config/picom $HOME/.config/picom + cp -Rf $MONARCHOS_DIR/home/config/picom $HOME/.config/picom chown $USER:$USER $HOME/.config/picom - cp -Rf $MOONARCH_DIR/home/config/polybar $HOME/.config/polybar + cp -Rf $MONARCHOS_DIR/home/config/polybar $HOME/.config/polybar chown $USER:$USER $HOME/.config/polybar fi } @@ -447,7 +459,7 @@ function inst_conky { pkg_inst $key done - cp -Rf $MOONARCH_DIR/home/config/conky $HOME/.config/conky + cp -Rf $MONARCHOS_DIR/home/config/conky $HOME/.config/conky chown $USER:$USER $HOME/.config/conkys fi } @@ -465,18 +477,21 @@ function inst_sddm { pkg_inst $key done - printf "clear package cache" + log "REMEMBER: this will fail if you don't disable any other display manager before" + + log "clear package cache" rm -rf $HOME/.cache/Elegant-sddm-monarch - printf "clone sddm theme" + log "clone sddm theme" git clone https://gitea.nevaforget.de/dom/Elegant-sddm-monarch/ $HOME/.cache/Elegant-sddm-monarch - printf "copy sddm theme to destination" + log "copy sddm theme to destination" sudo cp -rf $HOME/.cache/Elegant-sddm-monarch/Elegant /usr/share/sddm/themes/monarch - printf "set current sddm theme" + log "set current sddm theme" + sudo cp -rf /usr/lib/sddm/sddm.conf.d/default.conf /etc/sddm.conf sudo sed -i "s/^Current=.*/Current=monarch/g" /etc/sddm.conf - printf "set default user image" - sudo cp -f $MOONARCH_DIR/usr/share/sddm/faces/.face /usr/share/sddm/faces/.face - cp -f $MOONARCH_DIR/usr/share/sddm/faces/.face $HOME/.face + log "set default user image" + sudo cp -f $MONARCHOS_DIR/usr/share/sddm/faces/.face /usr/share/sddm/faces/.face + cp -f $MONARCHOS_DIR/usr/share/sddm/faces/.face $HOME/.face sudo systemctl enable sddm fi