yequake icon indicating copy to clipboard operation
yequake copied to clipboard

MacOS issues

Open haji-ali opened this issue 1 year ago • 2 comments

I am wondering if others are experiencing similar issues which I am seeing on my system (MacOS 14.1.2, Emacs 29.1).

  • If the currently selected window is Emacs, the yequake frame shows immediately and on top of the Emacs currently selected frame as expected.
  • If a window of another application (beside Emacs) is selected, the yequake frame appears below the currently selected window (but on top of other non-selected windows) and is unfocused. Moreover, the frame is delayed by a second or so.

Any idea if these issues are surmountable?

haji-ali avatar May 31 '24 10:05 haji-ali

I don't use MacOS, so I can't help you myself, and I don't think this package has very many users, anyway, so I wouldn't count on anyone else chiming in here. Anyway, if you find a solution, let me know and maybe we can integrate it.

alphapapa avatar Jun 01 '24 09:06 alphapapa

I haven't been able to find a good cross-platform solution. In the meantime, for those facing a similar issue, here's a hack that works well for me:

The reason for the frame delay is the call to select-frame-set-input-focus which in turns calls x-focus-frame. For some reason, when Emacs is not already in focus, this has a consistent 1 second delay. I instead use an osascript to ensure that the yequake frame is focused. The end solution is that I call this function from emacsclient. Some extra tinkering is required to check if the frame is visible before focusing it (I just copied some code from yequake).

(defun my/terminal ()
  (cl-letf (((symbol-function #'select-frame-set-input-focus)
             (symbol-function #'ignore)))
    (yequake-toggle "Terminal"))

  (start-process
   "osascript"
   nil
   "osascript" "-e"
   "tell application \"Emacs\"
ignoring application responses
set index of window 1 where name contains \"Terminal\" to 1
delay 0.05
end ignoring
end tell
do shell script \"open -a Emacs\""))

haji-ali avatar Jun 02 '24 18:06 haji-ali