mirror of
https://github.com/FAUSheppy/config
synced 2025-12-09 16:18:33 +01:00
Merge branch 'master' of gitlab.cs.fau.de:ik15ydit/config
This commit is contained in:
@@ -37,7 +37,9 @@ if [[ "$HOST" == "atlantislaptop" ]]; then
|
||||
hc keybind XF86MonBrightnessDown spawn /bin/bash -c 'tee /sys/class/backlight/intel_backlight/brightness <<< "$(expr $(cat /sys/class/backlight/intel_backlight/brightness) - 5)"'
|
||||
xautolock -time 15 -locker /home/ik15ydit/.config/i3lock/piclock.sh &
|
||||
/usr/bin/dunst &
|
||||
hc keybind $Mod-o spawn /bin/bash -c "systemctl hibernate"
|
||||
hc keybind $Mod-o spawn /bin/bash -c "/home/ik15ydit/.config/i3lock/piclock.sh & systemctl hibernate"
|
||||
hc keybind $Mod-c spawn /bin/bash -c "sudo /usr/bin/openvpn_cip.sh & ~/.config/herbstluftwm/hl_status_deamon.py --refresh"
|
||||
hc keybind $Mod-Shift-c spawn /bin/bash -c "sudo stopvpn.sh && ~/.config/herbstluftwm/hl_status_deamon.py --refresh"
|
||||
fi
|
||||
|
||||
|
||||
@@ -57,7 +59,7 @@ hc keybind $Mod-q close
|
||||
|
||||
#spawn shit
|
||||
hc keybind $Mod-Return spawn urxvt
|
||||
hc keybind $Mod-Shift-Return spawn ~/.config/herbstluftwm/cwd_helper.py
|
||||
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
|
||||
hc keybind $Mod-l spawn i3lock -i ~/.config/i3lock/bg.png -t
|
||||
@@ -166,7 +168,7 @@ hc mousebind $Mod-Button3 resize
|
||||
hc keybind $Mod-BackSpace cycle_monitor
|
||||
hc keybind $Mod-Tab cycle_all +1
|
||||
hc keybind $Mod-Shift-Tab cycle_all -1
|
||||
hc keybind $Mod-c cycle
|
||||
#hc keybind $Mod-c cycle
|
||||
#hc keybind $Mod-i jumpto urgent
|
||||
|
||||
#pulseaudio
|
||||
|
||||
@@ -25,6 +25,8 @@ def color_panel(s,hex_code,seper=True):
|
||||
return "^fg(#" + hex_code + ") " + s + "^bg()"+sep
|
||||
|
||||
def get_color(nr,start,end):
|
||||
if nr == 88:
|
||||
return hex(GREEN)
|
||||
if end == start or nr >= end:
|
||||
return hex(GREEN)
|
||||
else:
|
||||
@@ -71,6 +73,14 @@ def guthaben():
|
||||
guthaben = color_panel(guthaben,col)
|
||||
return guthaben;
|
||||
|
||||
def vpn():
|
||||
vpn = ''
|
||||
if not hl_utils.is_cip():
|
||||
tmp = -1
|
||||
with open(hl_utils.hlpath("vpn_status.log")) as f:
|
||||
tmp = f.read()
|
||||
tmp = ' '+tmp
|
||||
return tmp;
|
||||
|
||||
def battery():
|
||||
if hl_utils.is_laptop():
|
||||
@@ -88,7 +98,7 @@ def battery():
|
||||
|
||||
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"):
|
||||
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)
|
||||
@@ -125,5 +135,5 @@ def irc():
|
||||
pass
|
||||
else:
|
||||
return ''
|
||||
|
||||
print(irc(),guthaben(),battery(),sep='')
|
||||
if __name__ == "__main__":
|
||||
print(vpn(),guthaben(),battery(),sep='')
|
||||
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
from hl_utils import error, is_cip, shexec, color_remove, hlpath
|
||||
|
||||
#Druckerguthaben
|
||||
if is_cip():
|
||||
while(True):
|
||||
path = hlpath("pracct.log")
|
||||
out = color_remove(shexec("pr_acct").split("\n")[0]).split(' ')[-1]
|
||||
with open(path,'w+') as f:
|
||||
f.write(out)
|
||||
time.sleep(30)
|
||||
sys.exit()
|
||||
@@ -25,7 +25,8 @@ if window==-1:
|
||||
|
||||
############ IF URXVT GET PID ###########
|
||||
pid = -1
|
||||
out = shexec('xprop -id '+hex(window)).split('\n')
|
||||
out = subprocess.check_output(['xprop','-id',hex(window)]).decode().split('\n')
|
||||
#out = shexec('xprop -id '+hex(window)).split('\n') #not working
|
||||
for l in out:
|
||||
if l.startswith('WM_CLASS(STRING)') and 'urxvt' in l:
|
||||
break;
|
||||
53
herbstluftwm/hl_status_deamon.py
Executable file
53
herbstluftwm/hl_status_deamon.py
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/python3
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import sys
|
||||
import subprocess
|
||||
from hl_panel_content import color_panel
|
||||
from hl_utils import error, is_cip, shexec, color_remove, hlpath
|
||||
|
||||
RED = 0xff0000
|
||||
GREEN = 0x32CD32
|
||||
YELLOW = 0xffff00
|
||||
|
||||
#Druckerguthaben
|
||||
def pr_acct_status():
|
||||
if is_cip():
|
||||
path = hlpath("pracct.log")
|
||||
out = color_remove(shexec("pr_acct").split("\n")[0]).split(' ')[-1]
|
||||
with open(path,'w+') as f:
|
||||
f.write(out)
|
||||
def vpn_status():
|
||||
if not is_cip():
|
||||
vpn_path = hlpath("vpn_status.log")
|
||||
out_vpn = subprocess.check_output(["ps","-ef"]).decode().split('\n')
|
||||
#filter(lambda x: not 'openvpn' in x,out_vpn)
|
||||
ret = 0
|
||||
#worst case thats about 1k lines
|
||||
for l in out_vpn:
|
||||
if 'openvpn' in l and not 'sudo' in l and not 'grep' in l and not 'cip.sh' in l:
|
||||
ret += 1;
|
||||
#print(ret)
|
||||
if ret == 0:
|
||||
out_vpn = color_panel("VPN: Link Down",RED)
|
||||
elif ret == 1:
|
||||
out_vpn = color_panel("VPN: In Use",GREEN)
|
||||
elif ret > 1:
|
||||
out_vpn = color_panel("multiple VPNs connected",YELLOW)
|
||||
else:
|
||||
out_vpn = color_panel("VPN: ret was "+str(ret)+" ??",RED)
|
||||
#print(out_vpn)
|
||||
with open(vpn_path,'w+') as g:
|
||||
g.write(out_vpn)
|
||||
|
||||
if __name__ == '__main__':
|
||||
#print('"'+sys.argv[-1]+'"')
|
||||
if sys.argv[-1]=='--refresh':
|
||||
vpn_status()
|
||||
pr_acct_status()
|
||||
sys.exit()
|
||||
while(True):
|
||||
vpn_status()
|
||||
pr_acct_status()
|
||||
time.sleep(30)
|
||||
@@ -118,7 +118,7 @@ hc pad $monitor $panel_height
|
||||
echo -n "^bg()^fg() ${windowtitle//^/^^}"
|
||||
|
||||
####################### Interface to python layer #########################
|
||||
right="30. Mai 14 Kobras |$($HOME/.config/herbstluftwm/panel_content.py) $date"
|
||||
right="30. Mai 14 Kobras |$($HOME/.config/herbstluftwm/hl_panel_content.py) $date"
|
||||
|
||||
right_text_only=$(echo -n "$right" | sed 's.\^[^(]*([^)]*)..g')
|
||||
# get width of right aligned text.. and add some space..
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
#!/bin/bash
|
||||
FG='white'
|
||||
BG='black'
|
||||
FONT="-*-fixed-medium-*-*-*-12-*-*-*-*-*-*-*"
|
||||
|
||||
function uniq_linebuffered() {
|
||||
awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
|
||||
}
|
||||
|
||||
{
|
||||
conky -c ~/.conkyrc_herbstluft | while read -r; do
|
||||
echo -e "conky $REPLY";
|
||||
#break
|
||||
done > >(uniq_linebuffered) &
|
||||
childpid=$!
|
||||
herbstclient --idle
|
||||
kill $childpid
|
||||
} | {
|
||||
TAGS=( $(herbstclient tag_status $monitor) )
|
||||
conky=""
|
||||
separator="^fg(#1793D0)^ro(1x16)^fg()"
|
||||
while true; do
|
||||
for i in "${TAGS[@]}" ; do
|
||||
echo -n "^ca(1,herbstclient use ${i:1}) "
|
||||
case ${i:0:1} in
|
||||
'#')
|
||||
echo -n "^fg(#1793D0)[^fg(#FFFFFF)${i:1}^fg(#1793D0)]"
|
||||
;;
|
||||
':')
|
||||
echo -n "^fg(#FFFFFF) ${i:1} "
|
||||
;;
|
||||
*)
|
||||
echo -n "^fg(#123456) ${i:1} "
|
||||
;;
|
||||
esac
|
||||
echo -n "^ca()"
|
||||
done
|
||||
echo -n " $separator"
|
||||
conky_text_only=$(echo -n "$conky"|sed 's.\^[^(]*([^)]*)..g')
|
||||
width=$(textwidth "$FONT" "$conky_text_only ")
|
||||
echo -n "^p(_RIGHT)^p(-$width)$conky"
|
||||
echo
|
||||
read line || break
|
||||
cmd=( $line )
|
||||
case "$cmd[0]" in
|
||||
tag*)
|
||||
TAGS=( $(herbstclient tag_status $monitor) )
|
||||
;;
|
||||
conky*)
|
||||
conky="${cmd[@]:1}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
} 2> /dev/null |dzen2 -ta l -y 0 -x 0 -h 16 -w 1286 -fg $FG -bg $BG -fn $FONT &
|
||||
Reference in New Issue
Block a user