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";
|
import { AnimatedCircProg } from "./cairo_circularprogress.js";
|
||||||
|
|
||||||
function guessMessageType(summary) {
|
function guessMessageType(summary) {
|
||||||
const str = summary.toLowerCase();
|
const keywordsToTypes = {
|
||||||
if (str.includes('reboot')) return 'restart_alt';
|
'reboot': 'restart_alt',
|
||||||
if (str.includes('recording')) return 'screen_record';
|
'recording': 'screen_record',
|
||||||
if (str.includes('battery') || summary.includes('power')) return 'power';
|
'battery': 'power',
|
||||||
if (str.includes('screenshot')) return 'screenshot_monitor';
|
'power': 'power',
|
||||||
if (str.includes('welcome')) return 'waving_hand';
|
'screenshot': 'screenshot_monitor',
|
||||||
if (str.includes('time')) return 'scheduleb';
|
'welcome': 'waving_hand',
|
||||||
if (str.includes('installed')) return 'download';
|
'time': 'scheduleb',
|
||||||
if (str.includes('update')) return 'update';
|
'installed': 'download',
|
||||||
if (str.startsWith('file')) return 'folder_copy';
|
'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';
|
return 'chat';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user