112 lines
2.7 KiB
Python
112 lines
2.7 KiB
Python
# -*- coding: utf-8 -*-
|
|
|
|
import subprocess
|
|
import os.path
|
|
import multiprocessing
|
|
|
|
|
|
from i3pystatus import Status
|
|
|
|
status = Status(standalone=True)
|
|
|
|
COLORS = {
|
|
'Black': '#252525',
|
|
'DarkRed': '#f92672',
|
|
'DarkGreen': '#a6e22e',
|
|
'DarkYellow': '#f4bf75',
|
|
'DarkBlue': '#66d9ef',
|
|
'DarkMagenta': '#ae81ff',
|
|
'DarkCyan': '#a1efe4',
|
|
'LightGrey': '#f8f8f2',
|
|
'DarkGrey': '#75715e',
|
|
'Red': '#f92672',
|
|
'Green': '#a6e22e',
|
|
'Yellow': '#f4bf75',
|
|
'Blue': '#66d9ef',
|
|
'Magenta': '#ae81ff',
|
|
'Cyan': '#a1efe4',
|
|
'White': '#f9f8f5',
|
|
}
|
|
|
|
status.register("clock",
|
|
format="%a %Y-%m-%d %H:%M:%S",
|
|
color=COLORS['Magenta'])
|
|
|
|
status.register("load",
|
|
critical_limit=multiprocessing.cpu_count(),
|
|
critical_color=COLORS['Red'])
|
|
|
|
status.register("disk",
|
|
path="/",
|
|
format="{avail}G",
|
|
display_limit=15,
|
|
critical_limit=10,
|
|
critical_color=COLORS['Red'])
|
|
|
|
status.register("pulseaudio",
|
|
format="♪{volume}%{muted}",
|
|
color_unmuted=COLORS['White'],
|
|
color_muted=COLORS['Yellow'],
|
|
muted="M")
|
|
|
|
if os.path.exists("/sys/class/power_supply/BAT0"):
|
|
status.register("battery",
|
|
battery_ident="BAT0",
|
|
format="{consumption:.1f}W {percentage_design:.1f}%{status} {remaining:%E%h:%M}",
|
|
alert=True,
|
|
alert_percentage=20,
|
|
charging_color=COLORS['Yellow'],
|
|
full_color=COLORS['Green'],
|
|
critical_color=COLORS['Red'],
|
|
status={
|
|
"DIS": "↓",
|
|
"CHR": "↑",
|
|
"FULL": "=",
|
|
})
|
|
|
|
if os.path.exists("/sys/class/power_supply/BAT1"):
|
|
status.register("battery",
|
|
battery_ident="BAT1",
|
|
format="{consumption:.1f}W {percentage_design:.1f}%{status} {remaining:%E%h:%M}",
|
|
alert=True,
|
|
alert_percentage=20,
|
|
charging_color=COLORS['Yellow'],
|
|
full_color=COLORS['Green'],
|
|
critical_color=COLORS['Red'],
|
|
status={
|
|
"DIS": "↓",
|
|
"CHR": "↑",
|
|
"FULL": "=",
|
|
})
|
|
|
|
if os.path.exists("/sys/class/net/wlp3s0"):
|
|
status.register("wireless",
|
|
interface="wlp3s0",
|
|
format_up="{essid}",
|
|
color_up=COLORS['Green'],
|
|
color_down=COLORS['Red'])
|
|
|
|
if os.path.exists("/sys/class/net/enp0s25"):
|
|
status.register("network",
|
|
interface="enp0s25",
|
|
color_up=COLORS['Green'],
|
|
color_down=COLORS['Red'])
|
|
|
|
status.register("mem",
|
|
format="{avail_mem:.0f} MiB",
|
|
color=COLORS['Green'],
|
|
warn_color=COLORS['Yellow'],
|
|
alert_color=COLORS['Red'])
|
|
|
|
status.register("keyboard_locks",
|
|
format="{caps}",
|
|
caps_on="[CapsLock]",
|
|
caps_off="")
|
|
|
|
status.register("shell",
|
|
command="~/.i3/window.sh",
|
|
interval=0.1)
|
|
|
|
status.run()
|
|
|