circle on motd services
This commit is contained in:
parent
d779d0fdba
commit
8337f83aa0
|
@ -52,7 +52,7 @@ class Termutils:
|
||||||
elif i == math.ceil(length * 0.6):
|
elif i == math.ceil(length * 0.6):
|
||||||
bar += Termutils.YELLOW
|
bar += Termutils.YELLOW
|
||||||
percent_color = Termutils.YELLOW
|
percent_color = Termutils.YELLOW
|
||||||
elif i == math.ceil(length * 0.85):
|
elif i == math.ceil(length * 0.9):
|
||||||
bar += Termutils.RED
|
bar += Termutils.RED
|
||||||
percent_color = Termutils.RED
|
percent_color = Termutils.RED
|
||||||
|
|
||||||
|
@ -79,23 +79,6 @@ def print_hostname():
|
||||||
+ '\n'
|
+ '\n'
|
||||||
)
|
)
|
||||||
|
|
||||||
def print_tmux():
|
|
||||||
try:
|
|
||||||
check_call(['tmux', 'info'], stdout=DEVNULL, stderr=DEVNULL)
|
|
||||||
print('tmux:')
|
|
||||||
tmux_session = os.popen('tmux display-message -p "#S"', 'r').read().strip()
|
|
||||||
with os.popen('tmux list-sessions', 'r') as tmux_ls:
|
|
||||||
for line in tmux_ls:
|
|
||||||
line = line.strip()
|
|
||||||
if line.startswith(tmux_session) and 'TMUX' in os.environ:
|
|
||||||
print(Termutils.GREEN, end='')
|
|
||||||
Termutils.print_padded(
|
|
||||||
line
|
|
||||||
+ Termutils.DISABLE)
|
|
||||||
print('')
|
|
||||||
except CalledProcessError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def print_services():
|
def print_services():
|
||||||
if 'MOTD_SERVICES' in os.environ:
|
if 'MOTD_SERVICES' in os.environ:
|
||||||
print('Services:')
|
print('Services:')
|
||||||
|
@ -103,9 +86,9 @@ def print_services():
|
||||||
Termutils.print_padded('{:<15.15}'.format(service), end='')
|
Termutils.print_padded('{:<15.15}'.format(service), end='')
|
||||||
try:
|
try:
|
||||||
check_call(['systemctl', 'is-active', service], stdout=DEVNULL, stderr=DEVNULL)
|
check_call(['systemctl', 'is-active', service], stdout=DEVNULL, stderr=DEVNULL)
|
||||||
print('{} active{}'.format(Termutils.GREEN, Termutils.DISABLE))
|
print('{} ● active{}'.format(Termutils.GREEN, Termutils.DISABLE))
|
||||||
except CalledProcessError:
|
except CalledProcessError:
|
||||||
print('{} inactive{}'.format(Termutils.RED, Termutils.DISABLE))
|
print('{} ● inactive{}'.format(Termutils.RED, Termutils.DISABLE))
|
||||||
print('')
|
print('')
|
||||||
|
|
||||||
|
|
||||||
|
@ -143,8 +126,26 @@ def print_fs():
|
||||||
)
|
)
|
||||||
print('')
|
print('')
|
||||||
|
|
||||||
|
def print_tmux():
|
||||||
|
try:
|
||||||
|
check_call(['tmux', 'info'], stdout=DEVNULL, stderr=DEVNULL)
|
||||||
|
print('tmux:')
|
||||||
|
tmux_session = os.popen('tmux display-message -p "#S"', 'r').read().strip()
|
||||||
|
with os.popen('tmux list-sessions', 'r') as tmux_ls:
|
||||||
|
for line in tmux_ls:
|
||||||
|
line = line.strip()
|
||||||
|
if line.startswith(tmux_session) and 'TMUX' in os.environ:
|
||||||
|
print(Termutils.GREEN, end='')
|
||||||
|
Termutils.print_padded(
|
||||||
|
line
|
||||||
|
+ Termutils.DISABLE)
|
||||||
|
print('')
|
||||||
|
except CalledProcessError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
print_hostname()
|
print_hostname()
|
||||||
print_tmux()
|
|
||||||
print_services()
|
print_services()
|
||||||
print_mem()
|
print_mem()
|
||||||
print_fs()
|
print_fs()
|
||||||
|
print_tmux()
|
||||||
|
|
|
@ -9,7 +9,7 @@ export EDITOR=vim
|
||||||
export PAGER=less
|
export PAGER=less
|
||||||
|
|
||||||
# motd
|
# motd
|
||||||
export MOTD_SERVICES="docker $MOTD_SERVICES"
|
export MOTD_SERVICES="docker.socket $MOTD_SERVICES"
|
||||||
|
|
||||||
# firefox
|
# firefox
|
||||||
export MOZ_USE_XINPUT2=1
|
export MOZ_USE_XINPUT2=1
|
||||||
|
|
Loading…
Reference in New Issue