How to get a list of processes in the gnome-shell extension?

I am writing a gnome-shell extension and I am trying to get a list of all the processes that are currently running. I tried using glibtop , which has a function for retrieving glibtop_get_proclist processes, but the problem is that this function returns a pointer to a list, so if I do this:

let proclist = new GTop.glibtop_proclist; pid_list = GTop.glibtop_get_proclist(proclist, 0, 0); 

pid_list becomes type number. Now javascript has no pointer arithmetic, so I have no idea how to access the list.

The proclist variable contains only a few numeric parameters, such as proclist total and proclist size .

So, how can I access the list that get_proclist method get_proclist ? Or is there an easier way to get a list of pids of running processes?

+4
source share
1 answer

This will give you an idea of ​​how to go through the list that you received: 1

+1
source

All Articles