From: Don Armstrong Date: Mon, 18 Jan 2016 17:42:10 +0000 (-0800) Subject: only show battery information if there is a battery X-Git-Url: https://git.donarmstrong.com/?p=x_base.git;a=commitdiff_plain;h=391dbf5eab5562e20547e8feae958d3647946812 only show battery information if there is a battery --- diff --git a/.config/awesome/rc.lua b/.config/awesome/rc.lua index ac3b11f..ac7ab6f 100644 --- a/.config/awesome/rc.lua +++ b/.config/awesome/rc.lua @@ -36,10 +36,13 @@ local vicious = require("vicious") local cpuwidget = wibox.widget.textbox() vicious.register(cpuwidget, vicious.widgets.cpu, "$1%CPU ") local batwidget = wibox.widget.textbox() +local has_battery = false if file_exists("/sys/class/power_supply/BAT1") then vicious.register(batwidget,vicious.widgets.bat," $2%$1 $3",120,"BAT1") -else + has_battery = true +elseif file_exists("/sys/class/power_supply/BAT0") then vicious.register(batwidget,vicious.widgets.bat," $2%$1 $3",120,"BAT0") + has_battery = true end -- This is used later as the default terminal and editor to run. terminal = "x-terminal-emulator" @@ -182,7 +185,9 @@ for s = 1, screen.count() do if s == 1 then right_layout:add(wibox.widget.systray()) end right_layout:add(cpuwidget) - right_layout:add(batwidget) + if has_battery then + right_layout:add(batwidget) + end right_layout:add(mytextclock) right_layout:add(mylayoutbox[s])