123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- #!/bin/python3
- # coding=utf-8
- from i3pystatus import Status
-
- from i3status.upower import UPower
- from i3status.network_traffic import NetworkTraffic
- from i3status.ping import Ping
- from i3status.arch_updates import ArchUpdates
- from i3status.my_ip import MyIP
-
- # We change i3pystatus
- import i3status.change_i3pystatus
- i3status.change_i3pystatus.change_all()
-
- ###############################################################################
- # COLORS
- ###############################################################################
- g_color_normal = "#AEAEAE"
- g_color_second = "#66E0FF"
- g_color_good = "#8DE28D"
- g_color_warn = "#D68533"
- g_color_alert = "#FF5555"
-
-
- ###############################################################################
- # Clock
- ###############################################################################
-
- status = Status(standalone=True)
-
- status.register("clock",
- color=g_color_second,
- format="%d/%m/%y %H:%M:%S")
-
-
- ###############################################################################
- # Battery, sound and light
- ###############################################################################
- status.register(UPower,
- alert_percent=30,
- format_chr="\uf214↑ {percentage}% {time_to_full}",
- format_dis="\uf214↓ {percentage}% {time_to_empty}",
- format_dis_alert="\uf215↓ {percentage}% {time_to_empty}",
- format_full="\uf213 {percentage}%",
- format_dpl="\uf212",
- color_chr=g_color_second,
- color_dis=g_color_warn,
- color_dis_alert=g_color_alert,
- color_full=g_color_good,
- color_dpl=g_color_alert)
-
- status.register("alsa",
- mixer="Master",
- card=0,
- color_muted=g_color_warn,
- format_muted="\uf026 0%",
- format="\uf028 {volume:.0f}%")
-
- #status.register("backlight",
- # interval=1,
- # backlight="acpi_video0",
- # format="\uf39b {percentage}%")
-
-
- ###############################################################################
- # Processor and memory status
- ###############################################################################
- #status.register("temp",
- # file="/sys/class/thermal/thermal_zone1/temp",
- #alert_temp=55,
- # color=g_color_good,
- #alert_color=g_color_alert,
- # format="\uf3b6 {temp:.0f}°C")
-
- status.register("cpu_usage",
- format="\uf0e4 {usage:02}%")
-
- status.register("mem",
- color=g_color_good,
- warn_color=g_color_warn,
- alert_color=g_color_alert,
- format="\uf085 {avail_mem:.0f}M")
-
- ###############################################################################
- # Pacman
- ###############################################################################
- #status.register(ArchUpdates,
- # format=u"\uf500{count_pacman}|{count_yaourt}")
-
-
- ###############################################################################
- # disk usage
- ###############################################################################
- status.register("disk",
- path="/",
- critical_limit=7,
- format="\uf07b {avail}G")
-
- status.register("disk",
- path="/home",
- critical_limit=5,
- format="\uf015 {avail}G")
-
- ###############################################################################
- # Network
- ###############################################################################
-
- ifaces_traffic = ["eth0", "wlan0"]
-
- status.register(NetworkTraffic,
- interfaces=ifaces_traffic,
- divisor=1024**2,
- round_size=2,
- color=g_color_second,
- format="\uf063 {bytes_recv:.2f}")
-
- status.register(NetworkTraffic,
- interfaces=ifaces_traffic,
- divisor=1024**2,
- round_size=2,
- color=g_color_warn,
- format="\uf062 {bytes_sent:.2f}")
-
- status.register(Ping,
- color=g_color_good,
- color_down=g_color_alert,
- format="\uf07d {ping:03.0f} ms",
- format_down="\uf368 ∞ ms")
-
- def get_iface_param(iface):
- if isinstance(iface, list):
- return iface[0], iface[1]
- return iface, iface
-
- ifaces_wireless = ["wlan0"]
- ifaces_wired = ["eth0"]
- ifaces_tun = [["tun0", "rthoni.com"], ["tun1", "inet"],
- ["tun2", "betaclean"]]
-
- for iface in ifaces_wireless:
- iface, iface_name = get_iface_param(iface)
- status.register("network",
- interval=1,
- interface=iface,
- color_up=g_color_good,
- format_down="\uf1eb " + iface_name,
- format_down_hide="\uf1eb",
- format_up="\uf1eb {essid} ({quality:03.0f}%) {v4}",
- format_up_hide="\uf1eb " + iface_name)
-
- for iface in ifaces_wired:
- iface, iface_name = get_iface_param(iface)
- status.register("network",
- interval=1,
- interface=iface,
- color_up=g_color_good,
- format_down="\uf0e8 " + iface_name,
- format_down_hide="\uffe8",
- format_up="\uf0e8 {v4}",
- format_up_hide="\uf0e8 " + iface_name)
-
- for iface in ifaces_tun:
- iface, iface_name = get_iface_param(iface)
- status.register("network",
- interval=1,
- interface=iface,
- color_up=g_color_good,
- format_down="\uf070 " + iface_name,
- format_down_hide="\uf070",
- format_up="\uf070 {v4}",
- format_up_hide="\uf070 " + iface_name,
- unknown_up=True).switch_hide()
-
- status.run()
|