This commit is contained in:
Sheppy
2017-07-24 17:52:24 +02:00
parent aca8e4a19e
commit 250938a63a
3 changed files with 42 additions and 4 deletions

View File

@@ -60,6 +60,7 @@ hc keybind $Mod-q close
#spawn shit
hc keybind $Mod-Return spawn urxvt
hc keybind $Mod-y spawn urxvt #easier to press with one hand
hc keybind $Mod-Shift-Return spawn ~/.config/herbstluftwm/hl_start_urxvt_cwd.py
hc keybind $Mod-i spawn urxvt -e nohup zsh -c "chromium &" #need to reliably use the zshconf chromium
if [[ $HOST =~ atlantis* ]]; then

View File

@@ -5,7 +5,7 @@ import time
import sys
import subprocess
from hl_panel_content import color_panel
from hl_utils import error, is_cip, shexec, color_remove, hlpath
from hl_utils import error, is_cip, shexec, color_remove, hlpath, is_laptop
RED = 0xff0000
GREEN = 0x32CD32
@@ -41,13 +41,49 @@ def vpn_status():
with open(vpn_path,'w+') as g:
g.write(out_vpn)
def battery():
try:
bat = hl_utils.shexec("acpi -b")
if bat == '':
return color_panel("BATTERY FAILURE",RED)
bat = re.compile(r'Battery [0-9]+: ').sub('',bat)
plain = int(bat.split('%')[0][-3:].rstrip('%').lstrip(','))
#cur_time = [bat.split('%, ')[1].split(' ')[0].split(':')]
if plain > 10:
plain += BAT_COLOR_OFFSET
if bat.startswith("Charging"):
return color_panel("Charging",GREEN,seper=False) + color_panel(bat.lstrip("Charging ,").strip('\n'),get_color(plain,0,100))
elif bat.startswith("Full") or bat.startswith('Unknown'):
return color_panel("On Supply and fully charged",GREEN)
elif plain <= 1:
return color_panel(">>>>>>>>>>>>>>>> --------------- WARNING BATTER FAILURE IMMINENT --------------- <<<<<<<<<<<<<",RED)
elif bat.startswith("Discharging"):
return color_panel("Discharging",RED,seper=False) + color_panel(bat.lstrip("Discharging ,").strip('\n'),get_color(plain,0,100))
else:
return color_panel(bat.strip('\n'),get_color(plain,0,100))
except ValueError as e:
return color_panel(str(e),RED)
def battery_status():
if is_laptop:
with open(hlpatch("battery.log")) as g:
g.write(battery())
if __name__ == '__main__':
#print('"'+sys.argv[-1]+'"')
if sys.argv[-1]=='--refresh':
vpn_status()
pr_acct_status()
battery()
sys.exit()
while(True):
vpn_status()
pr_acct_status()
battery_status()
time.sleep(30)

7
zshrc
View File

@@ -169,8 +169,8 @@ alias mountcip="sshfs ik15ydit@faui00n.cs.fau.de:/ -o reconnect,idmap=user $CIP_
alias umountcip="fusermount -u $CIP_MOUNTPOINT"
## CONNECT Locally ##
alias -g atlantislaptop="ik15ydit@atlantislaptop.local"
alias -g atlantismedion="ik15ydit@atlantismedion.local"
#alias -g atlantislaptop="ik15ydit@atlantislaptop.local"
#alias -g atlantismedion="ik15ydit@atlantismedion.local"
## DIRECT TO CONFIG ##
alias hlconf="vim ~/.config/herbstluftwm/autostart"
@@ -197,6 +197,7 @@ fi
if [[ $HOST =~ atlantis* ]]; then
alias dual="xrandr --output DVI-I-2 --right-of DVI-I-1"
alias shutown="/sbin/poweroff"
alias s2disk="sudo /usr/sbin/s2disk"
fi
if [[ $HOST == "atlantislaptop" ]]; then
alias backlightctl="tee /sys/class/backlight/intel_backlight/brightness <<< $1"
@@ -253,7 +254,7 @@ else
PECO=/usr/bin/
fi
alias cfind='print -z $(cat ~/.config/zshhistory.log | $PECO/peco)'
alias cfind='print -z $(g/zshhistory.log | $PECO/peco)'
hhs(){print -z "$(cat ~/.config/zshhistory.log | $PECO/peco)"}
zle -N hhstest hhs
bindkey ^R hhstest