forked from Shinonome/dots-hyprland
notification: icon guess: add ai response
This commit is contained in:
@@ -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';
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user