lemonbar: Some progress with screen

This commit is contained in:
kuben
2019-08-07 21:54:47 +02:00
parent fc82366233
commit 0b0b6382e0
2 changed files with 21 additions and 14 deletions

View File

@@ -110,7 +110,7 @@ def clean_up():
nice_delete(config.fifo_file_executor)
nice_term(p_conky_slow)
nice_term(p_conky_fast)
nice_term(common.p_screen)
common.stuff_screen('kill')
if i3_ws_obj is not None:
i3_ws_obj.quit()
sys.exit(0)
@@ -192,20 +192,26 @@ def strip_ansi_unicode(s):
return strip_unicode
def user_screen():
# Attach to screen session, creating if needed, in UTF-8 mode
common.p_screen = subprocess.Popen(common.screen_args # TODO lemonbar_user
,stdin=subprocess.PIPE, stdout=subprocess.PIPE, text=True)
for line in common.p_screen.stdout:
#try:
common.logger.debug('Screen read line {}'.format(line.strip('\n')))
# Create screen session, in UTF-8 mode, logging to fifo
create_new_fifo(config.fifo_screen_log)
subprocess.Popen(common.screen_args) # TODO lemonbar_user
with open(config.fifo_screen_log, 'r', buffering=1) as screen_read:
while True:
try:
line = screen_read.readline()
if not line:
break
common.logger.debug('Screen read line {}'.format(line.strip('\n')))
# with open(config.fifo_file_status, 'w') as fifo:
# clean_line = strip_ansi_unicode(line)
# if (not clean_line.startswith('[bluetooth]')
# and not clean_line.startswith('[CHG]')
# and not clean_line.isspace()):
# fifo.write('RESP [bluetoothctl] ' + clean_line)
#except:
# raise
except:
raise
nice_delete(config.fifo_screen_log)
class i3_thread:
""" Helper class to start and stop threads"""