#!/usr/bin/env bash

# Terminate already running bar instances
pkill polybar

sleep 0.5

# Wait until the processes have been shut down
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done

host_name=$(cat /proc/sys/kernel/hostname)
if [[ $host_name == "portalo" ]]; then
    polybar portalo-primary &
    polybar portalo-secondary &
elif [[ $host_name == *"laptop"* ]]; then
    polybar laptop-primary &
    polybar laptop-secondary &
else
    #polybar base &
    polybar laptop-primary &
    polybar laptop-secondary &
fi