refactor: moved daemon stuff to launchctl#5
Conversation
|
|
|
will checkout on the weekends |
de1e3df to
4c49ac5
Compare
|
I couldn't run the app on your branch in the background via: swift build && .build/debug/VimiumNative start-daemonCan you provide a minimal example on how it's supposed to be ran in daemon mode? |
probably the permission is missing, check the logs at |
|
you should add the binary to the accessibility permission allow list and it should start working after |
I'm planing to add a visible native banner for using the accessibility permissions later like in yabai or skhd (also the idea of using launchctl was inspired by these projects) |
|
In this case is moving daemon mode to launchctl justified? Cause I see it significantly complicates the setup with no apparent upside, apart from it being convention |
|
it is cause it really persists as a daemon should and there is no more parsing processes by hand. Also it doesn't really complicate setup: you just start the daemon, make sure there is permission given to it which is needed only once after installation and restart the daemon if needed + permissions alert will make it obvious but it will come a bit later |
|
all the problems mentioned above are true for developing and debugging the daemon not for using it |
|
Managed to run it. Turns out you need to give a11y api permissions, to the file now if you want to run it in daemon mode. So I think we should include it in the instructions when we exit if there are no such permissions. Also since we are using plists, I assume, the production build changes such that they're included in the final build? I don't see them in this PR |
|
plist is included as generated byte array from resources |
One thing that I've noticed when you quit through menu item, when running in daemon mode, it restarts which I assume unintentionall side effect, may be we should handle the case when you terminate it from menu, you stop the daemon, such that it would stop restarting |
yup, that's unintentional, will fix that as well |
AXIsProcessTrusted check will not suffice here 'cause it will check terminal emulator's permission instead of the binary itself. I was thinking about using AXIsProcessTrustedWithOptions in daemon only with kAXTrustedCheckOptionPrompt or maybe make it new default and skip check on daemon initialization so only the daemon itself will check permissions for the binary upd: applicationDidFinishLaunching is skipped for daemon starting so forget about
|
|
I don't know it worked for me and message showed up in the log file when, I ran ./app start-daemon without the permissions |
|
I guess there are also problems with multi user ux cause default permissions on String.write is 644 |
4c49ac5 to
16837a4
Compare
16837a4 to
0c0ae94
Compare
|
added in last 2 versions
|
|
@abilkhan024 another ping |
|
After reviewing it further, I've decided that it's not really what I want in my project because it complicates the setup and introduces unnecessary moving parts. The way macos manages a11y permissions makes it painful to develop in the proposed setup, so I will close this feature. Hope there are no hard feelings |
|
make sense, gonna keep it as a patch for myself then, maybe i'll come up with something that will work better than a11 |
ref