nirish

config files for niri window manager
Log | Files | Refs | README | LICENSE

setup.sh (4152B)


      1 #!/usr/bin/env bash
      2 RED="\e[31m"
      3 GREEN="\e[32m"
      4 BLUE="\e[34m"
      5 RESET="\e[0m"
      6 msg() {
      7   case "$1" in
      8   error)
      9     printf '%s\n' "${RED}[ERROR]:${RESET} $2"
     10     ;;
     11   success)
     12     printf '%s\n' "${GREEN}[SUCCESS]:${RESET} $2"
     13     ;;
     14   debug)
     15     printf '%s\n' "${BLUE}[DEBUG]:${RESET} $2"
     16     ;;
     17   esac
     18 }
     19 
     20 package_list=(
     21   # Core
     22   "base-devel"
     23   "sof-firmware"
     24   "networkmanager"
     25   "git"
     26   "stow"
     27   # Fonts
     28   "noto-fonts"
     29   "noto-fonts-cjk"
     30   "noto-fonts-emoji"
     31   "ttf-jetbrains-mono-nerd"
     32   "terminus-font"
     33   # Desktop utilities
     34   "rofi"
     35   "rofimoji"
     36   "kitty"
     37   "pcmanfm"
     38   "librewolf"
     39   "satty"
     40   "slurp"
     41   "grim"
     42   "brightnessctl"
     43   "swww"
     44   "zathura"
     45   "zathura-pdf-mupdf"
     46   "adw-gtk-theme"
     47   "cliphist"
     48   "gum"
     49   "fzf"
     50   "imv"
     51   "libappindicator"
     52   "nwg-look"
     53   "mako"
     54   "wl-clipboard"
     55   "swaylock-effects"
     56   "swayidle"
     57   # System utilities
     58   "xdg-user-dirs"
     59   "xdg-utils"
     60   "xdg-desktop-portal-gtk"
     61   "qt6-wayland"
     62   "qt5-wayland"
     63   "rsync"
     64   "shellcheck"
     65   "ripgrep"
     66   "npm"
     67   "man-db"
     68   # Multimedia
     69   "mpv"
     70   "ffmpeg"
     71   "v4l-utils"
     72   "pipewire"
     73   "pipewire-pulse"
     74   "pipewire-jack"
     75   "wireplumber"
     76   "pipewire-alsa"
     77   # Security
     78   "ufw"
     79   "wireguard-tools"
     80   # GPU/Drivers
     81   "vulkan-intel"
     82   "intel-media-driver"
     83   "intel-ucode"
     84   # Development
     85   "neovim"
     86   "lazygit"
     87   "fastfetch"
     88   "fd"
     89   "eza"
     90   "bat"
     91   "btop"
     92   "age"
     93   "jq"
     94   "gnome-themes-extra"
     95   "7zip"
     96 )
     97 sudo pacman -Sy --needed --noconfirm "${package_list[@]}"
     98 
     99 if [ ! -d "$HOME/.config/niri" ]; then
    100   stow -t ~/.config/niri niri
    101 else
    102   msg error "Directory niri doesn't exist."
    103   read -r -p "Make directory? (y/n) " dir_make
    104   select dir_make in "y" "n"; do
    105     if [ "$dir_make" == "y" ]; then
    106       mkdir "$HOME/.config/niri"
    107       stow -t ~/.config/niri niri
    108       msg success "Created directory niri and stowed files"
    109     fi
    110   done
    111 fi
    112 
    113 select qs_shell in "noctalia" "dms (Dank Material Shell)" "none"; do
    114   if [ "$qs_shell" == "noctalia" ]; then
    115     systemctl --user add-wants niri.service noctalia.service
    116     systemctl --user enable noctalia.service
    117     break
    118   elif [ "$qs_shell" == "dms (Dank Material Shell)" ]; then
    119     systemctl --user enable dms
    120     systemctl --user start dms
    121     break
    122   elif [ "$qs_shell" == "none" ]; then
    123     break
    124   fi
    125 done
    126 
    127 # Bash scripts git repo
    128 msg info "Cloning bash-utils repo"
    129 git clone https://github.com/ryukamish/bash-utils.git ~/.local/bin
    130 
    131 msg info "Updating mime database"
    132 update-mime-database ~/.local/share/applications
    133 # Mimetype default settings
    134 msg info "Setting default mime types"
    135 xdg-mime default librewolf.desktop x-scheme-handler/http
    136 xdg-mime default librewolf.desktop x-scheme-handler/https
    137 # pdf reader
    138 xdg-mime default zathura.desktop application/pdf
    139 # image viewer
    140 xdg-mime default imv.desktop image/png
    141 xdg-mime default imv.desktop image/jpeg
    142 xdg-mime default imv.desktop image/gif
    143 xdg-mime default imv.desktop image/webp
    144 xdg-mime default imv.desktop image/bmp
    145 xdg-mime default imv.desktop image/tiff
    146 # video player
    147 xdg-mime default mpv.desktop video/mp4
    148 xdg-mime default mpv.desktop video/x-msvideo
    149 xdg-mime default mpv.desktop video/x-matroska
    150 xdg-mime default mpv.desktop video/x-flv
    151 xdg-mime default mpv.desktop video/x-ms-wmv
    152 xdg-mime default mpv.desktop video/mpeg
    153 xdg-mime default mpv.desktop video/webm
    154 xdg-mime default mpv.desktop video/quicktime
    155 xdg-mime default mpv.desktop video/3gpp
    156 xdg-mime default mpv.desktop video/3gpp2
    157 xdg-mime default mpv.desktop video/x-ms-asf
    158 xdg-mime default mpv.desktop video/x-ogm+ogg
    159 xdg-mime default mpv.desktop video/x-theora+ogg
    160 xdg-mime default mpv.desktop application/ogg
    161 
    162 # Start niri without a display manager
    163 shell_chk=$(which "$SHELL")
    164 start_niri(){
    165 	tee -a "$1" <<EOF
    166 if [ -z "$DISPLAY" ] && [ "$(tty)" = "/dev/tty1" ] && [ -z "$NIRI_LOADED" ]; then
    167 	export NIRI_LOADED=1
    168 	exec niri-session
    169 fi
    170 EOF
    171 }
    172 
    173 case "$shell_chk" in
    174     *bash*)
    175         if [ -f "$HOME/.bash_profile" ]; then
    176 			start_niri "$HOME/.bash_profile"
    177 		else
    178 			touch "$HOME/.bash_profile" && start_niri "$HOME/.bash_profile"
    179 		fi
    180         ;;
    181     *zsh*)
    182 		if [ -f "$HOME/.zshrc" ]; then
    183 			start_niri "$HOME/.zprofile"
    184 		else
    185 			touch "$HOME/.zprofile" && start_niri "$HOME/.zprofile"
    186 		fi
    187         ;;
    188 esac