aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2024-03-24 10:36:10 +0100
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2024-03-24 10:36:10 +0100
commiteede6f75d0b7c643fba07d840f8d97e00104a12c (patch)
treee9f08a514150885e7df122e568a39729770d2848
parent7f7f59ce5e0cc9a2de8b0ce55acf73c41e171103 (diff)
downloaddotfiles-eede6f75d0b7c643fba07d840f8d97e00104a12c.tar.gz
waybar wifionice
-rwxr-xr-xscripts/icewifi.py20
-rw-r--r--waybar/config9
-rw-r--r--waybar/style.css7
3 files changed, 35 insertions, 1 deletions
diff --git a/scripts/icewifi.py b/scripts/icewifi.py
new file mode 100755
index 0000000..9286c0c
--- /dev/null
+++ b/scripts/icewifi.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python3
+
+import requests
+import json
+
+data = requests.get("https://iceportal.de/api1/rs/status")
+
+if data.status_code != 200:
+ print(f"HTTP Status {data.status_code}")
+
+t_info = data.json()
+
+return_info={
+ 'text':t_info["tzn"],
+ 'tooltip':f'BR{t_info["series"]}, I-Netz {t_info["internet"]}',
+ #'class':'',
+ 'percentage':t_info["speed"]
+}
+
+print(json.dumps(return_info))
diff --git a/waybar/config b/waybar/config
index 53a5dcb..a1f633d 100644
--- a/waybar/config
+++ b/waybar/config
@@ -8,7 +8,7 @@
// Choose the order of the modules
"modules-left": ["sway/workspaces", "sway/mode", "sway/scratchpad"],
"modules-center": ["sway/window"],
- "modules-right": ["idle_inhibitor", "pulseaudio", "network", "cpu", "memory", "temperature", "backlight", "sway/language", "battery", "clock", "tray"],
+ "modules-right": ["idle_inhibitor","custom/wifiice", "pulseaudio", "network", "cpu", "memory", "temperature", "backlight", "sway/language", "battery", "clock", "tray"],
"sway/workspaces": {
"disable-scroll": true,
"all-outputs": false,
@@ -163,6 +163,13 @@
"escape": true,
"exec": "$HOME/.config/waybar/mediaplayer.py 2> /dev/null" // Script in resources folder
// "exec": "$HOME/.config/waybar/mediaplayer.py --player spotify 2> /dev/null" // Filter player based on name
+ },
+ "custom/wifiice": {
+ "format": "{} {percentage} km/h",
+ "interval":10,
+ "return-type": "json",
+ "exec": "icewifi.py",
+ "exec-if": "test \"$(iwgetid -r)\" = \"WIFIonICE\""
}
}
diff --git a/waybar/style.css b/waybar/style.css
index 0f0e3b9..ce58783 100644
--- a/waybar/style.css
+++ b/waybar/style.css
@@ -305,3 +305,10 @@ label:focus {
#privacy-item.audio-out {
background-color: #0069d4;
}
+
+#custom-wifiice {
+ color: #000000;
+ background-color: #ffffff;
+ box-shadow: inset 0 -5px #ff0000;
+ padding: 0 10px;
+}