New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qubes-i3status #2629

Open
ayustae opened this Issue Feb 13, 2017 · 7 comments

Comments

Projects
None yet
4 participants
@ayustae

ayustae commented Feb 13, 2017

Qubes OS version (e.g., R3.2):

R3.2

Affected TemplateVMs (e.g., fedora-23, if applicable):

dom0

Using i3 desktop version 4.12

Expected behavior:

Information of the battery on the i3 status bar.

Actual behavior:

No information of the battery on the i3 status bar (besides xfce4-power-manager).

Steps to reproduce the behavior:

Just installed i3 following the steps on the documentation site.

General notes:

I have traced the problem to the file '/usr/bin/qubes-i3status'.

On the definition of the function 'status_bat' the following path is used:
/sys/class/power_suppy/BAT*
Then, the following files are accessed:
'power_now'
'power_full'

It turns out that in my computer 8and maybe in others) those files are called respectively:
'charge_now'
'charge_full'

My laptop is a MSI cx62 6QD

Related issues:

I haven't found any (though I haven't either searched for them too much).

@ayustae

This comment has been minimized.

Show comment
Hide comment
@ayustae

ayustae Feb 13, 2017

Further information: the directory where the AC adapter information is stored in my computer is not called 'AC' as in the script (in fact, in my case, it is called 'ADP1' instead).

ayustae commented Feb 13, 2017

Further information: the directory where the AC adapter information is stored in my computer is not called 'AC' as in the script (in fact, in my case, it is called 'ADP1' instead).

@jpouellet

This comment has been minimized.

Show comment
Hide comment
@jpouellet

jpouellet Feb 14, 2017

Contributor

Hmmm... not sure what you're looking at...

AFAICT it uses energy_now and energy_full, and a quick look through the git history does not immediately reveal the use of either power_* or charge_*.

What version are you running, and where did you install it from?

FWIW, this is what I observe on my system:

[user@dom0 ~]$ uname -r
4.8.9-12.pvops.qubes.x86_64
[user@dom0 ~]$ rpm -q i3
i3-4.12-5.fc23.x86_64
[user@dom0 ~]$ rpm -q i3-settings-qubes
i3-settings-qubes-1.2-1.fc23.x86_64
[user@dom0 ~]$ ls -al /sys/class/power_supply/BAT0/
total 0
drwxr-xr-x 3 root root    0 Feb 14 14:23 .
drwxr-xr-x 3 root root    0 Feb 14 14:23 ..
-rw-r--r-- 1 root root 4096 Feb 14 14:23 alarm
-r--r--r-- 1 root root 4096 Feb 14 14:23 capacity
-r--r--r-- 1 root root 4096 Feb 14 14:23 capacity_level
-r--r--r-- 1 root root 4096 Feb 14 14:23 cycle_count
lrwxrwxrwx 1 root root    0 Feb 14 14:23 device -> ../../../PNP0C0A:00
-r--r--r-- 1 root root 4096 Feb 14 14:23 energy_full
-r--r--r-- 1 root root 4096 Feb 14 14:23 energy_full_design
-r--r--r-- 1 root root 4096 Feb 14 14:23 energy_now
-r--r--r-- 1 root root 4096 Feb 14 14:23 manufacturer
-r--r--r-- 1 root root 4096 Feb 14 14:23 model_name
drwxr-xr-x 2 root root    0 Feb 14 14:23 power
-r--r--r-- 1 root root 4096 Feb 14 14:23 power_now
-r--r--r-- 1 root root 4096 Feb 14 14:23 present
-r--r--r-- 1 root root 4096 Feb 14 14:23 serial_number
-r--r--r-- 1 root root 4096 Feb 14 14:23 status
lrwxrwxrwx 1 root root    0 Feb 14 14:23 subsystem -> ../../../../../../../../../class/power_supply
-r--r--r-- 1 root root 4096 Feb 14 14:23 technology
-r--r--r-- 1 root root 4096 Feb 14 14:23 type
-rw-r--r-- 1 root root 4096 Feb 14 14:23 uevent
-r--r--r-- 1 root root 4096 Feb 14 14:23 voltage_min_design
-r--r--r-- 1 root root 4096 Feb 14 14:23 voltage_now
[user@dom0 ~]$ rpm -ql i3 i3-settings-qubes | xargs grep -E '(power|energy|charge)'
/usr/bin/qubes-i3status:    for battery in /sys/class/power_supply/BAT*; do
/usr/bin/qubes-i3status:        accum_now=$((accum_now + $(cat $battery/energy_now)))
/usr/bin/qubes-i3status:        accum_full=$((accum_full + $(cat $battery/energy_full)))
/usr/bin/qubes-i3status:    if [[ $(cat /sys/class/power_supply/AC/online) == '1' ]]; then
Contributor

jpouellet commented Feb 14, 2017

Hmmm... not sure what you're looking at...

AFAICT it uses energy_now and energy_full, and a quick look through the git history does not immediately reveal the use of either power_* or charge_*.

What version are you running, and where did you install it from?

FWIW, this is what I observe on my system:

