Re: How to obtain OS and HW info?



Small C library means compiling/building and tons of extra problems I'm actually trying to avoid with this `jsgtk` project so that's not an option.

Also bringing in anything heavier than a `process.platform` switch to try to figure out what command line string would be more appropriate to execute and parse is probably not the best path to follow ... I was truly hoping for some magic/hidden trick I'm not aware of, something able to give GNOME Details info that kind of details, but I start believing I'm better off with a "i18n language like" logic that speaks different OS and versions and return the right thing, assuming modern Linux and OSX would be my targets so far.

So, fair enough, and thanks for the hint, I'll try to figure out what'd be the best way to solve such problem.

About `jsgtk`, it sadden me so much GJS had no traction at all, being JS24 based and with a `python_case` syntax nobody in JS world feels OK about, that I couldn't resist trying to bring in an almost 1:1 node.js environment capable of bringing in the awesome GTK3 potential, I'm not sure why it doesn't exist already as a project.

We tried node-gtk with native gyp changes but it got stuck as a project, so whoever would like to help wth `jsgtk` is ,ore than welcome.

People don't know what's possible to do with it: they **should**

Best Regards

On Tue, Mar 15, 2016 at 8:44 PM, Giovanni Campagna <scampa giovanni gmail com> wrote:
On Tue, 2016-03-15 at 11:32 +0000, Andrea Giammarchi wrote:
> Dear all,
>   I wonder if there's any better way than spawning command line
> "queries" to obtain some HW info, like those shown in GNOME Details.
>
> As example, I'm replicating node.js `os` module in here:
> https://github.com/WebReflection/jsgtk/blob/master/jsgtk_modules/os.j
> s
>
> but I couldn't find a GLib or GJS way to retrieve basic info such
> `uname -a` so I have to manually parse some output out of commands
> that are surely not portable cross platform (e.g. OSX has no
> `/proc/cpuinfo` or `/proc/loadavg` or `uptime -s` command )

Can you make use of a small C library?
You should be able to reimplement some of that in C by calling uname
and/or sysconf.
Might still not be portable though, and you'll end up parsing /proc
anyway on Linux.

Otherwise you can try using libgtop. It's not the best library to
access from introspection, and it's quite an heavy dependency to put on
every program using jsgtk, but it gives you the data you need and it's
portable to Linux and most BSDs.

Hope this helps,

Giovanni

PS: I didn't know about jsgtk, but it seems a cool idea that is worth
pursuing, kudos!

> Thanks in advance for any sort of hint/link/idea.
>
> Best Regards
> _______________________________________________
> _javascript_-list mailing list
> _javascript_-list gnome org
> https://mail.gnome.org/mailman/listinfo/_javascript_-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]