mirror of
https://github.com/FAUSheppy/config
synced 2025-12-07 15:31:35 +01:00
another few hl fixes
This commit is contained in:
@@ -63,7 +63,7 @@ hc keybind $Mod-p spawn pavucontrol
|
|||||||
hc keybind $Mod-Shift-l spawn libreoffice
|
hc keybind $Mod-Shift-l spawn libreoffice
|
||||||
hc keybind $Mod-t spawn icedove
|
hc keybind $Mod-t spawn icedove
|
||||||
hc keybind $Mod-Shift-i spawn urxvt -e ssh ik15ydit@ircbox.cs.fau.de -t 'tmux a -d'
|
hc keybind $Mod-Shift-i spawn urxvt -e ssh ik15ydit@ircbox.cs.fau.de -t 'tmux a -d'
|
||||||
hc keybind $Mod-Shift-t spawn urxvt -e ssh faui06c -t "/proj/ciptmp/ik15ydit/Zeug/Telegram/tg/bin/telegram-cli -k tg-server.pub"
|
hc keybind $Mod-Shift-t spawn urxvt -e ssh faui06c.cs.fau.de -t "/proj/ciptmp/ik15ydit/Zeug/Telegram/tg/bin/telegram-cli -k tg-server.pub"
|
||||||
hc keybind $Mod-j spawn /bin/bash -c "rm $HOME/.config/herbstluftwm/irc.log && herbstclient spawn urxvt -e 'exit'"
|
hc keybind $Mod-j spawn /bin/bash -c "rm $HOME/.config/herbstluftwm/irc.log && herbstclient spawn urxvt -e 'exit'"
|
||||||
hc keybind $Mod-e spawn rofi -combi-mode window,run -show combi -modi combi
|
hc keybind $Mod-e spawn rofi -combi-mode window,run -show combi -modi combi
|
||||||
hc keybind $Mod-Shift-e spawn rofi -show run
|
hc keybind $Mod-Shift-e spawn rofi -show run
|
||||||
|
|||||||
@@ -24,6 +24,6 @@ def is_laptop():
|
|||||||
return "laptop" in u.nodename or "atlantismedion" in u.nodename
|
return "laptop" in u.nodename or "atlantismedion" in u.nodename
|
||||||
|
|
||||||
def error(s):
|
def error(s):
|
||||||
with open("herbstlog",'a') as f:
|
with open(hlpath("herbstlog"),'a') as f:
|
||||||
time = str(datetime.datetime.now().time())[:-7] #cut seconds at the end
|
time = str(datetime.datetime.now().time())[:-7] #cut seconds at the end
|
||||||
f.write(time + "ERROR" + os.path.basename(__file__) + s)
|
f.write(time + " ERROR: " + os.path.basename(__file__) + ' ' +s +'\n')
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ GREY = 0x909090
|
|||||||
WHITE = 0xefefef
|
WHITE = 0xefefef
|
||||||
DEFAULT_FG = 0x476243
|
DEFAULT_FG = 0x476243
|
||||||
COLOR_BORDER = 5.0
|
COLOR_BORDER = 5.0
|
||||||
|
BAT_COLOR_OFFSET = 10
|
||||||
|
|
||||||
def color_panel(s,hex_code,seper=True):
|
def color_panel(s,hex_code,seper=True):
|
||||||
if type(hex_code)==int:
|
if type(hex_code)==int:
|
||||||
@@ -24,34 +25,38 @@ def color_panel(s,hex_code,seper=True):
|
|||||||
return "^fg(#" + hex_code + ") " + s + "^bg()"+sep
|
return "^fg(#" + hex_code + ") " + s + "^bg()"+sep
|
||||||
|
|
||||||
def get_color(nr,start,end):
|
def get_color(nr,start,end):
|
||||||
if end == start or nr > end:
|
if end == start or nr >= end:
|
||||||
return hex(GREEN)
|
return hex(GREEN)
|
||||||
else:
|
else:
|
||||||
r,g,b = 0,0,0
|
r,g,b = 0,0,0
|
||||||
interval = 256 + 256
|
interval = 256 + 256
|
||||||
custom_interval = abs(start-end)
|
custom_interval = abs(start-end)
|
||||||
div = float(interval)/float(custom_interval)
|
div = float(interval)/float(custom_interval)
|
||||||
if div >= interval/3:
|
if div >= interval:
|
||||||
error("Interval for coloring too small, using default")
|
hl_utils.error("Interval for coloring too small, using default")
|
||||||
return WHITE
|
return WHITE
|
||||||
nr = nr*div
|
nr = nr*div
|
||||||
if custom_interval > interval:
|
if custom_interval > interval:
|
||||||
custom_interval = interval
|
custom_interval = interval
|
||||||
if nr > 256:
|
if nr >= 256:
|
||||||
g = 0xFF
|
g = 0xFF
|
||||||
r = int(abs(nr - (256+256))) #counts down reverse to nr
|
r = int(abs(nr - (256+256))) #counts down reverse to nr
|
||||||
|
#aaah fuck my life
|
||||||
|
if r == 0x100:
|
||||||
|
r = 0xFF
|
||||||
b = 0
|
b = 0
|
||||||
elif nr > 0:
|
elif nr >= 0:
|
||||||
g = int(nr - 256)
|
g = int(nr)
|
||||||
r = 0xFF
|
r = 0xFF
|
||||||
b = 0
|
b = 0
|
||||||
else:
|
else:
|
||||||
error("Negative interval value???")
|
hl_utils.error("Negative interval value???")
|
||||||
|
return(WHITE)
|
||||||
r = r << 16
|
r = r << 16
|
||||||
g = g << 8
|
g = g << 8
|
||||||
tmp_col = r + g + b
|
tmp_col = r + g + b
|
||||||
if tmp_col > 0xFFFF00:
|
if tmp_col > 0xFFFF00:
|
||||||
error("color value too high")
|
hl_utils.error("color value too high")
|
||||||
return hex(tmp_col)
|
return hex(tmp_col)
|
||||||
|
|
||||||
|
|
||||||
@@ -72,7 +77,7 @@ def battery():
|
|||||||
try:
|
try:
|
||||||
bat = hl_utils.shexec("acpi -b")
|
bat = hl_utils.shexec("acpi -b")
|
||||||
bat = re.compile(r'Battery [0-9]+: ').sub('',bat)
|
bat = re.compile(r'Battery [0-9]+: ').sub('',bat)
|
||||||
return color_panel(bat.strip('\n'),get_color(int(bat.split('%')[0][-2:].rstrip('%')),0,100))
|
return color_panel(bat.strip('\n'),get_color(int(bat.split('%')[0][-2:].rstrip('%'))+BAT_COLOR_OFFSET,0,100))
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
return color_panel(str(e),RED)
|
return color_panel(str(e),RED)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user