[GH-ISSUE #20] Is it possible to use system calls? #14

Closed
opened 2026-05-05 11:24:00 -06:00 by gitea-mirror · 10 comments
Owner

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.

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.
Author
Owner

@albinekb commented on GitHub (Feb 18, 2018):

Please don't make a keylogger @JafarAkhondali 😂

<!-- gh-comment-id:366514930 --> @albinekb commented on GitHub (Feb 18, 2018): Please don't make a keylogger @JafarAkhondali 😂
Author
Owner

@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

<!-- gh-comment-id:366518484 --> @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
Author
Owner

@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?

<!-- gh-comment-id:366533590 --> @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?
Author
Owner

@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.

<!-- gh-comment-id:366689319 --> @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.
Author
Owner

@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.

<!-- gh-comment-id:366811622 --> @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.
Author
Owner

@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:

Hi @kusti8 https://github.com/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.


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
https://github.com/kusti8/proton-native/issues/20#issuecomment-366811622,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AJW73HGy5_cbHgfZeWgsGFpoUsSRmn2Sks5tWe12gaJpZM4SJrrS
.

<!-- gh-comment-id:366812954 --> @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: > Hi @kusti8 <https://github.com/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. > > — > You are receiving this because you were mentioned. > > > Reply to this email directly, view it on GitHub > <https://github.com/kusti8/proton-native/issues/20#issuecomment-366811622>, > or mute the thread > <https://github.com/notifications/unsubscribe-auth/AJW73HGy5_cbHgfZeWgsGFpoUsSRmn2Sks5tWe12gaJpZM4SJrrS> > . >
Author
Owner

@parro-it commented on GitHub (Feb 19, 2018):

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.

<!-- gh-comment-id:366816339 --> @parro-it commented on GitHub (Feb 19, 2018): > 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](https://github.com/andlabs/libui/issues/146) 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.
Author
Owner

@parro-it commented on GitHub (Feb 19, 2018):

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.

<!-- gh-comment-id:366816942 --> @parro-it commented on GitHub (Feb 19, 2018): > 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.
Author
Owner

@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.

<!-- gh-comment-id:366833063 --> @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.
Author
Owner

@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.

<!-- gh-comment-id:366833241 --> @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.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/proton-native#14
No description provided.