tmux-plugins / tmux-battery

Plug and play battery percentage and icon indicator for Tmux.
MIT License
503 stars 98 forks source link

Chromebook Support for battery stat #22

Closed forkjoseph closed 8 years ago

forkjoseph commented 8 years ago

Chromebook with crouton mounts its stateful Ubuntu to /home/.shadow partition.

Also, its upower has unique printf format.

The script was tested on Asus C300 and Samsung 2 XE500C12I (former with Intel and later with ARM).

It should work seamlessly with other Chromebooks.

martinbeentjes commented 8 years ago

Added a comment regarding the way you check if one uses Chromebook. Is it not possible to just use uname or something alike? And please fix the mixed indentations.

forkjoseph commented 8 years ago

I'm leaving a note here to explain a mechanism to detect chromebook. ChromeOS runs on top of generic Linux kernel, which makes indistinguishable from other Debian distro. chronos@localhost / $ uname -a Linux localhost 3.10.18 #1 SMP Wed Sep 7 17:04:27 PDT 2016 x86_64 Intel(R) Celeron(R) CPU N2830 @ 2.16GHz GenuineIntel GNU/Linux

Thus, I implemented a way to detect Debian distro installed along with ChromeOS since most popular script (crouton) treats downloads/.shadow folder as root folder, comparable to / mounting point in Debian distro.

martinbeentjes commented 8 years ago

Okay, I understand the mechanism. I just don't like the idea of making the decision if one is using a Chromebook based upon the existence of a certain directory.

But for the sake of clearing up things: ChromeOS first has a 'userfriendly' shell, crosh. If you enable the developer mode for ChromeOS, you can use more features?

So now you check if one uses crouton (because there is a certain folder), and if that is so: one can use the command upower? But will your code break if I just create a .shadow folder?

Can I say, it is necessary to use crouton to actually use tmux on ChromeOS?

forkjoseph commented 8 years ago

ChromeOS comes with crosh which is just another bash emulator. I'm not sure it's even possible to use tmux in bash emulator.... also, upower is not supported in crosh.

hmmm, you are right about the shadow folder as too shallow mechanism. I'll investigate alternative way but for now it's the only feasible way to detect chromebook.

forkjoseph commented 8 years ago

It looks like /sys/class/chromeos/cros_ec is chromeos specific class dir that provides info about the hardware and os.

martinbeentjes commented 8 years ago

I've been reading into it. It seems it is the ChromOS Embedded Controller. I am looking to determine if every ChromeOS device has this file.

forkjoseph commented 8 years ago

Hi Martin, It looks like as long as chromebook has x86 or ARMv7, it has that file.

Do you want me to resolve the conflict for the branch??

martinbeentjes commented 8 years ago

If you could resolve the conflicts yourself, that would be awesome! Thanks!

forkjoseph commented 8 years ago

merged!