#!/usr/bin/env bash
set -euo pipefail

PROFILE_FILE="/home/raga/.config/sway/scripts/display-profile/display-profile.conf"

mode_str=""
if [[ -f "$PROFILE_FILE" ]]; then
  mode_str="$(awk '$1=="set" && $2=="$lg_left_monitor_mode" {print $3; found=1} END {if(!found) print ""}' "$PROFILE_FILE" 2>/dev/null)"
fi

# Display-related FontAwesome icon + a short label.
case "$mode_str" in
  3840x2160@*|4096x2160@*) echo " 4K";;
  1920x1080@*) echo " 1080p";;
  "") echo "";;
  *) echo " ${mode_str}";;
esac
