stimulant / ampm

application management + performance monitoring
MIT License
92 stars 25 forks source link

Screenshot support for Raspberry Pi? #34

Open mattfelsen opened 7 years ago

mattfelsen commented 7 years ago

Hi! I was pleasantly surprised to find that ampm seems to install & run fine on rPi running the latest Raspian (2016-11-25-raspbian I guess?).

One thing I realized is that screen shots wouldn't work and dug in a little bit. There's a utility called scrot which is included - not sure if it's part of Raspian normally or only when you install the "full" version with their new PIXEL windowing environment - and works fine, creating a PNG image.

I looked into the platform detection for a second and see that node's process.platform will return linux on rPi, but I'm not sure how to detect an rPi vs a full x86 desktop machine, and/or whether the scrot app would be included with something like a standard Debian, Ubuntu etc. install.

I'm half thinking out loud/half throwing this out there to see if this is something you've thought about at all, whether you care if trying to take a screenshot fails on linux, etc. It seems it'd be easy enough to change the platform detection logic to make it work, but then you open a new can of worms about "incomplete linux support."

endquote commented 7 years ago

Cool that you're trying it out! I think you're the first to do anything on Pi or Linux. Hopefully most of the work that was done to make it work on Mac makes it mostly work on Linux too.

The way I'd probably do this is check for process.platform === 'linux' && scrotExists(), but I'm not sure how to implement that function. There are of course strong opinions on how you might do that.

mattfelsen commented 7 years ago

This module looks pretty good, and implements one of the recommended approaches. I can play with this tomorrow and send over a PR.