mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-06-07 20:31:31 +00:00
feat: add category-based browsing to emoji selector
This commit is contained in:
@@ -11,6 +11,23 @@ Item {
|
||||
property var launcher: null
|
||||
property bool handleSearch: false
|
||||
|
||||
property string selectedCategory: "recent"
|
||||
property bool isBrowsingMode: false
|
||||
|
||||
property var categoryIcons: ({
|
||||
"recent": "clock",
|
||||
"people": "user",
|
||||
"animals": "paw",
|
||||
"nature": "leaf",
|
||||
"food": "apple",
|
||||
"activity": "run",
|
||||
"travel": "plane",
|
||||
"objects": "home",
|
||||
"symbols": "star"
|
||||
})
|
||||
|
||||
property var categories: ["recent", "people", "animals", "nature", "food", "activity", "travel", "objects", "symbols"]
|
||||
|
||||
// Force update results when emoji service loads
|
||||
Connections {
|
||||
target: EmojiService
|
||||
@@ -27,6 +44,13 @@ Item {
|
||||
Logger.i("EmojiPlugin", "Initialized");
|
||||
}
|
||||
|
||||
function selectCategory(category) {
|
||||
selectedCategory = category;
|
||||
if (launcher) {
|
||||
launcher.updateResults();
|
||||
}
|
||||
}
|
||||
|
||||
// Check if this plugin handles the command
|
||||
function handleCommand(searchText) {
|
||||
return searchText.startsWith(">emoji");
|
||||
@@ -65,9 +89,17 @@ Item {
|
||||
];
|
||||
}
|
||||
|
||||
const query = searchText.slice(6).trim();
|
||||
const emojis = EmojiService.search(query);
|
||||
return emojis.map(formatEmojiEntry);
|
||||
var query = searchText.slice(6).trim();
|
||||
|
||||
if (query === "") {
|
||||
isBrowsingMode = true;
|
||||
var emojis = EmojiService.getEmojisByCategory(selectedCategory);
|
||||
return emojis.map(formatEmojiEntry);
|
||||
} else {
|
||||
isBrowsingMode = false;
|
||||
var emojis = EmojiService.search(query);
|
||||
return emojis.map(formatEmojiEntry);
|
||||
}
|
||||
}
|
||||
|
||||
// Format an emoji entry for the results list
|
||||
|
||||
Reference in New Issue
Block a user