waybar: Add battery widget
This commit is contained in:
parent
1d0f2610f8
commit
d180eaa72e
3 changed files with 21 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
||||||
wireless = ["wlp170s0"]
|
wireless = ["wlp170s0"]
|
||||||
#ethernet = ["enp2s0"]
|
#ethernet = ["enp2s0"]
|
||||||
temperature_path = "/sys/class/hwmon/hwmon4/temp1_input"
|
temperature_path = "/sys/class/hwmon/hwmon4/temp1_input"
|
||||||
|
has_battery = true
|
||||||
|
|
||||||
[[outputs]]
|
[[outputs]]
|
||||||
match = "eDP-1"
|
match = "eDP-1"
|
||||||
|
|
|
@ -153,6 +153,7 @@ class HostConfig:
|
||||||
wireless: list[str] = field(factory=list)
|
wireless: list[str] = field(factory=list)
|
||||||
ethernet: list[str] = field(factory=list)
|
ethernet: list[str] = field(factory=list)
|
||||||
disks: list[str] = field(factory=lambda: ["/"])
|
disks: list[str] = field(factory=lambda: ["/"])
|
||||||
|
has_battery: bool = False
|
||||||
system_font: str = "Fira Sans"
|
system_font: str = "Fira Sans"
|
||||||
system_mono_font: str = "Fira Mono"
|
system_mono_font: str = "Fira Mono"
|
||||||
temperature_path: str | None = None
|
temperature_path: str | None = None
|
||||||
|
@ -263,9 +264,7 @@ def main():
|
||||||
print(
|
print(
|
||||||
"Could not find SWAYSOCK or NIRI_SOCKET, cannot retrieve output names."
|
"Could not find SWAYSOCK or NIRI_SOCKET, cannot retrieve output names."
|
||||||
)
|
)
|
||||||
print(
|
print("Please re-run in sway or niri to finish configuring swaylock.")
|
||||||
"Please re-run in sway or niri to finish configuring swaylock."
|
|
||||||
)
|
|
||||||
|
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
print("Could not contact sway or niri to retrieve output names.")
|
print("Could not contact sway or niri to retrieve output names.")
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
% endfor
|
% endfor
|
||||||
|
|
||||||
"wireplumber",
|
"wireplumber",
|
||||||
|
"battery",
|
||||||
"group/disks",
|
"group/disks",
|
||||||
"cpu",
|
"cpu",
|
||||||
"memory",
|
"memory",
|
||||||
|
@ -55,6 +56,23 @@
|
||||||
"format-icons": ["\uf026", "\uf027", "\uf028"]
|
"format-icons": ["\uf026", "\uf027", "\uf028"]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
% if host.has_battery:
|
||||||
|
"battery": {
|
||||||
|
"design-capacity": true,
|
||||||
|
"format": "{icon} {capacity}% {time}",
|
||||||
|
"format-time": "{H}:{m}",
|
||||||
|
"format-icons": [
|
||||||
|
"\uf244",
|
||||||
|
"\uf243",
|
||||||
|
"\uf242",
|
||||||
|
"\uf241",
|
||||||
|
"\uf240",
|
||||||
|
],
|
||||||
|
"format-charging": "\ue55b {capacity}% {time}",
|
||||||
|
"format-full": "\ue55c {capacity}%",
|
||||||
|
},
|
||||||
|
% endif
|
||||||
|
|
||||||
"group/disks": {
|
"group/disks": {
|
||||||
// TODO: make drawer that expands orthogonally, outside of the bar
|
// TODO: make drawer that expands orthogonally, outside of the bar
|
||||||
"orientation": "inherit",
|
"orientation": "inherit",
|
||||||
|
|
Loading…
Add table
Reference in a new issue