diff options
| author | Blista Kanjo | 2023-11-15 14:23:03 -0500 |
|---|---|---|
| committer | Blista Kanjo | 2023-11-15 14:23:03 -0500 |
| commit | 887424dc5fbbb7d0861631c52168a56d7e999a00 (patch) | |
| tree | 74aa449a5c3dc39fed71b05dbea99c556d7f9486 /.local/bin/font-cache-refresh | |
| parent | 2842cd2b25335c8a8345228566a6b9aac0097c4b (diff) | |
feat: add `font-cache-refresh` script
Diffstat (limited to '.local/bin/font-cache-refresh')
| -rwxr-xr-x | .local/bin/font-cache-refresh | 31 |
1 files changed, 31 insertions, 0 deletions
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 |