[user@dom0 ~]$ uname -r
4.8.9-12.pvops.qubes.x86_64
[user@dom0 ~]$ rpm -q i3
i3-4.12-5.fc23.x86_64
[user@dom0 ~]$ rpm -q i3-settings-qubes
i3-settings-qubes-1.2-1.fc23.x86_64
[user@dom0 ~]$ ls -al /sys/class/power_supply/BAT0/
total 0
drwxr-xr-x 3 root root    0 Feb 14 14:23 .
drwxr-xr-x 3 root root    0 Feb 14 14:23 ..
-rw-r--r-- 1 root root 4096 Feb 14 14:23 alarm
-r--r--r-- 1 root root 4096 Feb 14 14:23 capacity
-r--r--r-- 1 root root 4096 Feb 14 14:23 capacity_level
-r--r--r-- 1 root root 4096 Feb 14 14:23 cycle_count
lrwxrwxrwx 1 root root    0 Feb 14 14:23 device -> ../../../PNP0C0A:00
-r--r--r-- 1 root root 4096 Feb 14 14:23 energy_full
-r--r--r-- 1 root root 4096 Feb 14 14:23 energy_full_design
-r--r--r-- 1 root root 4096 Feb 14 14:23 energy_now
-r--r--r-- 1 root root 4096 Feb 14 14:23 manufacturer
-r--r--r-- 1 root root 4096 Feb 14 14:23 model_name
drwxr-xr-x 2 root root    0 Feb 14 14:23 power
-r--r--r-- 1 root root 4096 Feb 14 14:23 power_now
-r--r--r-- 1 root root 4096 Feb 14 14:23 present
-r--r--r-- 1 root root 4096 Feb 14 14:23 serial_number
-r--r--r-- 1 root root 4096 Feb 14 14:23 status
lrwxrwxrwx 1 root root    0 Feb 14 14:23 subsystem -> ../../../../../../../../../class/power_supply
-r--r--r-- 1 root root 4096 Feb 14 14:23 technology
-r--r--r-- 1 root root 4096 Feb 14 14:23 type
-rw-r--r-- 1 root root 4096 Feb 14 14:23 uevent
-r--r--r-- 1 root root 4096 Feb 14 14:23 voltage_min_design
-r--r--r-- 1 root root 4096 Feb 14 14:23 voltage_now
[user@dom0 ~]$ rpm -ql i3 i3-settings-qubes | xargs grep -E '(power|energy|charge)'
/usr/bin/qubes-i3status:    for battery in /sys/class/power_supply/BAT*; do
/usr/bin/qubes-i3status:        accum_now=$((accum_now + $(cat $battery/energy_now)))
/usr/bin/qubes-i3status:        accum_full=$((accum_full + $(cat $battery/energy_full)))
/usr/bin/qubes-i3status:    if [[ $(cat /sys/class/power_supply/AC/online) == '1' ]]; then
@jpouellet

This comment has been minimized.

Show comment
Hide comment
Contributor

jpouellet commented Feb 14, 2017

@jpouellet

This comment has been minimized.

Show comment
Hide comment
@jpouellet

jpouellet Feb 14, 2017

Contributor

@bl4ck-h0le it would be helpful if you would provide output of:

[user@dom0 ~]$ find -H /sys/class/power_supply/*
Contributor

jpouellet commented Feb 14, 2017

@bl4ck-h0le it would be helpful if you would provide output of:

[user@dom0 ~]$ find -H /sys/class/power_supply/*
@SietsevanderMolen

This comment has been minimized.

Show comment
Hide comment
@SietsevanderMolen

SietsevanderMolen Feb 15, 2017

If it's true that Fedora uses different paths for different systems, then we should update the config script and make it more generic. Even though this is meant as a developer's/power user's window manager, and there's no guarantee that the out of the box experience is smooth sailing, we shouldn't ship in a broken state imho. I'll wait for a reply from @bl4ck-h0le and fix it.

If it's true that Fedora uses different paths for different systems, then we should update the config script and make it more generic. Even though this is meant as a developer's/power user's window manager, and there's no guarantee that the out of the box experience is smooth sailing, we shouldn't ship in a broken state imho. I'll wait for a reply from @bl4ck-h0le and fix it.

@SietsevanderMolen

This comment has been minimized.

Show comment
Hide comment
@SietsevanderMolen

SietsevanderMolen Feb 19, 2017

@bl4ck-h0le So it turns out this is not Fedora specific and the battery level can be reported in two ways. (I'm assuming that your power_now was a typo and you meant energy_now) I updated the script to take this into account and it should be more robust now. The updated version can be found here: https://github.com/SietsevanderMolen/i3-qubes/blob/qubes-3.2/i3-settings-qubes/qubes-i3status. There's a pull request in QubesOS/qubes-desktop-linux-i3.

SietsevanderMolen commented Feb 19, 2017

@bl4ck-h0le So it turns out this is not Fedora specific and the battery level can be reported in two ways. (I'm assuming that your power_now was a typo and you meant energy_now) I updated the script to take this into account and it should be more robust now. The updated version can be found here: https://github.com/SietsevanderMolen/i3-qubes/blob/qubes-3.2/i3-settings-qubes/qubes-i3status. There's a pull request in QubesOS/qubes-desktop-linux-i3.

@ayustae

This comment has been minimized.

Show comment
Hide comment
@ayustae

ayustae Apr 3, 2017

Sorry for my long absence, I was in my exam period.

@jpouellet The result for find -H /sys/class/power_supply/* is in the following file:
power.txt

In case it is still useful.

ayustae commented Apr 3, 2017

Sorry for my long absence, I was in my exam period.

@jpouellet The result for find -H /sys/class/power_supply/* is in the following file:
power.txt

In case it is still useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment