From 887424dc5fbbb7d0861631c52168a56d7e999a00 Mon Sep 17 00:00:00 2001 From: Blista Kanjo Date: Wed, 15 Nov 2023 14:23:03 -0500 Subject: feat: add `font-cache-refresh` script --- .local/bin/font-cache-refresh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 .local/bin/font-cache-refresh (limited to '.local/bin/font-cache-refresh') diff --git a/.local/bin/font-cache-refresh b/.local/bin/font-cache-refresh new file mode 100755 index 0000000..870f5dd --- /dev/null +++ b/.local/bin/font-cache-refresh @@ -0,0 +1,31 @@ +#!/bin/sh + +send_notification() { + if command -v notify-send >/dev/null 2>&1; then + notify-send -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." + exit 1 +fi + +if ! command -v pkexec >/dev/null 2>&1; then + send_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" + 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" + exit 1 +fi -- cgit v1.2.3