lemonbar: temp fixes

lemonbar: temp
This commit is contained in:
kuben
2019-09-19 08:32:03 +02:00
parent 2f31eef54b
commit a86415f264
3 changed files with 54 additions and 67 deletions

View File

@@ -83,7 +83,6 @@ def nice_delete(f):
def clean_up():
common.logger.debug('Cleaning up')
common.screen.destroy()
nice_delete(config.pid_file)
nice_delete(config.fifo_file_status)
nice_term(p_conky_slow)
@@ -166,39 +165,13 @@ def exec_commands():
break
except:
common.logger.debug('Exception occured executing command\n Line in: {}\n Data: {}'.format(line_in, line_in[l:].split()))
common.logger.debug('Exception occured executing command\n Line in: {}\n Data: {}'.format(data, data[l:].split()))
if len(data) == 0:
common.logger.debug("Lemonbar output closed")
break
common.logger.debug('Read: "{0}"'.format(data.strip('\n')))
def user_screen():
# Create screen session, in UTF-8 mode, logging to fifo
common.screen = common.LemonbarScreen()
with open(config.fifo_screen_log, 'r', buffering=1) as screen_read:
empty_count = 0
while empty_count < 3:
try:
line = screen_read.readline().strip('\n')
line = common.strip_ansi_unicode(line)
common.logger.debug('Screen read line {}'.format(line))
if (not line.startswith('[CHG]')
and not line.isspace()):
#common.logger.debug('put in queue {}'.format(line))
queue_parse_job('RESP {}\n'.format(line))
if not line:
# End loop if many empty lines in a row
empty_count = empty_count + 1
else:
empty_count = 0
except:
raise
common.screen.destroy()
nice_delete(config.fifo_screen_log)
class i3_thread:
""" Helper class to start and stop threads"""
all_threads = [] # Static, contains all started threads
@@ -260,7 +233,6 @@ if __name__ == "__main__":
i3_thread(target = parse_status, desc='Parse status thread')
i3_thread(target = keep_fifo_open, desc='')
i3_thread(target = put_fifo_in_queue, desc='')
i3_thread(target = user_screen, desc='Screen thread for user commands')
modules.start_all()
common.logger.debug('Threads started')