#!/bin/bash

## Colored message

msg() {
ALL_OFF="\e[1;0m"
BOLD="\e[1;1m"
GREEN="${BOLD}\e[1;32m"
local mesg=$1; shift
printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}" "$@" >&2
}

post_install() {

 # Don't launch new dbus session
#  PID="$(pgrep gnome-session | head -n 1)"
#  export DBUS_SESSION_BUS_ADDRESS="$(grep -zoP '(?<=DBUS_SESSION_BUS_ADDRESS=).*' /proc/${PID}/environ | tr '\0' '\n')"

  # Set extension version validation back to default value as
  # we don't want incompatible extensions being loaded and causing breakage
#  dbus-launch gsettings set org.gnome.shell disable-extension-version-validation 'false'

## Check if printing support is installed

if pacman -Qi cups > /dev/null 2>&1; then
  echo ""
  msg "Printing support installed"
  echo ""
else
  echo ""
  msg "Printing support not installed, to enable please type this in a terminal:
  -> pamac install manjaro-printer
  -> or install manjaro-printer package via Add/Remove Software"
  echo ""
fi

## Inform users about QT style changes

#if pacman -Qi qt5ct > /dev/null 2>&1; then
#  echo ""
#  msg "We have switched back to QGnomePlatform for GNOME 42.
#  qt5ct and qt6ct (Qt Configuration Utilities) may be marked as orphans.
#  If you want use QGnomePlatform with the Adwaita Qt style,
#  you'll need remove or comment the QT_QPA_PLATFORMTHEME variable
#  in /etc/environment."
#  echo ""
#fi
}

post_upgrade() {
  post_install
}
