Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to use system calls? #20

Closed
JafarAkhondali opened this issue Feb 18, 2018 · 10 comments
Closed

Is it possible to use system calls? #20

JafarAkhondali opened this issue Feb 18, 2018 · 10 comments

Comments

@JafarAkhondali
Copy link

Hi, Is it possible to use system calls using Proton-native? For example log key events when window is not focused.

@albinekb
Copy link

Please don't make a keylogger @JafarAkhondali 😂

@JafarAkhondali
Copy link
Author

@albinekb LOL 😅 Who would create a keyloggger in 2018 using react? 😺
I've developed a client for an device using tcp sockets() and electron, But sometimes we need to minimize the window of our application and have the same functionality

@espoal
Copy link

espoal commented Feb 18, 2018

I was thinking the same... maybe we need to use a nodejs server for system calls?

for example file system could be exposed through a graphql request?

@kusti8
Copy link
Owner

kusti8 commented Feb 19, 2018

That wouldn't be part of this package, but another. I'm not familiar with doing this in node so I wouldn't know.

@parro-it
Copy link
Contributor

Hi @kusti8, I'm libui-node author. I gave a look at how you implemented the event loop here: https://github.com/kusti8/proton-native/blob/master/src/eventLoop.js

It's similar to how the event loop of libui-node works in early release. As far as I can say, node calls should work just fine (but I didn't try yet).

And system calls like logging keys should work too... You could try to use my https://github.com/parro-it/screen-info and see if it work.

Anyway these event loop implementation is highly CPU intensive, because it is based on polling (~4% CPU on an inactive, simple window).

In later libui-node versions, I implemented a background thread version of some part of the loop that is way more performant, but is actually not working on macOS.

And I was not able to find a way to make the same trick work on Windows, that is still using the poor performance polling.

@kusti8
Copy link
Owner

kusti8 commented Feb 19, 2018 via email

@parro-it
Copy link
Contributor

Yeah I implemented it after I released it because of the macOS error.

I'm thinking of restoring an old version for macOS that should work on last os versions, but involve the use of the an internal, undocumented call _dispatch_get_main_queue_port_4CF.

I have no solution for Windows yet... but we discussed on libui repos in 2016 and it seems there could be a possible solution.

Node callbacks should work since it's just an event loop, and it calls refresh on the same
thread.

I agree.

@parro-it
Copy link
Contributor

I saw only around .4% CPU utilization but I don't know how it is
for others.

I think libui, libui-node and proton-native are attractive because they are lite-weight alternative to electron, and so they probably they will be used more often on low-range CPU, where, sadly, the polling-penalty is more heavy.

@kusti8
Copy link
Owner

kusti8 commented Feb 20, 2018

Yeah I understand. I don't know enough to work out a cross platform event loop. I would love something that uses native threads, but it's obviously hard to work out.

@kusti8
Copy link
Owner

kusti8 commented Feb 20, 2018

I'm closing it as it seems that the OP question has been answered. @parro-it feel free to create a separate issue to track this closer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants