Skip to content
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

Added battery identity to show widget for the specific one #189

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions battery-widget/battery.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ local battery_widget = {}
local function worker(args)
local args = args or {}

local bat_num = args.bat_num or 0
local font = args.font or 'Play 8'
local path_to_icons = args.path_to_icons or "/usr/share/icons/Arc/status/symbolic/"
local show_current_level = args.show_current_level or false
Expand All @@ -44,6 +45,7 @@ local function worker(args)
enable_battery_warning = true
end

local bat_expr = 'Battery ' .. bat_num
if not gfs.dir_readable(path_to_icons) then
naughty.notify{
title = "Battery Widget",
Expand Down Expand Up @@ -74,7 +76,7 @@ local function worker(args)
-- One way of creating a pop-up notification - naughty.notify
local notification
local function show_battery_status(batteryType)
awful.spawn.easy_async([[bash -c 'acpi']],
awful.spawn.easy_async('bash -c "acpi | grep \'' .. bat_expr .. '\'"',
function(stdout, _, _, _)
naughty.destroy(notification)
notification = naughty.notify{
Expand Down Expand Up @@ -117,7 +119,7 @@ local function worker(args)
local last_battery_check = os.time()
local batteryType = "battery-good-symbolic"

watch("acpi -i", timeout,
watch('bash -c "acpi -i | grep \'' .. bat_expr .. '\'"', timeout,
function(widget, stdout, stderr, exitreason, exitcode)
local battery_info = {}
local capacities = {}
Expand Down