diff --git a/README.md b/README.md
index fd110ab447b607f6f14a5db24f6b53a05164f85c..8ee7b0b9c1e827feabc4297104509d37179b74cc 100644
--- a/README.md
+++ b/README.md
@@ -9,29 +9,19 @@ based on [libappindicator](https://launchpad.net/libappindicator). I don't use
 it anymore and it doesn't work in the current state, although it might be
 easy to get it working again.
 
-![tray icon example](./tray-example.png)
-
 ## Todo
 
-* Red icon on `Can't connect`
-* trigger refresh
-* notifications
-* flash icon / paint red
-* Show alert details in menu
-* example systemd service
-
+* Reduce duplicator code in `query_alertmanager.py` and `alertmanager_status.py`
 
 ## Install
 
-Install dependencies (`libffi7` is needed by `pygobject`):
+Install dependencies:
 
-    sudo apt install gir1.2-appindicator3-0.1 libffi7
     pip install -r requirements.txt
 
-
 ## Configuration
 
-Config file example (`~/.config/indicator_alertmanager/config.yml`):
+Config file example (`~/.config/alertmanager_status/config.yml`):
 
 ```yaml
 ---
@@ -42,21 +32,32 @@ password: 123
 ```
 
 
-## Usage
+## Standalone usage
 
 Start the indicator:
 
 ```bash
-./indicator_alertmanager.py
+./alertmanager_status.py
 ```
 
-## query_alertmanager.py
-
-Use as a library for indicator_alertmanager, but can also get used from command
-line, see:
-
-```bash
-query_alertmanager.py -h
+## Waybar integration
+
+```json
+"custom/alertmanager": {
+  "return-type": "json",
+  "interval": 60,
+  "format": "Alerts: {} {icon}",
+  //"exec-if": "exit 0",                  // always run; consider advanced run conditions
+  "format-icons": {
+      "firing": "🔥",
+      "snafu": "🟢",
+      "error": "🚫"
+  },
+  "exec": "/bin/bash -c 'cd /home/varac/projects/monitoring/indicator_alertmanager/ && . ./.direnv/*/bin/activate && ./alertmanager_status.py'",
+  "signal": 21,
+  "on-click": "pkill -RTMIN+21 waybar",
+  "on-click-right": "xdg-open https://alertmanager.oas.varac.net",
+}
 ```
 
 ## Similar projects
diff --git a/alertmanager_status.py b/alertmanager_status.py
index 4190e4b70e32e637a8d58d1c83c05d292005c442..e612ba9f9ab33dc2091658b88131f236800442ba 100755
--- a/alertmanager_status.py
+++ b/alertmanager_status.py
@@ -41,7 +41,7 @@ def show_alerts(opts):
 @plac.opt('configpath', "Path to alertmanager config", type=Path)
 @plac.opt('mode', "Mode: wayland or indicator (not working)", type=str)
 @plac.flg('debug', "Enable debug mode")
-def main(configpath='~/.config/indicator_alertmanager/config.yml',
+def main(configpath='~/.config/alertmanager_status/config.yml',
          mode="wayland"):
     """Main function."""
 
diff --git a/query_alertmanager.py b/query_alertmanager.py
new file mode 100755
index 0000000000000000000000000000000000000000..c9cbe586b70f6228dee7b61f8007a1861594f338
--- /dev/null
+++ b/query_alertmanager.py
@@ -0,0 +1,70 @@
+#!/usr/bin/env python3
+"""Queries alertmanager for alerts, outputs json.
+
+Can be also used as cli application.
+Usage:
+
+  ./query_alertmananger.py -h
+"""
+
+import json
+import plac
+import requests
+from alertmanager import AlertManager
+
+
+def get_alerts(url, password, port=443, user='admin'):
+    req = requests.Session()
+    req.auth = (user, password)
+    AM = AlertManager(host=url, port=port, req_obj=req)
+
+    count = 0
+    alerts = []
+    state = "unknown"
+
+    try:
+        alerts_raw = AM.get_alerts()
+        for alert in alerts_raw:
+            name = alert['labels']['alertname']
+            severity = alert['labels']['severity']
+            instance = alert['labels']['instance']
+            alert_state = alert['status']['state']
+            release_name = alert['labels']['release_name']
+
+            if severity != "none" and alert_state != "suppressed":
+                count += 1
+                alert_text = f'{name}: {instance}, {release_name} ({severity})'
+                alerts.append(alert_text)
+
+        if count > 2:
+            state = "critical"
+        elif count > 0:
+            state = "warning"
+        elif count == 0:
+            state = "ok"
+
+        summary = f'{count} alerts'
+    except:
+        summary = "Cant connect"
+        state = "warning"
+
+    return_data = {
+        'summary': summary,
+        'alerts': alerts,
+        'state': state,
+        'count': count}
+    return return_data
+
+
+@plac.opt('url', "URL of alertmanager instance", type=str, abbrev='U')
+@plac.opt('port', "Port of alertmanager instance", type=int, abbrev='P')
+@plac.opt('user', "User name", type=str)
+@plac.opt('password', "Password", type=str)
+def main(url, password, port=443, user='admin'):
+    """Main function."""
+    alerts = get_alerts(url=url, password=password, port=port, user=user)
+    print(json.dumps(alerts))
+
+
+if __name__ == '__main__':
+    plac.call(main)