UNPKG

pooliot-client

Version:
25 lines (18 loc) 650 B
import Logger from 'nightingale'; import { board } from '../params'; import { runSyncAsUser } from '../utils/exec'; const logger = new Logger('app:commands:sound'); const set = (output: 'hdmi' | 'jack'): void => { logger.info('change sound output', { output }); runSyncAsUser('./sound.sh', [board.sound.type, ...board.sound[output]]); }; let currentSoundOutput; export const update = (config: Object) => { if (!config.sound || !board.sound || !board.sound[config.sound]) { currentSoundOutput = null; return; } if (currentSoundOutput === config.sound) return; currentSoundOutput = config.sound; set(currentSoundOutput); };