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,7 +30,7 @@ status = Status(standalone=True)
30 30
 
31 31
 status.register("clock",
32 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,12 +65,12 @@ status.register("alsa",
65 65
 ###############################################################################
66 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 70
                 #alert_temp=55,
71
-                color=g_color_good,
71
+#                color=g_color_good,
72 72
                 #alert_color=g_color_alert,
73
-                format="\uf3b6 {temp:.0f}°C")
73
+#                format="\uf3b6 {temp:.0f}°C")
74 74
 
75 75
 status.register("cpu_usage",
76 76
                 format="\uf0e4 {usage:02}%")
@@ -127,38 +127,48 @@ status.register(Ping,
127 127
                 format="\uf368 {ping:03.0f} ms",
128 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 135
 ifaces_wireless = ["wlan0"]
136
+ifaces_wired = ["eth0"]
137
+ifaces_tun = [["tun0", "rthoni.com"], ["tun1", "inet"],
138
+        ["tun2", "epimafia-inet"], ["tun3", "betaclean"]]
139
+
131 140
 for iface in ifaces_wireless:
141
+    iface, iface_name = get_iface_param(iface)
132 142
     status.register("network",
133 143
                 interval=1,
134 144
                 interface=iface,
135 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 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 151
 for iface in ifaces_wired:
152
+    iface, iface_name = get_iface_param(iface)
143 153
     status.register("network",
144 154
                 interval=1,
145 155
                 interface=iface,
146 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 162
 for iface in ifaces_tun:
163
+    iface, iface_name = get_iface_param(iface)
154 164
     status.register("network",
155 165
                 interval=1,
156 166
                 interface=iface,
157 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 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 174
 status.run()

Loading…
Cancel
Save