#!/bin/bash

desktop=$(ps -e | grep -e "niri" -e "kwin")
timestamp=$( date +%F-%T )

post_upgrade() {

    if [[ -n ${desktop} ]]; then

        kdialog --yesno "The Plasma 6.7 series is the last series available in KaOS.<br>
        Once Plasma moves to 6.8, it will be removed from the KaOS repositories,<br>
        See https://kaosx.us/news/2026/systemd_kaos/ for more information.<br><br>
        Now is the time to switch your install to <b>niri/noctalia</b>, https://kaosx.us/desktop/niri/.<br><br>
        Do you want to save this output?"

        save=${?}

            if [[ ${save} == 1 ]]; then

                kdialog --msgbox "Output not saved"

            else

                echo "The Plasma 6.7 series is the last series available in KaOS.<br>
                      Once Plasma moves to 6.8, it will be removed from the KaOS repositories,<br>
                      See https://kaosx.us/news/2026/systemd_kaos/ for more information.<br><br>
                      Now is the time to switch your install to <b>niri/noctalia</b>, https://kaosx.us/desktop/niri/."

                kdialog --msgbox "Output is saved in /var/log/plasma${timestamp}.txt"
                
            fi   

    else

        echo -e "The Plasma 6.7 series is the last series available in KaOS."
        echo -e "Once Plasma moves to 6.8, it will be removed from the KaOS repositories,"
        echo -e "See https://kaosx.us/news/2026/systemd_kaos/ for more information."
        echo -e "Now is the time to switch your install to niri/noctalia, https://kaosx.us/desktop/niri/. \e[0m"

    fi
}


