Crylia / crylia-theme

A theme for AwesomeWM
516 stars 26 forks source link

[BUG] Duplicate status bar icon + broken battery percentage display #18

Closed CardboardCarl closed 2 years ago

CardboardCarl commented 2 years ago

Describe the bug

My device (Thinkpad X260) has an internal (primary) battery as well as an external (secondary) battery. Could that be part of the problem?

I still receive notifications from the power manager when my laptop switches to the secondary battery or when either battery is low.

To Reproduce I'm not too sure... It might be my OS, or it could be the power manager.

  1. Download my Arch version
  2. Install the theme as usual
  3. ???
  4. profit(?)

Expected behavior Battery icon should show a percentage, and the CPU icon shouldn't be duplicated

Screenshots Screenshot_2022-05-28_10-53-43

Information:

Crylia commented 2 years ago

Errors might be in ~/.xsession-errors.

Can you provide me with the output of upower -i $(upower -e)? And upower -i $(upower -e | grep BAT) | grep "time to " please. I actually have never seen a two battery setup so it's def related to that.

The second issue seems weird. Can you please look into crylia_bar/init.lua and provide me with the content?

Is your awesome from git? Usually it says (too long). Legacy awesome 4.3 won't work

Crylia commented 2 years ago

Also the first Widget in the screenshot is for nvidia-gpu's only for now. you need Nvidia-smi for it to work

CardboardCarl commented 2 years ago

upower -i $(upower -e) outputs this:

  native-path:          AC
  power supply:         yes
  updated:              Sat May 28 14:50:08 2022 (4 seconds ago)
  has history:          no
  has statistics:       no
  line-power
    warning-level:       none
    online:              no
    icon-name:          'ac-adapter-symbolic'

upower -i $(upower -e | grep BAT) | grep "time to " outputs nothing. Removing the last grep command outputs this:

  native-path:          BAT0
  vendor:               LGC
  model:                45N1113
  serial:               1002
  power supply:         yes
  updated:              Sat May 28 15:13:15 2022 (3 seconds ago)
  has history:          yes
  has statistics:       yes
  battery
    present:             yes
    rechargeable:        yes
    state:               pending-charge
    warning-level:       none
    energy:              16.12 Wh
    energy-empty:        0 Wh
    energy-full:         20.25 Wh
    energy-full-design:  23.48 Wh
    energy-rate:         19.876 W
    voltage:             12.154 V
    charge-cycles:       N/A
    percentage:          79%
    capacity:            86.2436%
    technology:          lithium-ion
    icon-name:          'battery-full-charging-symbolic'

As for the icon bugs, I looked in init.lua and I think I figured it out...

The green bar isn't a battery widget, that's the GPU usage indicator. My guess is the duplicate CPU icon is the GPU temp as well. This device has an integrated graphics card, and that is probably causing the issue.

The init file doesn't instance a battery widget anywhere... did I miss something or was it forgotten?

init.lua:

--------------------------------------------------------------------------------------------------------------
-- This is the statusbar, every widget, module and so on is combined to all the stuff you see on the screen --
--------------------------------------------------------------------------------------------------------------
-- Awesome Libs
local awful = require("awful")

awful.screen.connect_for_each_screen(
-- For each screen this function is called once
-- If you want to change the modules per screen use the indices
-- e.g. 1 would be the primary screen and 2 the secondary screen.
  function(s)
  -- Create 9 tags
  awful.layout.layouts = user_vars.layouts
  awful.tag(
    { "1", "2", "3", "4", "5", "6", "7", "8", "9" },
    s,
    user_vars.layouts[1]
  )

  require("src.modules.powermenu")(s)
  -- TODO: rewrite calendar osd, maybe write an own inplementation
  -- require("src.modules.calendar_osd")(s)
  require("src.modules.volume_osd")(s)
  require("src.modules.brightness_osd")(s)
  require("src.modules.titlebar")
  require("src.modules.volume_controller")(s)

  -- Widgets
  --s.battery = require("src.widgets.battery")()
  s.audio = require("src.widgets.audio")(s)
  s.date = require("src.widgets.date")()
  s.clock = require("src.widgets.clock")()
  --s.bluetooth = require("src.widgets.bluetooth")()
  s.layoutlist = require("src.widgets.layout_list")()
  s.powerbutton = require("src.widgets.power")()
  s.kblayout = require("src.widgets.kblayout")(s)
  s.taglist = require("src.widgets.taglist")(s)
  s.tasklist = require("src.widgets.tasklist")(s)
  --s.cpu_freq = require("src.widgets.cpu_info")("freq", "average")

  -- Add more of these if statements if you want to change
  -- the modules/widgets per screen.
  if s.index == 1 then
    s.systray = require("src.widgets.systray")(s)
    s.cpu_usage = require("src.widgets.cpu_info")("usage")
    s.cpu_temp = require("src.widgets.cpu_info")("temp")
    s.gpu_usage = require("src.widgets.gpu_info")("usage")
    s.gpu_temp = require("src.widgets.gpu_info")("temp")

    require("crylia_bar.left_bar")(s, { s.layoutlist, s.systray, s.taglist })
    require("crylia_bar.center_bar")(s, { s.tasklist })
    require("crylia_bar.right_bar")(s, { s.gpu_usage, s.gpu_temp, s.cpu_usage, s.cpu_temp, s.audio, s.kblayout, s.date, s.clock, s.powerbutton })
    require("crylia_bar.dock")(s, user_vars.dock_programs)
  end

  if s.index == 2 then
    s.network = require("src.widgets.network")()
    s.ram_info = require("src.widgets.ram_info")()

    require("crylia_bar.left_bar")(s, { s.layoutlist, s.taglist })
    require("crylia_bar.center_bar")(s, { s.tasklist })
    require("crylia_bar.right_bar")(s, { s.ram_info, s.audio, s.kblayout, s.network, s.date, s.clock, s.powerbutton })
  end
end
)
Crylia commented 2 years ago

--s.battery = require("src.widgets.battery")() There it is. I put every widget there and commented those out that I don't use in my main config

You can simply comment those out you don't need (performance reasons) or remove them entirely.

If you got multiple screens then you wan't to put the widgets you are only useing on a single screen into the if s.index == X where X is your screen number (1 is primary). If you got a single screen you can remove both if's entirely.

I might gonna add a better explanation in this file later with my 2.0 release.

Your battery doesn't report how long it takes to charge. sh -c "upower -i $(upower -e | grep BAT) | grep percentage | awk '{print \$2}' |tr -d '\n%'" Does this command at least report a % value? I guess it should.

CardboardCarl commented 2 years ago

Very odd... I'll look into it. Thanks for the help!

Crylia commented 2 years ago

Is your issue resolved? If you want you can try the develop branch, I just pushed a new battery widget rewrite which uses the dbus now and supports every device and as many as you'd like.

CardboardCarl commented 2 years ago

Yes, sorry about that. I'll go ahead and close this