Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only send desktop notification if the list of available updates differs from the last check #61

Merged
merged 5 commits into from
Nov 24, 2023

Conversation

Antiz96
Copy link
Owner

@Antiz96 Antiz96 commented Nov 24, 2023

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 compared to the last check so you don't get multiple notifications for the exact same update over time.

…rs 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.
This directory and the files contained in it are only relevant for the desktop notifications
…re 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.
…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).
@Antiz96 Antiz96 merged commit 150fb11 into main Nov 24, 2023
1 check passed
@Antiz96 Antiz96 deleted the only_new_update branch November 24, 2023 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant