Compare commits

...

2 Commits

Author SHA1 Message Date
Amir Alexander Abdelbaki f453b1d3d3 feat(desktopenvs): add hyprland → hyprlua migration script
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 10:22:56 +02:00
Amir Alexander Abdelbaki 851a64d7f3 chore(nvim): untrack lazy-lock.json and add it to gitignore
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 09:07:17 +02:00
3 changed files with 168 additions and 28 deletions

3
.gitignore vendored
View File

@ -24,6 +24,9 @@ yazi/*.toml-*
readme.html
docs/html/
# Plugin lockfiles (auto-generated, not meant for version control)
lazy-lock.json
# Build/image output artifacts
*.iso
*.img

View File

@ -0,0 +1,165 @@
#!/usr/bin/env bash
# migrate-hyprland-to-hyprlua — switch an existing hyprland install to hyprlua
#
# Packages are identical between the two environments; this script only
# swaps configs. Run it from inside (or outside) a live Hyprland session.
# If run from inside, Hyprland is reloaded automatically at the end.
#
# Usage:
# ./migrate-hyprland-to-hyprlua.sh # interactive
# ./migrate-hyprland-to-hyprlua.sh --dry-run # preview only, no changes
set -euo pipefail
DOTFILES="${DOTFILES:-$HOME/Dotfiles}"
SRC="$DOTFILES/desktopenvs/hyprlua"
TARGET="${XDG_CONFIG_HOME:-$HOME/.config}"
BACKUP_DIR="$HOME/.config-hyprland-backup-$(date +%Y%m%d-%H%M%S)"
DRY_RUN=0
RED='\033[0;31m'; YEL='\033[1;33m'; GRN='\033[0;32m'; DIM='\033[2m'; RST='\033[0m'
err() { printf "${RED}✖ %s${RST}\n" "$*" >&2; }
warn() { printf "${YEL}⚠ %s${RST}\n" "$*"; }
ok() { printf "${GRN}✔ %s${RST}\n" "$*"; }
note() { printf "${DIM} %s${RST}\n" "$*"; }
die() { err "$*"; exit 1; }
run() {
if (( DRY_RUN )); then
printf "${DIM} [dry] %s${RST}\n" "$*"
else
eval "$@"
fi
}
# ── args ──────────────────────────────────────────────────────────────────────
for arg in "$@"; do
case "$arg" in
--dry-run|-n) DRY_RUN=1 ;;
--help|-h)
echo "Usage: $0 [--dry-run]"
echo " --dry-run Preview changes without applying them."
exit 0 ;;
*) die "Unknown argument: $arg" ;;
esac
done
# ── preflight ─────────────────────────────────────────────────────────────────
[[ -d "$SRC" ]] || die "hyprlua source not found: $SRC"
[[ -d "$DOTFILES" ]] || die "Dotfiles directory not found: $DOTFILES"
if [[ -f "$TARGET/hypr/hyprland.lua" ]] && [[ ! -f "$TARGET/hypr/hyprland.conf" ]]; then
warn "Already on hyprlua (hyprland.lua found, no hyprland.conf). Nothing to do."
exit 0
fi
(( DRY_RUN )) && warn "Dry-run mode — no files will be modified."
printf '\n'
note "Source : $SRC"
note "Target : $TARGET"
note "Backup : $BACKUP_DIR"
printf '\n'
# ── backup ────────────────────────────────────────────────────────────────────
# Save the hypr-usr .conf files that will be removed from ~/.config/
HYPR_USR_CONFS=(autostart.conf binds.conf envvars.conf input.conf monitors.conf windowrules.conf)
run "mkdir -p '$BACKUP_DIR/hypr-usr' '$BACKUP_DIR/hypr'"
for f in "${HYPR_USR_CONFS[@]}"; do
[[ -f "$TARGET/$f" ]] && run "cp '$TARGET/$f' '$BACKUP_DIR/hypr-usr/'"
done
[[ -f "$TARGET/hypr/hyprland.conf" ]] && run "cp '$TARGET/hypr/hyprland.conf' '$BACKUP_DIR/hypr/'"
ok "Backup staged at $BACKUP_DIR"
# ── swap config directories ───────────────────────────────────────────────────
# These directories are identical between hyprland and hyprlua, but we
# re-copy anyway so script paths inside them point to the correct source.
CONFIGS=(
kitty mimeapps.list vicinae walker ulauncher
hypr xfce4 wofi dunst alacritty
nwg-dock-hyprland nwg-drawer nwg-panel
scripts btop gtk-3.0
)
printf '\n'
for cfg in "${CONFIGS[@]}"; do
src_path="$SRC/$cfg"
dst_path="$TARGET/$cfg"
if [[ ! -e "$src_path" ]]; then
warn "Source missing, skipping: $cfg"
continue
fi
run "rm -rf '$dst_path'"
run "cp -r '$src_path' '$dst_path'"
ok "config $cfg"
done
# ── swap hypr-usr (the part that actually differs) ────────────────────────────
# hyprland: *.conf files live at ~/.config/ root (sourced by hyprland.conf)
# hyprlua: *.lua files live at ~/.config/hypr/ (required by hyprland.lua)
# wallpaper.conf stays at ~/.config/ root (hyprpaper still reads it)
printf '\n'
# Remove old .conf files from ~/.config/ root
for f in "${HYPR_USR_CONFS[@]}"; do
[[ -f "$TARGET/$f" ]] && run "rm '$TARGET/$f'" && note "removed ~/.config/$f"
done
# Deploy new .lua files into ~/.config/hypr/
if [[ -d "$SRC/hypr-usr" ]]; then
run "mkdir -p '$TARGET/hypr'"
for lua in "$SRC/hypr-usr"/*.lua; do
[[ -e "$lua" ]] || continue
run "cp '$lua' '$TARGET/hypr/'"
ok "hypr-usr $(basename "$lua") → ~/.config/hypr/"
done
# wallpaper.conf stays at ~/.config/ root
if [[ -f "$SRC/hypr-usr/wallpaper.conf" ]]; then
run "cp '$SRC/hypr-usr/wallpaper.conf' '$TARGET/'"
ok "hypr-usr wallpaper.conf → ~/.config/"
fi
fi
# ── update config-updater ─────────────────────────────────────────────────────
printf '\n'
UPDATER_DIR="$TARGET/config-updater"
UPDATER_CONF="$UPDATER_DIR/updater.conf"
UPDATER_SCRIPT="$HOME/update-configs.sh"
run "mkdir -p '$UPDATER_DIR'"
# Re-point the symlink (or file) to hyprlua's updater.conf
if [[ -L "$UPDATER_CONF" ]] || [[ -f "$UPDATER_CONF" ]]; then
run "rm '$UPDATER_CONF'"
fi
run "ln -sf '$SRC/config-updater/updater.conf' '$UPDATER_CONF'"
ok "config-updater → hyprlua"
# Re-point the update-configs.sh convenience symlink if it exists
if [[ -L "$UPDATER_SCRIPT" ]] || [[ -f "$UPDATER_SCRIPT" ]]; then
run "ln -sf '$SRC/config-updater/update-configs.sh' '$UPDATER_SCRIPT'"
ok "~/update-configs.sh → hyprlua"
fi
# ── reload Hyprland ───────────────────────────────────────────────────────────
printf '\n'
if command -v hyprctl &>/dev/null && hyprctl version &>/dev/null 2>&1; then
ok "Hyprland session detected — reloading..."
run "hyprctl reload"
else
warn "Not inside a Hyprland session — start/restart Hyprland to apply changes."
fi
# ── done ──────────────────────────────────────────────────────────────────────
printf '\n'
if (( DRY_RUN )); then
note "Dry run complete. Run without --dry-run to apply."
else
ok "Migration complete."
note "Rollback: restore files from $BACKUP_DIR"
note " and re-run ~/Dotfiles/desktopenvs/hyprland/config-updater/update-configs.sh"
fi

View File

@ -1,28 +0,0 @@
{
"coc.nvim": { "branch": "release", "commit": "269f4465f304f7f2412b9cc46fbdc98667b84546" },
"dirbuf.nvim": { "branch": "main", "commit": "ac7ad3c8e61630d15af1f6266441984f54f54fd2" },
"fzf": { "branch": "master", "commit": "5819e5ff2f206064d955854ad54182284bdae857" },
"fzf.vim": { "branch": "master", "commit": "b9624aa012ddcbae9e79964bfd30cc1fbe3cf263" },
"glow.nvim": { "branch": "main", "commit": "5d5954b2f22e109d4a6eba8b2618c5b96e4ee7a2" },
"goyo.vim": { "branch": "master", "commit": "9c72fdf2d202914318581f9f0dd09fd102f8504d" },
"lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" },
"lush.nvim": { "branch": "main", "commit": "9c60ec2279d62487d942ce095e49006af28eed6e" },
"markdown.nvim": { "branch": "master", "commit": "093be911d90de03877f3009de36081c1a6242d51" },
"mini.icons": { "branch": "main", "commit": "9c7b1b90b15bdd69c52f6e31889dbc9987c30ec4" },
"nerdtree": { "branch": "master", "commit": "690d061b591525890f1471c6675bcb5bdc8cdff9" },
"nvim-colorizer.lua": { "branch": "master", "commit": "a065833f35a3a7cc3ef137ac88b5381da2ba302e" },
"nvim-dap": { "branch": "master", "commit": "45a69eba683a2c448dd9ecfc4de89511f0646b5f" },
"rust.vim": { "branch": "master", "commit": "889b9a7515db477f4cb6808bef1769e53493c578" },
"ultisnips": { "branch": "master", "commit": "3c4353c9bac16e7275019fb1cdd798708909c486" },
"vim-airline": { "branch": "master", "commit": "1586662296c9dc946083e17cb6a4ef0b3e7c0d68" },
"vim-airline-themes": { "branch": "master", "commit": "77aab8c6cf7179ddb8a05741da7e358a86b2c3ab" },
"vim-crunch": { "branch": "master", "commit": "f368288490937c846853c9f8ace98f44508b4ae5" },
"vim-dadbod": { "branch": "master", "commit": "6d1d41da4873a445c5605f2005ad2c68c99d8770" },
"vim-dadbod-completion": { "branch": "master", "commit": "a8dac0b3cf6132c80dc9b18bef36d4cf7a9e1fe6" },
"vim-dadbod-ui": { "branch": "master", "commit": "07e92e22114cc5b1ba4938d99897d85b58e20475" },
"vim-devicons": { "branch": "master", "commit": "71f239af28b7214eebb60d4ea5bd040291fb7e33" },
"vim-floaterm": { "branch": "master", "commit": "bb4ba7952e906408e1f83b215f55ffe57efcade6" },
"vim-sensible": { "branch": "master", "commit": "0ce2d843d6f588bb0c8c7eec6449171615dc56d9" },
"vim-snippets": { "branch": "master", "commit": "ededcf7581962ee616cadab360d5966f3307f11a" },
"vim-visual-multi": { "branch": "master", "commit": "a6975e7c1ee157615bbc80fc25e4392f71c344d4" }
}