This commit is contained in:
root
2017-11-02 15:57:32 +01:00
parent 9a0c714b28
commit 35bb9c696c
7 changed files with 33 additions and 1 deletions

Binary file not shown.

View File

@@ -74,7 +74,7 @@ def battery():
plain = int(bat.split('%')[0][-3:].rstrip('%').lstrip(',')) plain = int(bat.split('%')[0][-3:].rstrip('%').lstrip(','))
## imediatelly return if full and on supply ## ## imediatelly return if full and on supply ##
if bat.startswith("Full") or bat.startswith('Unknown'): if bat.startswith("Full") or bat.startswith('Unknown') or "Charging, 100%" in bat:
return hl_utils.color_panel("On Supply and fully charged",GREEN) return hl_utils.color_panel("On Supply and fully charged",GREEN)
## calculate average time remaining ## ## calculate average time remaining ##
@@ -180,6 +180,7 @@ def ip_status():
last_ip = ip last_ip = ip
tmp = hl_utils.color_panel(ip,GREEN) tmp = hl_utils.color_panel(ip,GREEN)
except: except:
last_ip = ""
tmp = hl_utils.color_panel("Offline",RED) tmp = hl_utils.color_panel("Offline",RED)
with open(hl_utils.hlpath(IP_LOG),'w') as g: with open(hl_utils.hlpath(IP_LOG),'w') as g:
g.write(tmp) g.write(tmp)

BIN
herbstluftwm/hl_utils.pyc Normal file

Binary file not shown.

View File

@@ -0,0 +1 @@
30403

View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
source uniq_linebuffered.sh
### Generates the output for the rightside of the panel ###
hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;}
hc pad $monitor $panel_height
{
while true ; do
printf 'pystat\t%s\n' "$($HOME/.config/herbstluftwm/hl_panel_content.py)"
sleep 1 || break
done > >(uniq_linebuffered) &
## save pid and wait for signal ##
childpid=$!
hc --idle
kill $childpid
}

0
herbstluftwm/t Normal file
View File

View File

@@ -0,0 +1,10 @@
#!/bin/bash
if awk -Wv 2>/dev/null | head -1 | grep -q '^mawk'; then
uniq_linebuffered() {
awk -W interactive '$0 != l { print ; l=$0 ; fflush(); }' "$@"
}
else
uniq_linebuffered() {
awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
}
fi