#!/usr/bin/env bash set -u service=ollama.service # The shared Waybar config is also used by hosts without Ollama. if ! systemctl --user cat "$service" >/dev/null 2>&1; then exit 0 fi if [[ ${1:-} == toggle ]]; then if systemctl --user is-active --quiet "$service"; then systemctl --user stop "$service" else systemctl --user start "$service" fi exit $? fi if systemctl --user is-active --quiet "$service"; then printf '%s\n' '{"text":"● Local AI","tooltip":"Ollama is running. Click to stop it.","class":"running"}' else printf '%s\n' '{"text":"● Local AI","tooltip":"Ollama is stopped. Click to start it.","class":"stopped"}' fi