~speguero/wm-stat-pwr

3437e84da42fcf60093bc7f6f545d190ee6734e4 — Steven Peguero 4 months ago 9d4a892 master
rename project name (again)
5 files changed, 25 insertions(+), 25 deletions(-)

M LICENSE
M README.md
M contrib/i3blocks.ini
M contrib/lemonbar.sh
R wmbattstat => wm-stat-pwr
M LICENSE => LICENSE +1 -1
@@ 1,6 1,6 @@
The MIT License (MIT)

Copyright (c) 2020 Steven Peguero
Copyright (c) 2022 Steven Peguero

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

M README.md => README.md +7 -7
@@ 1,6 1,6 @@
# wmbattstat
# wm-stat-pwr

`wmbattstat` is an [`i3blocks`](https://github.com/vivien/i3blocks) status indicator that reports a percentage of available battery power on your machine, based upon a single battery or a total sum of available power between all present batteries.
`wm-stat-pwr` is an [`i3blocks`](https://github.com/vivien/i3blocks) status indicator that reports a percentage of available battery power on your machine, based upon a single battery or a total sum of available power between all present batteries.

---



@@ 21,22 21,22 @@

## Disclaimer

Due to the nature of battery technology and issues of inaccuracy from estimated times of remaining life before loss of power, `wmbattstat` does not, and will never, report such information.
Due to the nature of battery technology and issues of inaccuracy from estimated times of remaining life before loss of power, `wm-stat-pwr` does not, and will never, report such information.

## Install

__1)__ Copy `wmbattstat` to a directory of your choosing.
__1)__ Copy `wm-stat-pwr` to a directory of your choosing.

__2)__ Edit your `i3blocks` configuration file and add the following configuration:

```ini
[wmbattstat]
command=/path/to/wmbattstat
[wm-stat-pwr]
command=/path/to/wm-stat-pwr
label=B
interval=1
```

Specify the full path of `wmbattstat` in the `command` argument.
Specify the full path of `wm-stat-pwr` in the `command` argument.

__3)__ Refresh your i3 or Sway session and enjoy.


M contrib/i3blocks.ini => contrib/i3blocks.ini +2 -2
@@ 1,4 1,4 @@
[wmbattstat]
command=/path/to/wmbattstat
[wm-stat-pwr]
command=/path/to/wm-stat-pwr
label=B
interval=1

M contrib/lemonbar.sh => contrib/lemonbar.sh +5 -5
@@ 1,17 1,17 @@
#!/bin/sh

# Provides de-facto wmbattstat support for lemonbar (https://github.com/lemonboy/bar).
# Provides de-facto wm-stat-pwr support for lemonbar (https://github.com/lemonboy/bar).
#
# To test, run the following in a shell:
# 
# `sh lemonbar.sh | lemonbar`
#
# Copy the function found below over to your own lemonbar config, change the path
# of wmbattstat to wherever you have it stored, and enjoy.
# of wm-stat-pwr to wherever you have it stored, and enjoy.

wmbattstat()
wm-stat-pwr()
{
	script_file="$(../wmbattstat)"
	script_file="$(../wm-stat-pwr)"
	output_text="$(echo $script_file | awk -F ' ' '{ print $1 " " $2 }')"
	output_color="$(echo $script_file | awk -F ' ' '{ print $3 }')"



@@ 20,7 20,7 @@ wmbattstat()

while true
do
	wmbattstat
	wm-stat-pwr
	sleep 1
done


R wmbattstat => wm-stat-pwr +10 -10
@@ 1,11 1,11 @@
#!/usr/bin/env python3

'''
   _________________________
  |                         |_
  |   W M B A T T S T A T   | |
  |   *- - - - - - - - -*   |_|
  |_________________________|
   ___________________________
  |                           |_
  |   W M - S T A T - P W R   | |
  |   *- - - - - - - - - -*   |_|
  |___________________________|

'''



@@ 312,19 312,19 @@ def get_block_fg_color(batt_percent):
			raise

		if 0 <= batt_percent < 20:
			return '#FF0000\n'
			return '#FF0000'

		elif batt_percent < 45:
			return '#FFAE00\n'
			return '#FFAE00'

		elif batt_percent < 70:
			return '#FFF600\n'
			return '#FFF600'

		elif batt_percent < 95:
			return '#A8FF00\n'
			return '#A8FF00'

		elif 95 <= batt_percent <= 100:
			return '#00FF00\n'
			return '#00FF00'

		else:
			raise