Insert emojis without persisting clipboard entries
Keep the first emoji result selected whenever results exist, including after search filtering, so Enter inserts immediately. Route emoji insertion through a hidden helper that serves a transient sensitive clipboard entry long enough for Shift+Insert, then stops that clipboard owner. Mark transient emoji inserts so clipboard history skips only that event while continuing to record normal terminal copies.
This commit is contained in:
@@ -4,8 +4,26 @@ set -o pipefail
|
||||
|
||||
STATE_DIR="${XDG_STATE_HOME:-$HOME/.local/state}/omarchy"
|
||||
IMAGE_DIR="$STATE_DIR/clipboard-images"
|
||||
EMOJI_IGNORE_FILE="${XDG_RUNTIME_DIR:-${TMPDIR:-/tmp}}/omarchy-emoji-insert-ignore"
|
||||
mkdir -p "$IMAGE_DIR"
|
||||
|
||||
should_ignore_next_copy() {
|
||||
local marker_mtime=0
|
||||
|
||||
[[ -f $EMOJI_IGNORE_FILE ]] || return 1
|
||||
|
||||
marker_mtime=$(stat -c %Y "$EMOJI_IGNORE_FILE" 2>/dev/null || printf '0')
|
||||
if (( $(date +%s) - marker_mtime > 5 )); then
|
||||
rm -f "$EMOJI_IGNORE_FILE"
|
||||
return 1
|
||||
fi
|
||||
|
||||
rm -f "$EMOJI_IGNORE_FILE"
|
||||
return 0
|
||||
}
|
||||
|
||||
should_ignore_next_copy && exit 0
|
||||
|
||||
types=$(wl-paste --list-types 2>/dev/null || true)
|
||||
|
||||
emit_image() {
|
||||
|
||||
@@ -44,7 +44,7 @@ Item {
|
||||
root.opened = true
|
||||
root.filterText = ""
|
||||
root.selectedIndex = 0
|
||||
root.cursorActive = false
|
||||
root.cursorActive = true
|
||||
root.rebuildDisplay()
|
||||
Qt.callLater(function() { keyCatcher.forceActiveFocus() })
|
||||
}
|
||||
@@ -81,6 +81,7 @@ Item {
|
||||
if (displayModel.count === 0) selectedIndex = 0
|
||||
else if (selectedIndex >= displayModel.count) selectedIndex = displayModel.count - 1
|
||||
else if (selectedIndex < 0) selectedIndex = 0
|
||||
cursorActive = displayModel.count > 0
|
||||
|
||||
Qt.callLater(function() {
|
||||
if (displayModel.count > 0) resultGrid.positionViewAtIndex(root.selectedIndex, GridView.Contain)
|
||||
@@ -132,7 +133,7 @@ Item {
|
||||
function setFilter(nextFilter) {
|
||||
root.filterText = nextFilter
|
||||
root.selectedIndex = 0
|
||||
root.cursorActive = false
|
||||
root.cursorActive = true
|
||||
root.rebuildDisplay()
|
||||
}
|
||||
|
||||
@@ -145,8 +146,9 @@ Item {
|
||||
function applySelected(emoji) {
|
||||
if (!emoji) return
|
||||
root.dismiss()
|
||||
Quickshell.execDetached([root.omarchyPath + "/bin/omarchy-clipboard-paste-text", "--shift-insert", emoji])
|
||||
Quickshell.execDetached([root.omarchyPath + "/bin/omarchy-menu-emoji-insert", emoji])
|
||||
}
|
||||
|
||||
ListModel { id: displayModel }
|
||||
|
||||
FileView {
|
||||
|
||||
Reference in New Issue
Block a user