aboutsummaryrefslogtreecommitdiffstats
path: root/i3/bar.py
blob: b1b2e5016b72a1a5211c302c9d6fc4bb00515c5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# -*- coding: utf-8 -*-

###
# Dependencies:
#
# i3pystatus
# netifaces
# colour

import socket

from i3pystatus import Status

hostname = socket.gethostname()
status = Status(standalone=True)


status.register("clock",
                color="#CDC0B0",
                format="%y-%m-%d %H:%M:%S%z")


if hostname == "hydrogen.kyriasis.com":
    status.register("battery",
                    color="#CDC0B0",
                    full_color="#7CFC00",
                    charging_color="#7CFC00",
                    critical_color="#EE4000",
                    format="⚡0 {percentage:.2f}% {remaining:%E%hh:%Mm}{status}",
                    alert=True,
                    alert_percentage=5,
                    status={
                        "DIS": "↓",
                        "CHR": "↑",
                        "FULL": "=",
                    },
                    battery_ident="BAT0",)

    status.register("battery",
                    color="#CDC0B0",
                    full_color="#7CFC00",
                    charging_color="#7CFC00",
                    critical_color="#EE4000",
                    format="⚡1 {percentage:.2f}% {remaining:%E%hh:%Mm}{status}",
                    alert=True,
                    alert_percentage=5,
                    status={
                        "DIS": "↓",
                        "CHR": "↑",
                        "FULL": "=",
                    },
                    battery_ident="BAT1",)

elif hostname.startswith("lithium"):
    status.register("battery",
                    color="#CDC0B0",
                    full_color="#7CFC00",
                    charging_color="#7CFC00",
                    critical_color="#EE4000",
                    format="⚡0 {percentage:.2f}% {remaining:%E%hh:%Mm}{status}",
                    alert=True,
                    alert_percentage=5,
                    status={
                        "DIS": "↓",
                        "CHR": "↑",
                        "FULL": "=",
                    },
                    battery_ident="BAT0",)

    status.register("battery",
                    color="#CDC0B0",
                    full_color="#7CFC00",
                    charging_color="#7CFC00",
                    critical_color="#EE4000",
                    format="⚡1 {percentage:.2f}% {remaining:%E%hh:%Mm}{status}",
                    alert=True,
                    alert_percentage=5,
                    status={
                        "DIS": "↓",
                        "CHR": "↑",
                        "FULL": "=",
                    },
                    battery_ident="BAT1",)

else:
    status.register("battery",
                    color="#CDC0B0",
                    full_color="#7CFC00",
                    charging_color="#7CFC00",
                    critical_color="#EE4000",
                    format="⚡ {percentage:.2f}% {remaining:%E%hh:%Mm}{status}",
                    alert=True,
                    alert_percentage=5,
                    status={
                        "DIS": "↓",
                        "CHR": "↑",
                        "FULL": "=",
                    },
                    battery_ident="BAT0",)


status.register("temp",
                color="#CDC0B0",
                format="{Package_id_0}°C {Core_0_bar}{Core_1_bar}",
                hints={"markup": "pango"},
                lm_sensors_enabled=True)


status.register("pulseaudio",
                color_unmuted="#CDC0B0",
                color_muted="#EE4000",
                format="♪ {volume}%",)


status.register("backlight",
                color="#CDC0B0",
                backlight="intel_backlight",
                format="🔆 {percentage}% ({brightness}/{max_brightness})")


if hostname == "zorg.kyriasis.com":
    status.register("network",
                    color_up="#7CFC00",
                    color_down="#EE4000",
                    interface="wlp4s0",
                    format_up="{essid:.10s}: {v4cidr} {quality:3.0f}%",)

    status.register("network",
                    color_up="#7CFC00",
                    color_down="#EE4000",
                    interface="enp0s25",
                    format_up="{interface}: {v4cidr}")

elif hostname == "tirxu.kyriasis.com":
    status.register("network",
                    color_up="#7CFC00",
                    color_down="#EE4000",
                    interface="wlp4s0",
                    format_up="{essid:.10s}: {v4cidr} {quality:3.0f}%",)

    status.register("network",
                    color_up="#7CFC00",
                    color_down="#EE4000",
                    interface="enp0s20u3u1u3",
                    format_up="{interface}: {v4cidr}")

elif hostname == "hydrogen.kyriasis.com":
    status.register("network",
                    color_up="#7CFC00",
                    color_down="#EE4000",
                    interface="wlp4s0",
                    format_up="{essid:.10s}: {v4cidr} {quality:3.0f}%",)

    status.register("network",
                    color_up="#7CFC00",
                    color_down="#EE4000",
                    interface="enp0s31f6",
                    format_up="{interface}: {v4cidr}")

elif hostname.startswith('lithium'):
    status.register("network",
                    color_up="#7CFC00",
                    color_down="#EE4000",
                    interface="wlp3s0",
                    format_up="{essid:.10s}: {v4cidr} {quality:3.0f}%",)

    status.register("network",
                    color_up="#7CFC00",
                    color_down="#EE4000",
                    interface="enp0s31f6",
                    format_up="{interface}: {v4cidr}")


status.register("disk",
                color="#CDC0B0",
                path="/boot",
                divisor=1024**2,
                format="/boot {avail}M",)

status.register("disk",
                color="#CDC0B0",
                path="/",
                format="/ {avail}G",)


status.run()