diff --git a/dotfiles/zellij/config.kdl b/dotfiles/zellij/config.kdl index 32341e4..711faf4 100644 --- a/dotfiles/zellij/config.kdl +++ b/dotfiles/zellij/config.kdl @@ -4,6 +4,7 @@ keybinds { // uncomment this and adjust key if using copy_on_select=false // bind "Alt c" { Copy; } } + locked { bind "Ctrl g" { SwitchToMode "Normal"; } } @@ -141,6 +142,22 @@ keybinds { bind "Alt k" "Alt Up" { MoveFocus "Up"; } bind "Alt =" "Alt +" { Resize "Increase"; } bind "Alt -" { Resize "Decrease"; } + + bind "Alt m" { + LaunchPlugin "file:~/.config/zellij/plugins/monocle.wasm" { + in_place true; + kiosk true; + }; + SwitchToMode "Normal"; + } + + bind "Alt f" { + LaunchPlugin "filepicker" { + // floating true // uncomment this to have the filepicker opened in a floating window + // close_on_selection true // comment this out to have the filepicker remain open even after selecting a file + }; + } + } shared_except "normal" "locked" { bind "Enter" "Esc" { SwitchToMode "Normal"; } diff --git a/dotfiles/zellij/layouts/default.kdl b/dotfiles/zellij/layouts/default.kdl index 71520f9..de6a076 100644 --- a/dotfiles/zellij/layouts/default.kdl +++ b/dotfiles/zellij/layouts/default.kdl @@ -9,14 +9,21 @@ layout { } } - tab name="keeper" { + tab name="ssh" { pane split_direction="vertical" { pane borderless=false command="keeper" { - args "ssh-agent start" + args "ssh-agent start" } } } - + tab name="IDE" { + pane split_direction="vertical" { + pane size="20%" { + plugin location="zellij:strider" + } + pane + } + } tab name="Main" { pane split_direction="vertical" { pane @@ -32,4 +39,4 @@ layout { pane } } -} \ No newline at end of file +} diff --git a/install/install.sh b/install/install.sh index 39bc2e9..1d975d3 100755 --- a/install/install.sh +++ b/install/install.sh @@ -1,59 +1,97 @@ #!/bin/bash -set -eu +set -euo pipefail -#Install dep -echo '[*] Install apt requierements ...' +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +DOTFILES_DIR="$SCRIPT_DIR/../dotfiles" + +log() { echo "[*] $*"; } +err() { echo "Erreur: $*" >&2; } + +# usage: stow_config +# Si le répertoire cible existe déjà, on ne touche à rien (idempotence +# non-destructive) : on suppose que la config est déjà en place. +stow_config() { + local package="$1" + local target="$2" + + if [ -e "$target" ]; then + log "Config déjà présente ($target), on ne touche à rien. Skip." + return + fi + + mkdir -p "$target" + + log "Stow du package '$package' vers $target ..." + (cd "$DOTFILES_DIR" && stow -vSt "$target" "$package") +} + +# --- 1. Dépendances système --- +log "Mise à jour des paquets apt ..." +sudo apt update + +log "Installation des dépendances apt ..." sudo apt -y install apt-transport-https curl gnupg stow zsh -# test if rust is installed -if ! [ -x "$(command -v cargo)" ]; then - echo 'Error: cargo is not installed.' - echo '[*] Install rust ...' - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +# --- 2. Rust / cargo --- +if ! command -v cargo >/dev/null 2>&1; then + log "cargo introuvable, installation de rustup ..." + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y fi -#Install Zellij -echo '[*] Install zellij' -cargo install zellij +if [ -f "$HOME/.cargo/env" ]; then + # shellcheck disable=SC1091 + source "$HOME/.cargo/env" +fi -echo '[*] Removing default configurations ...' -rm -rf ~/.config/zellij +if ! command -v cargo >/dev/null 2>&1; then + err "cargo toujours introuvable après installation, abandon." + exit 1 +fi -echo '[*] Creating plugin directory' -mkdir ~/.config/zellij +# --- 3. Zellij + sa config --- +log "Installation de zellij ..." +cargo install --locked zellij -echo '[*] Stowing/Creating simlinks for zellij' -cd ../dotfiles && stow -vSt ~/.config/zellij zellij && cd ../install +stow_config "zellij" "$HOME/.config/zellij" +# --- 4. Zsh perso --- +# Le fichier reste nommé "zshrc.perso" (sans point) dans le dépôt dotfiles, +# mais on veut un symlink caché ~/.zshrc.perso. stow ne permet pas ce +# renommage nativement (sauf convention "dot-" qu'on ne veut pas imposer +# au dépôt), donc on crée le symlink manuellement. +ZSHRC_PERSO_SRC="$DOTFILES_DIR/zsh/zshrc.perso" +ZSHRC_PERSO_DEST="$HOME/.zshrc.perso" -#Zsh Perso -echo '[*] Stowing/Creating simlinks for zellij' -cd ../dotfiles && stow -vSt ~/.zshrc.perso zshrc.perso && cd ../install +if [ -e "$ZSHRC_PERSO_DEST" ] || [ -L "$ZSHRC_PERSO_DEST" ]; then + log "$ZSHRC_PERSO_DEST existe déjà, on ne touche à rien. Skip." +else + if [ ! -f "$ZSHRC_PERSO_SRC" ]; then + err "Fichier source introuvable : $ZSHRC_PERSO_SRC" + exit 1 + fi + log "Création du symlink $ZSHRC_PERSO_DEST -> $ZSHRC_PERSO_SRC ..." + ln -s "$ZSHRC_PERSO_SRC" "$ZSHRC_PERSO_DEST" +fi -#Install Spaceship a zsh module -mkdir -p "$HOME/.zsh" -rm -rf "$HOME/.zsh/spaceship" -git clone --depth=1 https://github.com/spaceship-prompt/spaceship-prompt.git "$HOME/.zsh/spaceship" +# --- 5. Spaceship (prompt zsh) --- +SPACESHIP_DIR="$HOME/.zsh/spaceship-prompt" -echo '[*] Removing default configurations ...' -rm -rf ~/.config/spaceship +if [ -d "$SPACESHIP_DIR/.git" ]; then + log "Spaceship (upstream) déjà présent, mise à jour ..." + git -C "$SPACESHIP_DIR" pull --ff-only +elif [ -e "$SPACESHIP_DIR" ]; then + log "$SPACESHIP_DIR existe mais n'est pas un dépôt git, on ne touche à rien. Skip." +else + log "Installation de spaceship (clone upstream) ..." + mkdir -p "$HOME/.zsh" + git clone --depth=1 https://github.com/spaceship-prompt/spaceship-prompt.git "$SPACESHIP_DIR" +fi -echo '[*] Creating plugin directory' -mkdir ~/.config/spaceship +stow_config "spaceship" "$HOME/.config/spaceship" -echo '[*] Stowing/Creating simlinks for spaceship' -cd ../dotfiles && stow -vSt ~/.config/spaceship spaceship && cd ../install +# --- 6. Outils Rust additionnels --- +log "Installation des outils Rust (bat, bottom, diskus, procs, cargo-update) ..." +cargo install --locked bat bottom diskus procs cargo-update -##Installation de programme rust -# Rust cool stuff -echo '[*] Install bat' -cargo install bat -echo '[*] Install bottom' -cargo install bottom -echo '[*] Install diskus' -cargo install diskus -echo '[*] Install procs' -cargo install procs -echo '[*] Install cargo-update' -cargo install cargo-update +log "Installation terminée avec succès."