diff --git a/.config/ags/modules/.commonwidgets/notification.js b/.config/ags/modules/.commonwidgets/notification.js index 60b8e42d1..567092392 100644 --- a/.config/ags/modules/.commonwidgets/notification.js +++ b/.config/ags/modules/.commonwidgets/notification.js @@ -8,16 +8,33 @@ import { setupCursorHover } from "../.widgetutils/cursorhover.js"; import { AnimatedCircProg } from "./cairo_circularprogress.js"; function guessMessageType(summary) { - const str = summary.toLowerCase(); - if (str.includes('reboot')) return 'restart_alt'; - if (str.includes('recording')) return 'screen_record'; - if (str.includes('battery') || summary.includes('power')) return 'power'; - if (str.includes('screenshot')) return 'screenshot_monitor'; - if (str.includes('welcome')) return 'waving_hand'; - if (str.includes('time')) return 'scheduleb'; - if (str.includes('installed')) return 'download'; - if (str.includes('update')) return 'update'; - if (str.startsWith('file')) return 'folder_copy'; + const keywordsToTypes = { + 'reboot': 'restart_alt', + 'recording': 'screen_record', + 'battery': 'power', + 'power': 'power', + 'screenshot': 'screenshot_monitor', + 'welcome': 'waving_hand', + 'time': 'scheduleb', + 'installed': 'download', + 'update': 'update', + 'ai response': 'neurology', + 'startswith:file': 'folder_copy', // Declarative startsWith check + }; + + const lowerSummary = summary.toLowerCase(); + + for (const [keyword, type] of Object.entries(keywordsToTypes)) { + if (keyword.startsWith('startswith:')) { + const startsWithKeyword = keyword.replace('startswith:', ''); + if (lowerSummary.startsWith(startsWithKeyword)) { + return type; + } + } else if (lowerSummary.includes(keyword)) { + return type; + } + } + return 'chat'; }