You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

status.py 5.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. #!/bin/python3
  2. # coding=utf-8
  3. from i3pystatus import Status
  4. from i3status.upower import UPower
  5. from i3status.network_traffic import NetworkTraffic
  6. from i3status.ping import Ping
  7. from i3status.arch_updates import ArchUpdates
  8. from i3status.my_ip import MyIP
  9. # We change i3pystatus
  10. import i3status.change_i3pystatus
  11. i3status.change_i3pystatus.change_all()
  12. ###############################################################################
  13. # COLORS
  14. ###############################################################################
  15. g_color_normal = "#AEAEAE"
  16. g_color_second = "#66E0FF"
  17. g_color_good = "#8DE28D"
  18. g_color_warn = "#D68533"
  19. g_color_alert = "#FF5555"
  20. ###############################################################################
  21. # Clock
  22. ###############################################################################
  23. status = Status(standalone=True)
  24. status.register("clock",
  25. color=g_color_second,
  26. format="\uf0ce %d/%m/%y %H:%M:%S")
  27. ###############################################################################
  28. # Battery, sound and light
  29. ###############################################################################
  30. status.register(UPower,
  31. alert_percent=30,
  32. format_chr="\uf214↑ {percentage}% {time_to_full}",
  33. format_dis="\uf214↓ {percentage}% {time_to_empty}",
  34. format_dis_alert="\uf215↓ {percentage}% {time_to_empty}",
  35. format_full="\uf213 {percentage}%",
  36. format_dpl="\uf212",
  37. color_chr=g_color_second,
  38. color_dis=g_color_warn,
  39. color_dis_alert=g_color_alert,
  40. color_full=g_color_good,
  41. color_dpl=g_color_alert)
  42. status.register("alsa",
  43. mixer="Master",
  44. card=0,
  45. color_muted=g_color_warn,
  46. format_muted="\uf026 0%",
  47. format="\uf028 {volume:.0f}%")
  48. #status.register("backlight",
  49. # interval=1,
  50. # backlight="acpi_video0",
  51. # format="\uf39b {percentage}%")
  52. ###############################################################################
  53. # Processor and memory status
  54. ###############################################################################
  55. status.register("temp",
  56. file="/sys/class/thermal/thermal_zone1/temp",
  57. #alert_temp=55,
  58. color=g_color_good,
  59. #alert_color=g_color_alert,
  60. format="\uf3b6 {temp:.0f}°C")
  61. status.register("cpu_usage",
  62. format="\uf0e4 {usage:02}%")
  63. status.register("mem",
  64. color=g_color_good,
  65. warn_color=g_color_warn,
  66. alert_color=g_color_alert,
  67. format="\uf085 {avail_mem:.0f}M")
  68. ###############################################################################
  69. # Pacman
  70. ###############################################################################
  71. #status.register(ArchUpdates,
  72. # format=u"\uf500{count_pacman}|{count_yaourt}")
  73. ###############################################################################
  74. # disk usage
  75. ###############################################################################
  76. status.register("disk",
  77. path="/",
  78. critical_limit=10,
  79. format="\uf07b {avail}G")
  80. status.register("disk",
  81. path="/home",
  82. critical_limit=5,
  83. format="\uf015 {avail}G")
  84. ###############################################################################
  85. # Network
  86. ###############################################################################
  87. ifaces_traffic = ["eth0", "wlan0"]
  88. status.register(NetworkTraffic,
  89. interfaces=ifaces_traffic,
  90. divisor=1024**2,
  91. round_size=2,
  92. color=g_color_second,
  93. format="\uf063 {bytes_recv:.2f}")
  94. status.register(NetworkTraffic,
  95. interfaces=ifaces_traffic,
  96. divisor=1024**2,
  97. round_size=2,
  98. color=g_color_warn,
  99. format="\uf062 {bytes_sent:.2f}")
  100. status.register(Ping,
  101. color=g_color_good,
  102. color_down=g_color_alert,
  103. format="\uf368 {ping:03.0f} ms",
  104. format_down="\uf368 ∞ ms")
  105. ifaces_wireless = ["wlan0"]
  106. for iface in ifaces_wireless:
  107. status.register("network",
  108. interval=1,
  109. interface=iface,
  110. color_up=g_color_good,
  111. format_down="",
  112. format_down_hide="",
  113. format_up="\uf1eb {essid} ({quality:03.0f}%) {v4}",
  114. format_up_hide="\uf1eb {v4}").switch_hide()
  115. ifaces_wired = ["eth0"]
  116. for iface in ifaces_wired:
  117. status.register("network",
  118. interval=1,
  119. interface=iface,
  120. color_up=g_color_good,
  121. format_down="",
  122. format_down_hide="",
  123. format_up_hide="\uf0e8 …",
  124. format_up="\uf0e8 {v4}")
  125. ifaces_tun = ["tun0", "tun1", "tun2", "tun3"]
  126. for iface in ifaces_tun:
  127. status.register("network",
  128. interval=1,
  129. interface=iface,
  130. color_up=g_color_good,
  131. format_down="",
  132. format_down_hide="",
  133. format_up_hide="\uf070 {v4}",
  134. format_up="\uf070 {v4}",
  135. unknown_up=True).switch_hide()
  136. status.run()