#!/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="\uf240 {percentage}% {time_to_full}", format_dis="\uf241 {percentage}% {time_to_empty}", format_dis_alert="\uf244 {percentage}% {time_to_empty}", format_full="\uf240 {percentage}%", format_dpl="\uf240", 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="\uf07d 000 ms", format_pause="\uf07d 000 ms") def get_iface_param(iface): if isinstance(iface, list): return iface[0], iface[1] return iface, iface ifaces_wireless = ["wlan0", "wlan1"] ifaces_wired = ["eth0", "usb0", "br0"] ifaces_tun = [["tap42", "rthoni.com"], ["tun200", "inet"]] 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, unknown_up=True) 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="\uf0e8", format_up="\uf0e8 {v4}", format_up_hide="\uf0e8 " + iface_name, unknown_up=True) 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()