diff options
| author | Blista Kanjo | 2023-11-15 14:38:43 -0500 |
|---|---|---|
| committer | Blista Kanjo | 2023-11-15 14:38:43 -0500 |
| commit | 21e5316f41afb1e7b2f90b0d2fd68486b5697d36 (patch) | |
| tree | bc49b1e9bd9441ce95ef99c7bf10613ebb79af63 /.local/bin | |
| parent | 887424dc5fbbb7d0861631c52168a56d7e999a00 (diff) | |
refactor: add critical notification on error
Diffstat (limited to '.local/bin')
| -rwxr-xr-x | .local/bin/font-cache-refresh | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/.local/bin/font-cache-refresh b/.local/bin/font-cache-refresh index 870f5dd..6e448b8 100755 --- a/.local/bin/font-cache-refresh +++ b/.local/bin/font-cache-refresh @@ -6,26 +6,32 @@ send_notification() { fi } +send_critical_notification() { + if command -v notify-send >/dev/null 2>&1; then + notify-send -u critical -t 10000 "$1" "$2" + fi +} + if ! command -v fc-cache >/dev/null 2>&1; then - send_notification "Font Cache Error" "fc-cache command not found." + send_critical_notification "Font Cache Error" "fc-cache command not found." exit 1 fi if ! command -v pkexec >/dev/null 2>&1; then - send_notification "Font Cache Error" "pkexec command not found." + send_critical_notification "Font Cache Error" "pkexec command not found." exit 1 fi if pkexec fc-cache -rfv; then send_notification "Font Cache Refresh" "Successfully refreshed font cache for root user" else - send_notification "Font Cache Error" "Failed to refresh font cache for root user" + send_critical_notification "Font Cache Error" "Failed to refresh font cache for root user" exit 1 fi if fc-cache -rfv; then send_notification "Font Cache Refresh" "Successfully refreshed font cache for current user" else - send_notification "Font Cache Error" "Failed to refresh font cache for current user" + send_critical_notification "Font Cache Error" "Failed to refresh font cache for current user" exit 1 fi |
