mirror of
https://github.com/kusti8/proton-native.git
synced 2026-05-15 14:15:50 -06:00
[GH-ISSUE #20] Is it possible to use system calls? #14
Labels
No labels
bug
documentation
enhancement
libui issue
pull-request
question
wait for libui implementation
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/proton-native#14
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @JafarAkhondali on GitHub (Feb 18, 2018).
Original GitHub issue: https://github.com/kusti8/proton-native/issues/20
Hi, Is it possible to use system calls using Proton-native? For example log key events when window is not focused.
@albinekb commented on GitHub (Feb 18, 2018):
Please don't make a keylogger @JafarAkhondali 😂
@JafarAkhondali commented on GitHub (Feb 18, 2018):
@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 commented on GitHub (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 commented on GitHub (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 commented on GitHub (Feb 19, 2018):
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 commented on GitHub (Feb 19, 2018):
Yeah I implemented it after I released it because of the macOS error. On my
laptop, I saw only around .4% CPU utilization but I don't know how it is
for others. But that's the best that currently can be done. Node callbacks
should work since it's just an event loop, and it calls refresh on the same
thread.
On Mon, Feb 19, 2018, 4:53 PM Andrea Parodi notifications@github.com
wrote:
@parro-it commented on GitHub (Feb 19, 2018):
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.
I agree.
@parro-it commented on GitHub (Feb 19, 2018):
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 commented on GitHub (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 commented on GitHub (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.