# -*- coding: utf-8 -*- """ This module produces list of enabled network interfaces """ import sys import subprocess from subprocess import check_output class Py3status: format = 'NET: {status}' def net_status(self): command = 'nmcli --mode multiline --colors no con show --active | rg DEVICE | awk -F":" \'{ gsub(/ /, ""); print $2}\'' return_value = check_output(command, shell=True) value = return_value.decode("utf-8") value = value.replace('\n', ', ').strip(', ') full_text = self.py3.safe_format(self.format, { 'status': value}) return { 'full_text': full_text, 'cached_until': self.py3.time_in(15) }