batter widget

This commit is contained in:
Roland Schneider 2021-07-29 14:24:17 +02:00
parent 29b0263dfa
commit 33f8e11557
4 changed files with 32 additions and 14 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
battery-widget

View File

@ -7,6 +7,14 @@ function run {
fi
}
# utilities in top bar
# network manager
run /usr/bin/nm-applet
# bluetooth indicator
run /usr/bin/blueman-manager
# screenshot utility
run /usr/bin/shutter
# tag 1
run /usr/local/bin/idea
# tag 2

2
install-deps.sh Normal file
View File

@ -0,0 +1,2 @@
git clone https://github.com/deficient/battery-widget.git
sudo apt-get install acpid

35
rc.lua
View File

@ -13,6 +13,7 @@ local hotkeys_popup = require("awful.hotkeys_popup").widget
-- Enable hotkeys help widget for VIM and other apps
-- when client with a matching name is opened:
require("awful.hotkeys_popup.keys")
local battery_widget = require("battery-widget")
-- Load Debian menu entries
local debian = require("debian.menu")
@ -20,6 +21,20 @@ local has_fdo, freedesktop = pcall(require, "freedesktop")
local KEY_ALT = "Mod1"
local tag1 = "1:idea"
local tag2 = "2:brow"
local tag3 = "3:term"
local tag4 = "4:code"
local tag5 = "5:zoom"
local tag6 = "6:chat"
local tag7 = "7:pass"
local tag8 = "8"
local tag9 = "9"
local tags = {
tag1,tag2,tag3,tag4,tag5,tag6,tag7,tag8,tag9
}
-- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config)
@ -48,6 +63,7 @@ end
-- {{{ Variable definitions
-- Themes define colours, icons, font and wallpapers.
beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua")
beautiful.font = "DejaVu Sans 12"
-- This is used later as the default terminal and editor to run.
terminal = "x-terminal-emulator"
@ -138,7 +154,10 @@ mykeyboardlayout = awful.widget.keyboardlayout()
-- {{{ Wibar
-- Create a textclock widget
mytextclock = wibox.widget.textclock()
-- mytextclock = wibox.widget.textclock()
mytextclock = wibox.widget.textclock("%Y-%m-%d, %a, %H:%M:%S",1)
mybatterywidget = battery_widget { adapter = "BAT0", ac = "AC" }
-- Create a wibox for each screen and add it
local taglist_buttons = gears.table.join(
@ -198,19 +217,6 @@ end
-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
screen.connect_signal("property::geometry", set_wallpaper)
local tag1 = "1:idea"
local tag2 = "2:brow"
local tag3 = "3:term"
local tag4 = "4:code"
local tag5 = "5:zoom"
local tag6 = "6:chat"
local tag7 = "7:pass"
local tag8 = "8"
local tag9 = "9"
local tags = {
tag1,tag2,tag3,tag4,tag5,tag6,tag7,tag8,tag9
}
awful.screen.connect_for_each_screen(function(s)
-- Wallpaper
@ -260,6 +266,7 @@ end
mykeyboardlayout,
wibox.widget.systray(),
mytextclock,
mybatterywidget,
s.mylayoutbox,
},
}