aboutsummaryrefslogtreecommitdiffstats
path: root/i3/bar.py
blob: d9cdb1083da4ad085f25d228acb50532f327642f (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
# -*- coding: utf-8 -*-

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

import socket

from i3pystatus import Status

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


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


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

    status.register("battery",
                    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",
                    format="⚡:{percentage:.2f}% {remaining:%E%hh:%Mm}{status}",
                    alert=True,
                    alert_percentage=5,
                    status={
                        "DIS": "↓",
                        "CHR": "↑",
                        "FULL": "=",
                    },
                    battery_ident="BAT0",)


status.register("temp",
                format="{temp:.0f}°C",)


status.register("pulseaudio",
                format="♪:{volume}%",)


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


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

    status.register("network",
                    interface="enp0s25",
                    format_up="{interface}: {v4cidr}")

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

    status.register("network",
                    interface="enp0s20u3u1u3",
                    format_up="{interface}: {v4cidr}")

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

    status.register("network",
                    interface="enp0s32f6",
                    format_up="{interface}: {v4cidr}")


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

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


status.run()