68 lines
2.4 KiB
Bash
Executable file
68 lines
2.4 KiB
Bash
Executable file
#!/usr/bin/bash
|
|
|
|
# SCRIPT VERSION
|
|
USER_SETUP_VER=7
|
|
USER_SETUP_VER_FILE="${XDG_DATA_HOME:-$HOME/.local/share}/ublue/user-setup"
|
|
USER_SETUP_VER_RAN=$(cat "$USER_SETUP_VER_FILE")
|
|
VEN_ID="$(cat /sys/devices/virtual/dmi/id/chassis_vendor)"
|
|
|
|
mkdir -p "$(dirname "$USER_SETUP_VER_FILE")" || exit 1
|
|
|
|
dirname "$USER_SETUP_VER_FILE"
|
|
|
|
# INIT
|
|
UBLUE_CONFIG_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/ublue"
|
|
mkdir -p "$UBLUE_CONFIG_DIR"
|
|
|
|
# Upgrade from v1 to v2 changes only the location of the USER_SETUP_VER.
|
|
# Exit if v1 file is present.
|
|
USER_SETUP_VER_FILE_V1="$HOME/.ublue-configured"
|
|
if [[ -f $USER_SETUP_VER_FILE_V1 ]]; then
|
|
echo "User setup v1 has already run. Exiting..."
|
|
rm "$USER_SETUP_VER_FILE_V1"
|
|
echo "$USER_SETUP_VER" > "$USER_SETUP_VER_FILE"
|
|
exit 0
|
|
fi
|
|
|
|
# Run script if updated
|
|
if [[ -f "$USER_SETUP_VER_FILE" && "$USER_SETUP_VER" = "$USER_SETUP_VER_RAN" ]]; then
|
|
echo "User setup v$VER has already run. Exiting..."
|
|
exit 0
|
|
fi
|
|
|
|
# Currently unused
|
|
# IMAGE_INFO="/usr/share/ublue-os/image-info.json"
|
|
# IMAGE_NAME=$(jq -r '."image-name"' < $IMAGE_INFO)
|
|
|
|
# Ensure custom ptyxis theme is present
|
|
PTYXIS_THEME_DIR="/etc/skel/.local/share/org.gnome.Ptyxis/palettes"
|
|
PTYXIS_DIR="$HOME/.local/share/org.gnome.Ptyxis/palettes"
|
|
mkdir -p "$PTYXIS_DIR"
|
|
if [[ ! -f "$PTYXIS_DIR/catppuccin-dynamic.palette" ]]; then
|
|
cp "$PTYXIS_THEME_DIR/catppuccin-dynamic.palette" "$PTYXIS_DIR/catppuccin-dynamic.palette"
|
|
fi
|
|
|
|
if [[ ":Framework:" =~ ":$VEN_ID:" ]]; then
|
|
if [[ ! -f "$UBLUE_CONFIG_DIR/framework-initialized" ]]; then
|
|
echo 'Setting Framework logo menu'
|
|
dconf write /org/gnome/shell/extensions/Logo-menu/symbolic-icon true
|
|
dconf write /org/gnome/shell/extensions/Logo-menu/menu-button-icon-image 31
|
|
echo 'Setting touch scroll type'
|
|
dconf write /org/gnome/desktop/peripherals/mouse/natural-scroll true
|
|
if [[ $SYS_ID == "Laptop ("* ]]; then
|
|
echo 'Applying font fix for Framework 13'
|
|
dconf write /org/gnome/desktop/interface/text-scaling-factor 1.25
|
|
fi
|
|
touch "$UBLUE_CONFIG_DIR/framework-initialized"
|
|
fi
|
|
fi
|
|
|
|
# Clear flatpak font cache
|
|
flatpak list --app --columns=application,runtime|grep org.gnome.Platform|awk -F '\t' '{print "flatpak run --command=fc-cache " $1 " -f -v"}'|xargs -I % echo "%"|sh
|
|
|
|
# Handle privileged tasks
|
|
pkexec /usr/libexec/ublue-privileged-user-setup
|
|
|
|
# Prevent future executions
|
|
echo "Writing state file"
|
|
echo $USER_SETUP_VER > "$USER_SETUP_VER_FILE"
|