Mos icon indicating copy to clipboard operation
Mos copied to clipboard

ExceptionalApplication check sometimes fails using runningApplication.executableURL?.path

Open ClumsyXBMC opened this issue 1 year ago • 0 comments

Describe the bug | 问题描述 I am using an application called NoMachine. This is a remotedesktop type application (think VNC or RDP) which does not like the scroll smoothing Mos provides, so I need to add it as an exception and disabled "smooth" in the options.

If I add NoMachine via the "Running applications" field, the application internally gets added to an EnhanceArray using executableURL?.path.

Unfortunately, the nomachine application has a parent binary which is called "nxdock" and is located in the app package under NoMachine.app/Contents/MacOs/nxdock. This parent application binary then spawns a sub-process called "nxplayer" which is also located under NoMachine.app/Contents/MacOs/nxplayer.

The CGEvent that is passed to Mos when I for example scroll in the nomachine window has an executableURL.path which corresponds to the child "nxplayer" and not the parent "nxdock". This means, that the check in getExceptionalApplication method fails, as the path seen in the CGEvent is not the same path, as the path set when adding the app via the running processes menu.

I have locally "fixed" this, by just not ever using the executableURL path, but just always only using the bundle path in the check. In appendApplicationWithRunningApplication I changed the return code to be:

    guard let bundlePath = runningApplication.bundleURL?.path else { return }
    appendApplicationWith(path: bundlePath)

The code is then similar to what happens, when you don't use the running application menu to add the app, but the manual "select from finder" option and point to the bundle. I am not sure, if this is clean as there must be a reason why you opted for two different options: bundle and exectubale path.

To Reproduce | 如何重现 Not sure, if it is enough to start nomachine and scroll in the main window or if it is necessray to connect to a remote server first, in order for it to spawn "nxplayer".

Expected behavior | 期望结果 NoMachine gets recognised after adding it to the exceptional app list via the RunningProcesses menu.

System Info | 系统信息:

  • Mouse: external USB mouse
  • OS: MacOs

ClumsyXBMC avatar Apr 13 '23 13:04 ClumsyXBMC