From fcb5f5aa9d76b5d4e290da137ea8451be9e7542f Mon Sep 17 00:00:00 2001 From: Quentin Duchemin Date: Sat, 28 Oct 2023 20:35:46 +0200 Subject: [PATCH] Improve subfolder management for external config --- .Xresources | 7 ------ .config/NetworkManager/dest | 1 + .config/NetworkManager/wifi_backend.conf | 2 ++ .config/bootstrap/config_common | 1 + .config/dunst/dunstrc | 2 +- .config/polybar/config.d/laptop | 2 +- .../updatedb.timer.d}/updatedb.timer.conf | 0 .config/updatedb/dest | 1 - .init_config.sh | 25 +++++++++++++------ README.md | 3 ++- 10 files changed, 26 insertions(+), 18 deletions(-) delete mode 100644 .Xresources create mode 100644 .config/NetworkManager/dest create mode 100644 .config/NetworkManager/wifi_backend.conf rename .config/{updatedb => systemd/updatedb.timer.d}/updatedb.timer.conf (100%) delete mode 100644 .config/updatedb/dest diff --git a/.Xresources b/.Xresources deleted file mode 100644 index 05718f8..0000000 --- a/.Xresources +++ /dev/null @@ -1,7 +0,0 @@ -Xft.autohint: 0 -Xft.lcdfilter: lcddefault -Xft.hintstyle: hintfull -Xft.hinting: 1 -Xft.antialias: 1 -Xft.rgba: rgb - diff --git a/.config/NetworkManager/dest b/.config/NetworkManager/dest new file mode 100644 index 0000000..d3795f5 --- /dev/null +++ b/.config/NetworkManager/dest @@ -0,0 +1 @@ +/etc/NetworkManager/conf.d diff --git a/.config/NetworkManager/wifi_backend.conf b/.config/NetworkManager/wifi_backend.conf new file mode 100644 index 0000000..515c976 --- /dev/null +++ b/.config/NetworkManager/wifi_backend.conf @@ -0,0 +1,2 @@ +[device] +wifi.backend=iwd diff --git a/.config/bootstrap/config_common b/.config/bootstrap/config_common index f0e3eda..8c44887 100644 --- a/.config/bootstrap/config_common +++ b/.config/bootstrap/config_common @@ -22,6 +22,7 @@ nemo neofetch network-manager-applet networkmanager +nm-connection-editor noto-fonts-emoji numlockx obsidian diff --git a/.config/dunst/dunstrc b/.config/dunst/dunstrc index a97102f..ea861b7 100644 --- a/.config/dunst/dunstrc +++ b/.config/dunst/dunstrc @@ -19,7 +19,7 @@ width = (0, 400) height = 100 - offset = 15x15 + offset = 15x70 # Show how many messages are currently hidden (because of geometry). indicate_hidden = true diff --git a/.config/polybar/config.d/laptop b/.config/polybar/config.d/laptop index 8131b9d..4899733 100644 --- a/.config/polybar/config.d/laptop +++ b/.config/polybar/config.d/laptop @@ -1,5 +1,5 @@ [variables] -dpi = 100 +dpi = 110 height = 70 top_left = powermenu system-uptime-pretty battery player-mpris top_center = xwindow diff --git a/.config/updatedb/updatedb.timer.conf b/.config/systemd/updatedb.timer.d/updatedb.timer.conf similarity index 100% rename from .config/updatedb/updatedb.timer.conf rename to .config/systemd/updatedb.timer.d/updatedb.timer.conf diff --git a/.config/updatedb/dest b/.config/updatedb/dest deleted file mode 100644 index dcce77e..0000000 --- a/.config/updatedb/dest +++ /dev/null @@ -1 +0,0 @@ -/etc/systemd/system/updatedb.timer.d/ diff --git a/.init_config.sh b/.init_config.sh index d1730e8..817484d 100755 --- a/.init_config.sh +++ b/.init_config.sh @@ -20,7 +20,7 @@ ARCH_PACKAGES="bootstrap" MERGE_DIRS="${I3_CONFIG} ${POLYBAR_CONFIG} ${ARCH_PACKAGES}" # Check if a file has been modified and deleted since last commit, if so perform an action -# $1 : path of file +# $1 : relative path starting from the folder with "dest" # $2 : command to launch if file has been created of modifed # $3 : command to launch if file has been deleted function check_copy() { @@ -85,16 +85,18 @@ if [ ! -z "$INIT" ]; then echo -e "* Installing base Arch packages..." yay -Syu --needed --noconfirm - < ${CONFIG}/${ARCH_PACKAGES}/${FINAL_CONFIG} echo -e "* Changing shell to ZSH..." - chsh -s $(which zsh) + sudo chsh -s $(which zsh) # https://man.archlinux.org/man/rofi-dmenu.5 echo -e "* Symlink dmenu → rofi..." sudo ln -sf /usr/bin/rofi /usr/bin/dmenu echo -e "* Enabling required systemd units..." sudo systemctl enable --now NetworkManager sudo systemctl enable --now systemd-timesyncd + # iwd will be used as a backend for NetworkManager + sudo systemctl disable wpa_supplicant echo -e "* Ensure hardware clock is up to date..." sudo hwclock --systohc - # So that "Open in Terminal" works in Nemo + # So that "Open in Terminal" works inc Nemo echo -e "* Make 'Open Terminal' work in Nemo..." gsettings set org.cinnamon.desktop.default-applications.terminal exec i3-sensible-terminal # For screenshots @@ -132,11 +134,20 @@ for f in `find ${CONFIG} -type f -name ${DEST_FILENAME}`; do DEST=`cat ${f}` # Get all files, either regular files or symlinks, which are not the destination file nor specific desktop/laptop files # This is because if desktop/laptop files exist, they already have a symlink pointing to them at this stage - for config_file in `find ${DIR} -regextype posix-extended -mindepth 1 \( -type f -o -type l \) -not \( -regex "${ENV_EXT_REGEXP}" -o -name "${DEST_FILENAME}" \)`; do + # We want to get the path relative to the directory we are searching in, so subfolders are kept when copying + for config_file in `find ${DIR} -regextype posix-extended -mindepth 1 \( -type f -o -type l \) -not \( -regex "${ENV_EXT_REGEXP}" -o -name "${DEST_FILENAME}" \) -exec realpath --relative-to ${DIR} {} \;`; do + # If we have to copy to a subfolder, extract it + if echo ${config_file} | grep -q '/'; then + subfolder=${config_file%/*} + else + subfolder='' + fi + filename=${config_file##*/} # Now copy to destination - sudo mkdir -p ${DEST} - # ##* strips the base path, so we manipulate absolute paths by concatening with $DEST - check_copy "${config_file}" "sudo cp ${config_file} ${DEST}" "sudo rm ${DEST}/${config_file##*/}" + real_dest=${DEST}/${subfolder} + sudo mkdir -p ${real_dest} + absolute_source=`realpath "${DIR}/${config_file}"` + check_copy "${filename}" "sudo cp ${absolute_source} ${real_dest}" "sudo rm ${real_dest}/${filename}" done done diff --git a/README.md b/README.md index 2d3d495..77abc64 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,7 @@ * Would be great to have a real people-agnostic base, separated from my own customization. Right now, base configuration still have personal path and stuff, making it unusable as-is for other people. * Have a command to cancel stuff if case something goes bad, want to restore base system, etc +* Automatically enable systemd units ## What is this, Chosto ? @@ -120,7 +121,7 @@ This will install all needed software and configuration. If you want to re-use m In actual setup `env` can be : * `desk` is currently adjusted for my home setup, i.e. two screens, a keyboard with media keys and [JACK Audio Connection Kit](https://wiki.archlinux.org/title/JACK_Audio_Connection_Kit). -* `laptop` is adjusted for a basic, single and high-DPI screen laptop, with a simple keyboard. +* `laptop` is adjusted for a basic, single 15' screen laptop, with a simple keyboard. You can now reboot.