Update fedora-niri-dms-setup.sh
This commit is contained in:
1 parent
54f4c46e97
commit
3283d80ab0
1 file changed
+107
-3
+107
-3
@@ -5,8 +5,8 @@
|
||||
# into a niri + DankMaterialShell desktop with the DMS greeter.
|
||||
#
|
||||
# Usage (as your normal user, NOT root):
|
||||
# chmod +x fedora-niri-dms-setup.sh
|
||||
# ./fedora-niri-dms-setup.sh
|
||||
# curl -fsSL https://gitea.schantli.ca/jschantli/fedora-niri-dms/raw/branch/main/fedora-niri-dms-setup.sh -o setup.sh
|
||||
# bash setup.sh
|
||||
#
|
||||
# Safe to re-run: every step checks before changing things.
|
||||
|
||||
@@ -281,7 +281,7 @@ dnf_install \
|
||||
xdg-desktop-portal-gnome xdg-desktop-portal-gtk \
|
||||
gnome-keyring gnome-keyring-pam \
|
||||
google-noto-sans-fonts google-noto-color-emoji-fonts \
|
||||
xdg-user-dirs flatpak
|
||||
xdg-user-dirs flatpak fastfetch
|
||||
|
||||
info "Auto-unlocking the keyring at login"
|
||||
sudo authselect enable-feature with-pam-gnome-keyring || warn "authselect failed; keyring may ask for a password at login"
|
||||
@@ -293,6 +293,110 @@ info "Adding Flathub"
|
||||
flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
|
||||
# ---------- 7b. Shell: zsh + plugins + Starship ------------------------------
|
||||
|
||||
step "Setting up zsh with autosuggestions, highlighting and Starship"
|
||||
dnf_install zsh zsh-autosuggestions zsh-syntax-highlighting \
|
||||
eza bat fzf zoxide fontconfig xz
|
||||
|
||||
if ! command -v starship >/dev/null; then
|
||||
if ! dnf_install starship 2>/dev/null; then
|
||||
info "Starship not in Fedora's repos, trying the atim/starship COPR"
|
||||
if ! { sudo dnf copr enable -y atim/starship && dnf_install starship; }; then
|
||||
info "COPR failed, using Starship's official installer"
|
||||
curl -fsSL https://starship.rs/install.sh | sudo sh -s -- -y -b /usr/local/bin \
|
||||
|| warn "Starship install failed; the prompt will fall back to zsh's default"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# JetBrains Mono Nerd Font, so Starship and eza icons render properly
|
||||
NF_DIR="$HOME/.local/share/fonts/JetBrainsMonoNerd"
|
||||
if [[ ! -d "$NF_DIR" ]]; then
|
||||
info "Installing JetBrains Mono Nerd Font"
|
||||
mkdir -p "$NF_DIR"
|
||||
if curl -fsSL https://github.com/ryanoasis/nerd-fonts/releases/latest/download/JetBrainsMono.tar.xz \
|
||||
| tar -xJ -C "$NF_DIR"; then
|
||||
fc-cache -f "$NF_DIR" >/dev/null
|
||||
else
|
||||
rm -rf "$NF_DIR"
|
||||
warn "Nerd Font download failed; icons may show as boxes"
|
||||
fi
|
||||
fi
|
||||
|
||||
# ~/.zshrc (managed by this script; put your own additions in ~/.zshrc.local)
|
||||
ZSHRC_MARK="# managed by fedora-niri-dms-setup"
|
||||
if [[ -f "$HOME/.zshrc" ]] && ! grep -qF "$ZSHRC_MARK" "$HOME/.zshrc"; then
|
||||
cp "$HOME/.zshrc" "$HOME/.zshrc.bak"
|
||||
info "Existing ~/.zshrc backed up to ~/.zshrc.bak"
|
||||
fi
|
||||
cat > "$HOME/.zshrc" <<'EOF'
|
||||
# managed by fedora-niri-dms-setup
|
||||
# Re-running the script overwrites this file. Put your own additions in ~/.zshrc.local
|
||||
|
||||
# ---- history ----
|
||||
HISTFILE=~/.zsh_history
|
||||
HISTSIZE=50000
|
||||
SAVEHIST=50000
|
||||
setopt SHARE_HISTORY HIST_IGNORE_ALL_DUPS HIST_IGNORE_SPACE
|
||||
setopt AUTO_CD INTERACTIVE_COMMENTS
|
||||
|
||||
# ---- completion ----
|
||||
autoload -Uz compinit && compinit
|
||||
zstyle ':completion:*' menu select
|
||||
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
|
||||
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
|
||||
|
||||
# ---- keys ----
|
||||
bindkey -e
|
||||
bindkey '^[[H' beginning-of-line
|
||||
bindkey '^[[F' end-of-line
|
||||
bindkey '^[[3~' delete-char
|
||||
bindkey '^[[1;5C' forward-word
|
||||
bindkey '^[[1;5D' backward-word
|
||||
# Up/Down search history for what you've already typed
|
||||
autoload -Uz up-line-or-beginning-search down-line-or-beginning-search
|
||||
zle -N up-line-or-beginning-search
|
||||
zle -N down-line-or-beginning-search
|
||||
bindkey '^[[A' up-line-or-beginning-search
|
||||
bindkey '^[[B' down-line-or-beginning-search
|
||||
|
||||
# ---- aliases ----
|
||||
if command -v eza >/dev/null; then
|
||||
alias ls='eza --icons --group-directories-first'
|
||||
alias ll='eza -lh --icons --git --group-directories-first'
|
||||
alias la='eza -lah --icons --git --group-directories-first'
|
||||
alias tree='eza --tree --icons'
|
||||
fi
|
||||
command -v bat >/dev/null && alias cat='bat --paging=never'
|
||||
|
||||
# ---- tools ----
|
||||
command -v fzf >/dev/null && source <(fzf --zsh) # Ctrl+R history, Ctrl+T files
|
||||
command -v zoxide >/dev/null && eval "$(zoxide init zsh)" # z <folder>
|
||||
command -v starship >/dev/null && eval "$(starship init zsh)"
|
||||
|
||||
# ---- plugins (syntax highlighting must load last) ----
|
||||
[[ -r /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh ]] && \
|
||||
source /usr/share/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
[[ -r ~/.zshrc.local ]] && source ~/.zshrc.local
|
||||
[[ -r /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh ]] && \
|
||||
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||
|
||||
# ---- greeting ----
|
||||
command -v fastfetch >/dev/null && fastfetch
|
||||
EOF
|
||||
touch "$HOME/.zshrc.local"
|
||||
|
||||
if [[ "$(getent passwd "$USER" | cut -d: -f7)" != */zsh ]]; then
|
||||
sudo usermod --shell "$(command -v zsh)" "$USER"
|
||||
info "Default shell changed to zsh"
|
||||
fi
|
||||
|
||||
info "Setting Ptyxis to use the Nerd Font"
|
||||
gsettings set org.gnome.Ptyxis use-system-font false 2>/dev/null \
|
||||
&& gsettings set org.gnome.Ptyxis font-name 'JetBrainsMono Nerd Font 11' 2>/dev/null \
|
||||
|| warn "Couldn't set the Ptyxis font now; pick 'JetBrainsMono Nerd Font' in Ptyxis preferences"
|
||||
|
||||
# ---------- 8. Login screen --------------------------------------------------
|
||||
|
||||
step "Installing the DMS greeter"
|
||||
|
||||
Reference in new issue
Block a user