#!/bin/bash
#=========================================#
# Simple update notifier (DNF) v0.3.8     #
#=========================================#
USER=$(who |sed 's/ .*//'|head -n1)
ICON="/usr/share/icons/hicolor/48x48/apps/simple-notifier.png" 
CONF="/home/"$USER"/.config/simple-notifier"
if [[ ! -d "$CONF" ]] 
then
mkdir -p "$CONF"
touch $CONF/history.cli
chown -R "$USER":"$USER" "$CONF"
fi
FILE="/home/"$USER"/.config/simple-notifier/history.cli"
`yad --title='Simple Update Notifier' --width=650 --height=250 --center --on-top \
--text="Installed from Terminal CLI History" --text-info --filename="$FILE" \
--window-icon=$ICON \
--image=$ICON \
--button=Remove!"/usr/share/simple-notifier/icons/remove.png":0 \
--button=Close!"/usr/share/simple-notifier/icons/exit.png":1`
 ret=$?
if [ $ret -eq 1 ]; then
exit 0
fi
if [ $ret -eq 0 ]; then
`yad --width=500 --center --on-top \
--text="\nAre you sure you want to remove all installed history?" \
--window-icon=$ICON \
--image=$ICON \
--title='Simple Update Notifier' \
--button=Remove!/usr/share/simple-notifier/icons/remove.png:3 \
--button=Cancel!/usr/share/simple-notifier/icons/exit.png:1`
 ret=$?
if [ $ret -eq 1 ]; then
exit 0
fi |
if [ $ret -eq 3 ]; then
rm -f "$CONF"/history.cli > /dev/null 2>&1
sleep 0.30
touch "$CONF"/history.cli
  fi
    fi

