Browse Source

iface format

master
Robin Thoni 9 years ago
parent
commit
b38b65b231
1 changed files with 28 additions and 18 deletions
  1. 28
    18
      i3/status/status.py

+ 28
- 18
i3/status/status.py View File

30
 
30
 
31
 status.register("clock",
31
 status.register("clock",
32
                 color=g_color_second,
32
                 color=g_color_second,
33
-                format="\uf0ce %d/%m/%y %H:%M:%S")
33
+                format="%d/%m/%y %H:%M:%S")
34
 
34
 
35
 
35
 
36
 ###############################################################################
36
 ###############################################################################
65
 ###############################################################################
65
 ###############################################################################
66
 # Processor and memory status
66
 # Processor and memory status
67
 ###############################################################################
67
 ###############################################################################
68
-status.register("temp",
69
-                file="/sys/class/thermal/thermal_zone1/temp",
68
+#status.register("temp",
69
+#                file="/sys/class/thermal/thermal_zone1/temp",
70
                 #alert_temp=55,
70
                 #alert_temp=55,
71
-                color=g_color_good,
71
+#                color=g_color_good,
72
                 #alert_color=g_color_alert,
72
                 #alert_color=g_color_alert,
73
-                format="\uf3b6 {temp:.0f}°C")
73
+#                format="\uf3b6 {temp:.0f}°C")
74
 
74
 
75
 status.register("cpu_usage",
75
 status.register("cpu_usage",
76
                 format="\uf0e4 {usage:02}%")
76
                 format="\uf0e4 {usage:02}%")
127
                 format="\uf368 {ping:03.0f} ms",
127
                 format="\uf368 {ping:03.0f} ms",
128
                 format_down="\uf368 ∞ ms")
128
                 format_down="\uf368 ∞ ms")
129
 
129
 
130
+def get_iface_param(iface):
131
+    if isinstance(iface, list):
132
+        return iface[0], iface[1]
133
+    return iface, iface
134
+
130
 ifaces_wireless = ["wlan0"]
135
 ifaces_wireless = ["wlan0"]
136
+ifaces_wired = ["eth0"]
137
+ifaces_tun = [["tun0", "rthoni.com"], ["tun1", "inet"],
138
+        ["tun2", "epimafia-inet"], ["tun3", "betaclean"]]
139
+
131
 for iface in ifaces_wireless:
140
 for iface in ifaces_wireless:
141
+    iface, iface_name = get_iface_param(iface)
132
     status.register("network",
142
     status.register("network",
133
                 interval=1,
143
                 interval=1,
134
                 interface=iface,
144
                 interface=iface,
135
                 color_up=g_color_good,
145
                 color_up=g_color_good,
136
-                format_down="",
137
-                format_down_hide="",
146
+                format_down="\uf1eb " + iface_name,
147
+                format_down_hide="\uf1eb",
138
                 format_up="\uf1eb {essid} ({quality:03.0f}%) {v4}",
148
                 format_up="\uf1eb {essid} ({quality:03.0f}%) {v4}",
139
-                format_up_hide="\uf1eb {v4}").switch_hide()
149
+                format_up_hide="\uf1eb " + iface_name)
140
 
150
 
141
-ifaces_wired = ["eth0"]
142
 for iface in ifaces_wired:
151
 for iface in ifaces_wired:
152
+    iface, iface_name = get_iface_param(iface)
143
     status.register("network",
153
     status.register("network",
144
                 interval=1,
154
                 interval=1,
145
                 interface=iface,
155
                 interface=iface,
146
                 color_up=g_color_good,
156
                 color_up=g_color_good,
147
-                format_down="",
148
-                format_down_hide="",
149
-                format_up_hide="\uf0e8 …",
150
-                format_up="\uf0e8 {v4}")
157
+                format_down="\uf0e8 " + iface_name,
158
+                format_down_hide="\uffe8",
159
+                format_up="\uf0e8 {v4}",
160
+                format_up_hide="\uf0e8 " + iface_name)
151
 
161
 
152
-ifaces_tun = ["tun0", "tun1", "tun2", "tun3"]
153
 for iface in ifaces_tun:
162
 for iface in ifaces_tun:
163
+    iface, iface_name = get_iface_param(iface)
154
     status.register("network",
164
     status.register("network",
155
                 interval=1,
165
                 interval=1,
156
                 interface=iface,
166
                 interface=iface,
157
                 color_up=g_color_good,
167
                 color_up=g_color_good,
158
-                format_down="",
159
-                format_down_hide="",
160
-                format_up_hide="\uf070",
168
+                format_down="\uf070 " + iface_name,
169
+                format_down_hide="\uf070",
161
                 format_up="\uf070 {v4}",
170
                 format_up="\uf070 {v4}",
162
-                unknown_up=True)
171
+                format_up_hide="\uf070 " + iface_name,
172
+                unknown_up=True).switch_hide()
163
 
173
 
164
 status.run()
174
 status.run()

Loading…
Cancel
Save