我使用ALSA.我想防止PC在播放声音时挂起.我使用这个bash代码来运行一个屏幕更衣室和一个suspend命令:
# Run a screen locker. #xautolock -time 5 -locker slimlock & # Run suspend #xautolock -time 6 -locker 'systemctl suspend' &
我想检测到该声音或视频播放,并防止PC挂起.
例如伪码:
if (video is not played) { run a screen locker } if (sound is not played and video is not played) { run suspend command }
如何使用命令行实用程序检测声音或视频是否正在播放?
检查/ proc / asound / card * / pcm * / sub * / status文件是否包含状态:RUNNING.
原文链接:https://www.f2er.com/bash/383721.html