Drag-and-Drop to App Icon not fully working

Viewed 26

If I drag a single .md file from a finder window to the Marked 2 app icon, it correctly opens a new Marked preview pane.

However if I drag two or more .md files, Marked comes to the foreground but does absolutely nothing. It should create a preview pane for each file.

3 Answers

Known issue (for a long time), and one I haven't been able to solve, even in Marked 3.

I am SO curious where the problem lies... I don't want to waste your time, but is there another ticket which has some kind of explanation?

Sorry to hear you’ve struggled so long!

Have you tried using a vibe coding agent like Claude Code to review your codebase and suggest fixes?

In case you’re not comfortable with that, I described the behavior generically to Claude Code and it came back with a lengthy response with diagnostics and code changes you could do. The most probable cause is related to this:

“When multiple files are dropped:

  1. macOS sends kAEReopenApplication first (activates the app)
  2. Then sends kAEOpenDocuments with the file list
  3. But if step 1's handler does anything async (like creating a window on the next run loop tick), it can interfere with step 2's delivery

The fix is often to delay the reopen handler's action and check if an open-documents event follows immediately” and provided a code snippet to illustrate:

 func applicationShouldHandleReopen(_ sender: NSApplication,
                                       hasVisibleWindows flag: Bool) -> Bool {
      // Defer reopen behavior to let kAEOpenDocuments arrive first
      DispatchQueue.main.async {
          // Only do reopen behavior if no documents were opened
          if !self.didJustOpenDocuments {
              self.showDefaultWindow()
          }
      }
      return false
  }

I’d be happy to send the complete output if you let me know the best way to get it to you.