summaryrefslogtreecommitdiff
path: root/rc.lua
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2023-01-05 16:27:59 +0100
committerAnton Khirnov <anton@khirnov.net>2023-01-05 16:35:04 +0100
commit4808f43077c9b4bf161e37c6fffc1e9dfbbccf98 (patch)
tree8478d6227d5ee2f03de87dcaced284eaac98981a /rc.lua
parentd2fbf3c11fb10c2b76455df2a718a8c8d88bf16d (diff)
rc: add a battery level monitor to statusbar
Consisting of: - battery object, which is a wrapper around a sysfs dir describing a battery - battery manager, which adds and removes individual batteries as they (dis)appear - e.g. wireless input devices, and maps them to widgets displayed side by side - battery widget, which shows the status of one of the batteries; the widget used is derived from batteryarc [1], but heavily modified [1] https://github.com/streetturtle/awesome-wm-widgets/
Diffstat (limited to 'rc.lua')
-rw-r--r--rc.lua15
1 files changed, 10 insertions, 5 deletions
diff --git a/rc.lua b/rc.lua
index 43d5fe3..2bf47ca 100644
--- a/rc.lua
+++ b/rc.lua
@@ -16,8 +16,9 @@ local utils = require("utils")
local workspace = require("workspace")
-- local widgets
-local pager = require("pager")
-local urgent_wgt = require("urgent_wgt")
+local BatteryManager = require("battery_mng")
+local pager = require("pager")
+local urgent_wgt = require("urgent_wgt")
-- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to
@@ -79,6 +80,8 @@ update_systray_iconsize()
-- global, shown only on the primary screen
local u_wgt = urgent_wgt.UrgentWidget:new()
+local b_mng = BatteryManager()
+
-- Create a wibox for each screen and add it
mywibox = {}
mypromptbox = {}
@@ -103,12 +106,14 @@ awful.screen.connect_for_each_screen(function(s)
awful.button({ }, 3, function () awful.layout.inc(layouts, -1) end),
awful.button({ }, 4, function () awful.layout.inc(layouts, 1) end),
awful.button({ }, 5, function () awful.layout.inc(layouts, -1) end)))
- local layoutbox_container = wibox.container.constraint(layoutbox, 'max', beautiful.xresources.apply_dpi(tray_icon_size))
local layout_utils = wibox.layout.fixed.horizontal()
- layout_utils:add(layoutbox_container)
+ layout_utils:add(layoutbox)
+ layout_utils:add(b_mng)
layout_utils:add(u_wgt.widget)
+ local utils_bar = wibox.container.constraint(layout_utils, 'max', nil, beautiful.xresources.apply_dpi(tray_icon_size))
+
-- Create a tasklist widget
local pgr = pager.Pager:new(wsp, s)
@@ -117,7 +122,7 @@ awful.screen.connect_for_each_screen(function(s)
layout_bottom:add(systray)
- layout_bottom:add(layout_utils)
+ layout_bottom:add(utils_bar)
layout_bottom:add(clock_time)
layout_bottom:add(clock_date)