#!/usr/bin/env bash
SHADER="$HOME/.config/eww/shaders/read-mode.glsl"

is_active() {
  hyprctl getoption decoration:screen_shader | grep -qF "$SHADER"
}

case "$1" in
  status)
    is_active && echo true || echo false
    ;;
  *)
    if is_active; then
      hyprctl eval 'hl.config({ decoration = { screen_shader = "" } })'
      hyprctl eval 'hl.config({ render = { use_fp16 = 2 } })'
      echo false
    else
      hyprctl eval 'hl.config({ render = { use_fp16 = 0 } })'
      hyprctl eval "hl.config({ decoration = { screen_shader = \"$SHADER\" } })"
      echo true
    fi
    ;;
esac
