lemonbar: Move conky configs into modules

This commit is contained in:
2019-12-03 21:55:44 +01:00
committed by kuben
parent c6f48faff0
commit 05ece594ad
4 changed files with 58 additions and 58 deletions

View File

@@ -1,26 +0,0 @@
-- Conky for external bar
-- out simple text to console
conky.config = {
background=false,
update_interval=0.2,
total_run_times=0,
override_utf8_locale=true,
short_units=true,
uppercase=false,
out_to_console=true,
out_to_x=false,
if_up_strictness='address',
format_human_readable=true,
}
conky.text = [[
${time %a %d %b %H:%M:%S} \
${exec ~/.i3/lemonbar/get_vol.sh} \
${if_up wlp3s0}${downspeedf wlp3s0} ${upspeedf wlp3s0}\
${else}down down${endif}\
\
${if_up enp5s0}${downspeedf enp2s0} ${upspeedf enp5s0}\
${else}down down${endif}\
\
]]

View File

@@ -1,25 +0,0 @@
-- Conky for external bar
-- out simple text to console
conky.config = {
background=false,
update_interval=5,
total_run_times=0,
override_utf8_locale=true,
short_units=true,
uppercase=false,
out_to_console=true,
out_to_x=false,
if_up_strictness='address',
format_human_readable=true,
}
conky.text = [[
${cpu} \
${mem} \
${fs_used_perc /} \
${fs_used_perc /home} \
F100 \
100.00 \
${exec /home/kuba/.i3/scripts/lang.sh show}
]]

View File

@@ -7,9 +7,6 @@ fifo_file_status = '/tmp/i3_lemonbar1_{}'.format(getpass.getuser())
fifo_screen_log = '/tmp/i3_screen_{}'.format(getpass.getuser()) fifo_screen_log = '/tmp/i3_screen_{}'.format(getpass.getuser())
health_file = '/tmp/i3_lemonbar_health.info' health_file = '/tmp/i3_lemonbar_health.info'
path="/home/kuba/.i3/lemonbar/"
logpath="/home/kuba/lemonbar.log" # Write here on exceptions
# color definitions # color definitions
color_back = "#FF1D1F21" # Default background color_back = "#FF1D1F21" # Default background
color_fore = "#FFC5C8C6" # Default foreground color_fore = "#FFC5C8C6" # Default foreground

View File

@@ -72,14 +72,41 @@ def format_load(data, module, alert):
return (d_v, u_v) return (d_v, u_v)
class ConkyFastModule(LemonModule): class ConkyFastModule(LemonModule):
# TODO use internal python stuff for stuff like clock, then raise update interval
conky_config = """
conky.config = {
background=false,
update_interval=0.2,
total_run_times=0,
override_utf8_locale=true,
short_units=true,
uppercase=false,
out_to_console=true,
out_to_x=false,
if_up_strictness='address',
format_human_readable=true,
}
conky.text = [[
${time %a %d %b %H:%M:%S} \
${exec ~/.i3/lemonbar/get_vol.sh} \
${if_up wlp3s0}${downspeedf wlp3s0} ${upspeedf wlp3s0}\
${else}down down${endif}\
\
${if_up enp5s0}${downspeedf enp2s0} ${upspeedf enp5s0}\
${else}down down${endif}\
\
]]
"""
def __init__(self): def __init__(self):
self.show_secs = False self.show_secs = False
super().__init__() super().__init__()
def _start_module(self): def _start_module(self):
self.p_handle = subprocess.Popen(['conky', '-c', config.path+'conky_fast'], self.p_handle = subprocess.Popen(['conky', '-c', '-'],
stdout=subprocess.PIPE, text=True) stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
self.p_handle.stdin.write(self.conky_config)
self.p_handle.stdin.close() # Otherwise conky doesn't load
self.status_handle = self.p_handle.stdout self.status_handle = self.p_handle.stdout
self.wlan_load = parser.IconTextUnit('wlan_load', action='wlan', order=13) self.wlan_load = parser.IconTextUnit('wlan_load', action='wlan', order=13)
@@ -150,12 +177,39 @@ class ConkyFastModule(LemonModule):
class ConkySlowModule(LemonModule): class ConkySlowModule(LemonModule):
conky_config = """
conky.config = {
background=false,
update_interval=5,
total_run_times=0,
override_utf8_locale=true,
short_units=true,
uppercase=false,
out_to_console=true,
out_to_x=false,
if_up_strictness='address',
format_human_readable=true,
}
conky.text = [[
${cpu} \
${mem} \
${fs_used_perc /} \
${fs_used_perc /home} \
F100 \
100.00 \
${exec /home/kuba/.i3/scripts/lang.sh show}
]]
"""
def __init__(self): def __init__(self):
super().__init__() super().__init__()
def _start_module(self): def _start_module(self):
self.p_handle = subprocess.Popen(['conky', '-c', config.path+'conky_slow'], self.p_handle = subprocess.Popen(['conky', '-c', '-'],
stdout=subprocess.PIPE, text=True) stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
self.p_handle.stdin.write(self.conky_config)
self.p_handle.stdin.close() # Otherwise conky doesn't load
self.status_handle = self.p_handle.stdout self.status_handle = self.p_handle.stdout
self.sys_load = parser.IconTextUnit('sys_load', action='load', order=10) self.sys_load = parser.IconTextUnit('sys_load', action='load', order=10)