#!/bin/sh -e if [ "$(uname -s)" = "Darwin" ]; then READLINK="greadlink" if ! command -v "${READLINK}" >/dev/null 2>&1; then READLINK="readlink" fi else READLINK="readlink" fi install_files() { target_dir="$1" source_dir="$("${READLINK}" -f "${2:-.}")" target_filename_prefix="${3}" mkdir -vp "${target_dir}" target_dir="$("${READLINK}" -f "${target_dir}")" if [ ! -d "${source_dir}" ]; then echo "Source directory ${source_dir} does not exist, skipping." return fi for f in "${source_dir}"/*; do case "$(basename "$f")" in dotfiles) (install_files "${target_dir}" "$f" .) ;; *.jq) tmpfile="$(mktemp)" if [ -f "$f" ]; then tmpfile="$(mktemp)" target_file="${target_dir}/$(basename "$f" .jq)" if [ -f "$target_file" ]; then cat "$target_file" else echo "{}" fi | jq "$(cat "$f")" > "$tmpfile" mv -v "$tmpfile" "$target_file" else echo "Expected source file with .jq extension not to be a directory." exit 1 fi ;; *) if [ -d "$f" ]; then (install_files "${target_dir}/${target_filename_prefix}$(basename "$f")" "$f") else cp -v "$f" "${target_dir}/${target_filename_prefix}$(basename "$f")" fi ;; esac done } ### install_files "${HOME}" home install_files "/etc" etc if command -v fc-cache >/dev/null 2>&1; then fc-cache -f fi if command -v systemctl >/dev/null 2>&1; then systemctl --user daemon-reload systemctl --user enable tweak-cpu-usage systemctl --user restart tweak-cpu-usage fi # KDE 6 if command -v kwriteconfig6 >/dev/null 2>&1; then # set sans font to what we define in fontconfig for key in "General:font" "General:menuFont" "General:toolBarFont" "WM:activeFont"; then IFS=: read group key <<<"$key" kwriteconfig6 --file kdeglobals --group "$group" --key "$key" "Sans Serif,9,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" fi # set smallest sans font kwriteconfig6 --file kdeglobals --group "General" --key "smallestReadableFont" "Sans Serif,8,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" # set mono font to what we define in fontconfig kwriteconfig6 --file kdeglobals --group "General" --key "fixed" "Monospace,9,-1,5,400,0,0,0,0,0,0,0,0,0,0,1" fi