diff --git a/.config/distrobox/distrobox.ini b/.config/distrobox/distrobox.ini new file mode 100644 index 00000000..c6f50f80 --- /dev/null +++ b/.config/distrobox/distrobox.ini @@ -0,0 +1,9 @@ +[music-arch] +image="quay.io/toolbx/arch-toolbox:latest" +home="/mnt/lucie/distrobox-home/music" +additional_packages="picard pipewire pipewire-pulse pipewire-alsa libpulse git curl fish neovim lua luarocks" +pre_init_hooks="export SHELL=/usr/bin/fish;" +# mnt volumes are already mounted by default +pull=true +replace=false + diff --git a/.config/distrobox/link_configs.sh b/.config/distrobox/link_configs.sh new file mode 100644 index 00000000..672b3845 --- /dev/null +++ b/.config/distrobox/link_configs.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash +# +# link_configs.sh - Symlink dotfiles from source to destination home directory +# +# Usage: +# ./link_configs.sh /home/lucie/dotfiles /home/lucie +# +# Arguments: +# homeDirSource - Directory containing the original config files/dirs +# homeDirDest - Destination home directory where symlinks will be created +# +# Notes: +# - Edit the 'paths' array below to add/remove configurations +# - Handles both files and directories (e.g. .config/fish/config.fish) +# - Parent directories are created automatically in the destination +# - Existing symlinks are overwritten (-f flag) + +homeDirSource="$1" +homeDirDest="$2" + +paths=( + ".config/fontconfig" + ".local/share" + ".config/gtk-3.0" + ".config/gtk-4.0" + ".config/qt5ct" + ".config/qt6ct" + ".config/Kvantum" + ".config/fish/config.fish" + ".config/fish/conf.d" + ".config/fish/functions" + ".config/kitty" + ".config/nvim" + ".local/share/themes" + ".local/share/icons" + ".local/share/fonts" + "scripts" + ".shell_env" +) + +for p in "${paths[@]}"; do + mkdir -p "${homeDirDest}/$(dirname "${p}")" + ln -sf "${homeDirSource}/${p}" "${homeDirDest}/${p}" +done + diff --git a/.config/fish/config.fish b/.config/fish/config.fish index 350c7391..a0eb16fa 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -150,10 +150,13 @@ if status is-interactive ### OS SPECIFIC ### if test (uname -s) = "Darwin" - set OS_NAME (sw_vers -productName) + set -g OS_NAME macos else - set OS_NAME (lsb_release -is) - end + set -g OS_NAME linux + if test -e /etc/os-release + set -g OS_NAME (grep '^ID=' /etc/os-release | string replace -r '^ID="?(.+)"?$' '$1') + end + end # if the variable $CONTAINER_ID exists, the sessions is in a distrobox container if test -n "$CONTAINER_ID" @@ -163,11 +166,11 @@ if status is-interactive end switch $OS_NAME - case "Ubuntu" + case "ubuntu" abbr --add ca batcat --color=always alias cat='batcat -p --color=always' abbr --add upd "sudo apt update && sudo apt upgrade -y" - case "Arch" + case "arch" abbr --add ca bat --color=always alias cat='bat -p --color=always' # pacman and yay @@ -184,7 +187,7 @@ if status is-interactive alias mirrors="sudo reflector --latest 50 --number 20 --sort score --save /etc/pacman.d/mirrorlist" alias mirrora="sudo reflector --latest 50 --number 20 --sort age --save /etc/pacman.d/mirrorlist" - case "Fedora" + case "fedora" alias dmenu='wofi --dmenu' abbr --add vi "nvim" abbr --add upd "sudo dnf upgrade" @@ -194,10 +197,10 @@ if status is-interactive exec Hyprland end - case "macOS" + case "macos" abbr --add ca bat --color=always alias cat='bat -p --color=always' - case "Linuxmint" + case "linuxmint" abbr --add ca batcat --color=always alias cat='batcat -p --color=always' abbr --add upd "sudo apt update && sudo apt upgrade -y" diff --git a/.config/xonsh/rc.d/00_rc.py b/.config/xonsh/rc.d/00_rc.py index c8c024a0..00d07e72 100644 --- a/.config/xonsh/rc.d/00_rc.py +++ b/.config/xonsh/rc.d/00_rc.py @@ -128,17 +128,19 @@ def isDistrobox(): system = platform.system() if system == "Darwin": - OS_NAME = subprocess.check_output( - ["sw_vers", "-productName"], text=True - ).strip() + OS_NAME = "macos" else: + OS_NAME = system.lower() try: - OS_NAME = subprocess.check_output( - ["lsb_release", "-is"], text=True - ).strip() - except Exception: - OS_NAME = system - + with open("/etc/os-release", "r") as f: + for line in f: + if line.startswith("ID="): + # Strip 'ID=', then strip quotes and whitespace + OS_NAME = line.split("=", 1)[1].strip().strip('"').strip("'").lower() + break + except FileNotFoundError: + pass + __xonsh__.env['OS_NAME'] = OS_NAME # -------------------------------------------------------- diff --git a/.config/xonsh/rc.d/21_aliases_os.py b/.config/xonsh/rc.d/21_aliases_os.py index 946d31ca..3946badf 100644 --- a/.config/xonsh/rc.d/21_aliases_os.py +++ b/.config/xonsh/rc.d/21_aliases_os.py @@ -27,7 +27,7 @@ archUpdateCmd += " && sudo flatpak update --assumeyes" - if OS_NAME == "Arch": + if OS_NAME == "arch": abbrevs["ca"] = "bat --color=always" abbrevs["upd"] = archUpdateCmd aliases["cat"] = "bat -p --color=always" @@ -45,12 +45,12 @@ "mirrora": "sudo reflector --latest 50 --number 20 --sort age --save /etc/pacman.d/mirrorlist", }) - elif OS_NAME == "Ubuntu": + elif OS_NAME == "ubuntu": abbrevs["ca"] = "batcat --color=always" abbrevs["upd"] = debUpdateCmd aliases["cat"] = "batcat -p --color=always" - elif OS_NAME == "Fedora": + elif OS_NAME == "fedora": abbrevs["vi"] = "nvim" abbrevs["upd"] = "sudo dnf upgrade" @@ -61,11 +61,11 @@ except Exception: pass - elif OS_NAME == "macOS": + elif OS_NAME == "macos": abbrevs["ca"] = "bat --color=always" aliases["cat"] = "bat -p --color=always" - elif OS_NAME == "Linuxmint": + elif OS_NAME == "linuxmint": abbrevs["ca"] = "batcat --color=always" abbrevs["upd"] = debUpdateCmd aliases["cat"] = "batcat -p --color=always" diff --git a/.local/bin/distrobox-app-example b/.local/bin/distrobox-app-example index 9efaf675..fee242e4 100755 --- a/.local/bin/distrobox-app-example +++ b/.local/bin/distrobox-app-example @@ -1,6 +1,6 @@ -#!/bin/bash +#!/usr/bin/env bash if [ -x "/bin/full/path/of/executable" ]; then - . /bin/full/path/of/executable + exec /bin/full/path/of/executable "$@" else /usr/bin/distrobox enter container-name -- application "$@" fi diff --git a/.local/bin/picard b/.local/bin/picard new file mode 100755 index 00000000..8bfbda07 --- /dev/null +++ b/.local/bin/picard @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +if [ -x "/usr/bin/picard" ]; then + exec /usr/bin/picard "$@" +else + /usr/bin/distrobox enter music-arch -- picard "$@" +fi +