forked from Shinonome/dots-hyprland
quickshell emoji picker
This commit is contained in:
@@ -84,7 +84,8 @@ Singleton {
|
||||
property bool sloppy: false // Uses levenshtein distance based scoring instead of fuzzy sort. Very weird.
|
||||
property QtObject prefix: QtObject {
|
||||
property string action: "/"
|
||||
property string clipboard: ":"
|
||||
property string clipboard: ";"
|
||||
property string emojis: ":"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -210,4 +210,27 @@ Scope {
|
||||
}
|
||||
}
|
||||
|
||||
GlobalShortcut {
|
||||
name: "overviewEmojiToggle"
|
||||
description: qsTr("Toggle emoji query on overview widget")
|
||||
|
||||
onPressed: {
|
||||
if (GlobalStates.overviewOpen && overviewScope.dontAutoCancelSearch) {
|
||||
GlobalStates.overviewOpen = false;
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < overviewVariants.instances.length; i++) {
|
||||
let panelWindow = overviewVariants.instances[i];
|
||||
if (panelWindow.modelData.name == Hyprland.focusedMonitor.name) {
|
||||
overviewScope.dontAutoCancelSearch = true;
|
||||
panelWindow.setSearchingText(
|
||||
ConfigOptions.search.prefix.emojis
|
||||
);
|
||||
GlobalStates.overviewOpen = true;
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ RippleButton {
|
||||
property var itemExecute: entry?.execute
|
||||
property string fontType: entry?.fontType ?? "main"
|
||||
property string itemClickActionName: entry?.clickActionName
|
||||
property string bigText: entry?.bigText ?? ""
|
||||
property string materialSymbol: entry?.materialSymbol ?? ""
|
||||
property string cliphistRawString: entry?.cliphistRawString ?? ""
|
||||
|
||||
@@ -120,6 +121,7 @@ RippleButton {
|
||||
id: iconLoader
|
||||
active: true
|
||||
sourceComponent: root.materialSymbol !== "" ? materialSymbolComponent :
|
||||
root.bigText ? bigTextComponent :
|
||||
root.itemIcon !== "" ? iconImageComponent :
|
||||
null
|
||||
}
|
||||
@@ -142,6 +144,15 @@ RippleButton {
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: bigTextComponent
|
||||
StyledText {
|
||||
text: root.bigText
|
||||
font.pixelSize: Appearance.font.pixelSize.larger
|
||||
color: Appearance.m3colors.m3onSurface
|
||||
}
|
||||
}
|
||||
|
||||
// Main text
|
||||
ColumnLayout {
|
||||
id: contentColumn
|
||||
|
||||
@@ -302,7 +302,22 @@ Item { // Wrapper
|
||||
}
|
||||
};
|
||||
}).filter(Boolean);
|
||||
}
|
||||
}
|
||||
if (root.searchingText.startsWith(ConfigOptions.search.prefix.emojis)) { // Clipboard
|
||||
const searchString = root.searchingText.slice(ConfigOptions.search.prefix.emojis.length);
|
||||
return Emojis.fuzzyQuery(searchString).map(entry => {
|
||||
return {
|
||||
cliphistRawString: entry,
|
||||
bigText: entry.match(/^\s*(\S+)/)?.[1] || "",
|
||||
name: entry.replace(/^\s*\S+\s+/, ""),
|
||||
clickActionName: "",
|
||||
type: "Emoji",
|
||||
execute: () => {
|
||||
Hyprland.dispatch(`exec wl-copy '${StringUtils.shellSingleQuoteEscape(entry.match(/^\s*(\S+)/)?.[1])}'`);
|
||||
}
|
||||
};
|
||||
}).filter(Boolean);
|
||||
}
|
||||
|
||||
|
||||
////////////////// Init ///////////////////
|
||||
|
||||
Reference in New Issue
Block a user