lemonbar: Get rid of wlan dummy on kubaDesktop
This commit is contained in:
@@ -175,30 +175,33 @@ conky.config = {{
|
||||
}}
|
||||
""".format(update_interval)
|
||||
|
||||
def conky_net(iface):
|
||||
return """\\
|
||||
${{if_up {iface}}}${{downspeedf {iface}}} ${{upspeedf {iface}}}\\
|
||||
${{else}}down down${{endif}} """.format(iface=iface)
|
||||
|
||||
conky_begin_body = """
|
||||
conky.text = [["""
|
||||
|
||||
conky_end_body = """
|
||||
]]"""
|
||||
class ConkyFastModule(LemonModule):
|
||||
if common.hostname() == 'kubaDesktop':
|
||||
conky_config = conky_config(update_interval=1) + """
|
||||
conky.text = [[
|
||||
${exec ~/.i3/lemonbar/get_vol.sh} \
|
||||
down down\
|
||||
\
|
||||
${if_up enp5s0}${downspeedf enp5s0} ${upspeedf enp5s0}\
|
||||
${else}down down${endif}\
|
||||
\
|
||||
]]
|
||||
"""
|
||||
conky_config = (conky_config(update_interval=1)
|
||||
+ conky_begin_body
|
||||
+ """\\
|
||||
${exec ~/.i3/lemonbar/get_vol.sh} """
|
||||
+ conky_net('enp5s0')
|
||||
+ conky_end_body)
|
||||
else:
|
||||
conky_config = conky_config(update_interval=2) + """
|
||||
conky.text = [[
|
||||
${exec ~/.i3/lemonbar/get_vol.sh} \
|
||||
${if_up wlp3s0}${downspeedf wlp3s0} ${upspeedf wlp3s0}\
|
||||
${else}down down${endif}\
|
||||
\
|
||||
${if_up enp2s0}${downspeedf enp2s0} ${upspeedf enp2s0}\
|
||||
${else}down down${endif}\
|
||||
\
|
||||
]]
|
||||
"""
|
||||
conky_config = (conky_config(update_interval=1)
|
||||
+ conky_begin_body
|
||||
+ """\\
|
||||
${exec ~/.i3/lemonbar/get_vol.sh} """
|
||||
+ conky_net('wlp3s0')
|
||||
+ conky_net('enp2s0')
|
||||
+ conky_end_body)
|
||||
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
@@ -209,20 +212,26 @@ ${else}down down${endif}\
|
||||
self.p_handle.stdin.close() # Otherwise conky doesn't load
|
||||
self.status_handle = self.p_handle.stdout
|
||||
|
||||
self.wlan_load = parser.IconTextUnit('wlan_load', action='wlan', order=13)
|
||||
self.eth_load = parser.IconTextUnit('eth_load', action='eth', order=14)
|
||||
self.volume = parser.IconTextUnit('volume', action='pavu', order=20)
|
||||
|
||||
|
||||
self.register_action('wlan' , self.nmtui)
|
||||
self.register_action('pavu', self.pavu)
|
||||
|
||||
if common.hostname() != 'kubaDesktop':
|
||||
self.wlan_load = parser.IconTextUnit('wlan_load', action='wlan', order=13)
|
||||
self.register_action('wlan', self.nmtui)
|
||||
self._parse_data = self._parse_data_w_wlan
|
||||
else:
|
||||
self._parse_data = self._parse_data_wo_wlan
|
||||
|
||||
|
||||
def _stop_module(self):
|
||||
if self.p_handle is not None:
|
||||
self.p_handle.terminate()
|
||||
|
||||
|
||||
def _parse_data(self, data):
|
||||
def _parse_data_w_wlan(self, data):
|
||||
# wlan and eth
|
||||
(wland_v, wlanu_v) = format_load(data[1:3], self.wlan_load, config.net_alert)
|
||||
self.wlan_load.items = [(config.icon_wlan + config.icon_dl, wland_v)
|
||||
@@ -239,6 +248,18 @@ ${else}down down${endif}\
|
||||
config.icon_vol_low if vol < 50 else config.icon_vol
|
||||
self.volume.items = [(icon_v, vols)]
|
||||
|
||||
def _parse_data_wo_wlan(self, data):
|
||||
(ethd_v, ethu_v) = format_load(data[1:3], self.eth_load, config.net_alert)
|
||||
self.eth_load.items = [(config.icon_eth + config.icon_dl, ethd_v)
|
||||
,(config.icon_ul, ethu_v)]
|
||||
|
||||
# Volume
|
||||
mute = data[0] == 'MUTE' or data[0] == 'NONE'
|
||||
(vol,vols) = (-1,'×') if mute else (int(data[0]), data[0]+'%')
|
||||
icon_v = config.icon_vol_mute if vol == 0 else \
|
||||
config.icon_vol_low if vol < 50 else config.icon_vol
|
||||
self.volume.items = [(icon_v, vols)]
|
||||
|
||||
def nmtui(self):
|
||||
p = subprocess.Popen(['xterm', '-class', 'FLOAT_TERM', '-e', 'nmtui'])
|
||||
common.kill_on_unfocus.append(p.pid)
|
||||
|
||||
Reference in New Issue
Block a user