import { ref, watch } from 'vue'

const LISTEN_MODE_KEY = 'fa_listen_mode'

// Shared across all views — persisted to localStorage
const _listenMode = ref<boolean>(localStorage.getItem(LISTEN_MODE_KEY) === 'true')

watch(_listenMode, (v) => {
  localStorage.setItem(LISTEN_MODE_KEY, String(v))
})

export function useListenMode() {
  return _listenMode
}
