This is a module for Waybar that displays the status of the train you are currently in, using the train's API available from its WiFi network.
It was inspired by https://github.com/e1mo/waybar-iceportal and https://github.com/liclac/ambient.
These operators are currently supported:
Operator Portal | WiFi name | Description |
---|---|---|
Iceportal | WIFIonICE |
German long-distance trains ICE and IC by Deutsche Bahn |
Zugportal | WIFI@DB |
German regional trains by Deutsche Bahn |
ODEG (Portal) | ODEG Free WiFi |
Some regional trains in German states Berlin/Brandenburg, Mecklenburg-Vorpommern, Saxony and Saxony-Anhalt |
Times include the displayed delay.
After cloning the repository and installing the required Python modules (pip install -r requirements.txt
), run waybar-trains as a Python module using python -m waybar-trains
.
Example Waybar module configuration:
"custom/trains": {
"exec": "cd ~/path/to/waybar-trains && python -m waybar-trains",
"return-type": "json",
"interval": 15
}
A Nix Flake is available for use with NixOS and/or Home Manager. First, add waybar-trains as an input:
{
inputs = {
waybar-trains.url = "git+https://codeberg.org/fyrk/waybar-trains.git";
};
}
Then, add a custom module, for example:
{
"custom/trains" = {
"exec" = "${inputs.waybar-trains.packages.${system}.default}/bin/waybar-trains";
"return-type" = "json";
"interval" = 15;
};
}
A CSS style that sets the background, text, and border colors could look like this:
#custom-trains {
border: 2px solid;
}
#custom-trains sup {
margin-left: 10px;
}
#custom-trains.provider-iceportal {
background: #f0f3f5;
color: #282d37;
border-color: #ec0016;
}
#custom-trains.provider-zugportal {
background: #0e0e0c;
color: #f0f3f5;
border-color: #ec0016;
}
#custom-trains.provider-odeg {
background: #ffffff;
border-color: #007073;
}