Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only send desktop notification if the list of available updates diffe…
…rs from the last check (#61) * Only send desktop notification if the list of available updates differs from the last check Currently, the desktop notification included in the `check()` function is sent whenever there are update available without any sort of filter. That means that, with the systemd timer triggering the `check()` function each hour, you will get a notification for the same exact available updates each hour over and over until you actually apply them (in the eventuality that there's no other available updates in the mean time). This commit makes the `check()` function verify that the current list of available updates differs from the one obtained by the last check before re-sending a notification. That way, a new notification is sent only if there are new available updates compare to the last check so you don't get multiple notifications for the exact same update over time. * Better order for the condition * Only create the state directory and files if notify-send is installed This directory and the files contained in it are only relevant for the desktop notifications * Check/create the state dir/files for the notif before checking if there are pending updates That makes the current_check and last_check files reflectst the reality by being emptied if there are no update available. The diff is only ran if the variable isn't empty so there won't be any false positive. * Remove empty lines from the current_state file after redirecting the update_available var value to it When there are no update available, redirecting the value of the update_available var (which is then empty) to the file produces an empty (but existing) line. This commit aims to remove it so the file is actually empty (instead of containing an empty/blank line).
- Loading branch information