Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions crates/menew-ui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2055,12 +2055,19 @@ pub mod palette {
self.notify("menew-queue", &tr("queue_done", lang, &[]), None);
}
self.queue_changed();
// The queue action can be selected from the palette itself. Return focus to
// the previous app before sending Ctrl+V, then give GTK/Wayland time to publish
// the new clipboard contents to the compositor.
if self.window.is_visible() {
self.hide();
}
let mode = Config::load().paste_mode;
match decide_paste(mode, menew_core::paste::uinput_writable()) {
PasteAction::NotifyOnly => self.notify("menew-queue-next", &tr("queue_ready", lang, &[]), None),
PasteAction::InjectCtrlV => {
let this = Rc::clone(self);
glib::spawn_future_local(async move {
glib::timeout_future(Duration::from_millis(menew_core::paste::FOCUS_DELAY_MS)).await;
let result = gio::spawn_blocking(menew_core::paste::inject_ctrl_v).await;
if !matches!(result, Ok(Ok(()))) {
this.notify("menew-queue-next", &tr("queue_ready", lang, &[]), None);
Expand Down
6 changes: 4 additions & 2 deletions scripts/desktop-test/gnome.sh
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,13 @@ DE=gnome
FIRST_TEXT="hello gnome"
de_copy() { shell_copy_text "$1" >/dev/null; }
de_clipboard_is() {
# St.Clipboard.get_text is asynchronous: store the result in a global, then read it back
# St.Clipboard.get_text is asynchronous: store the result in a global, then read it back.
# If Shell has not observed a compositor update yet, verify the selection through Wayland
# data-control as a second independent read path.
shell_eval "globalThis.__menewClip = null; const St = imports.gi.St; St.Clipboard.get_default().get_text(St.ClipboardType.CLIPBOARD, (c, t) => { globalThis.__menewClip = t; }); 1" >/dev/null 2>&1
sleep 1
local out; out="$(shell_eval "globalThis.__menewClip" 2>/dev/null)"
[ "$out" = "(true, '\"$1\"')" ] || [ "$out" = "(true, '$1')" ]
[ "$out" = "(true, '\"$1\"')" ] || [ "$out" = "(true, '$1')" ] || clipboard_is "$1"
}
de_screenshot() {
local res
Expand Down
2 changes: 1 addition & 1 deletion scripts/desktop-test/phase5.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Phase 5 checks (images, files, filters, pause, smart actions, snippets, paste queue, OCR).
# Sourced by gnome.sh and kde.sh after lib.sh.

db_sql() { sqlite3 "$MENEW_DB_PATH" "$1" 2>/dev/null; }
db_sql() { sqlite3 -cmd '.timeout 5000' "$MENEW_DB_PATH" "$1" 2>/dev/null; }
images_dir() { echo "${MENEW_DB_PATH%.db}.images"; }
count_kind() { db_sql "SELECT COUNT(*) FROM clipboard_entries WHERE kind='$1'"; }

Expand Down
Loading