@pi 花两分钟写了个(更丑陋的)脚本:我的天为什么shell script能活到21世纪啊
#!/bin/sh
result=$(amixer sset Master toggle | sed -En '/\[on\]/ s/.*\[([0-9]+)%\].*/\1/ p; /\[off\]/ s/.*/0/p' | head -1)
if [ "$result" -eq "0" ]; then
dunstify "MUTED";
exit;
else
dunstify "Vol.ON";
fi
然后+x, 绑各键就行了。 (btw为啥不用 XF86 keys?)
bindsym XF86AudioMute toggleVolume.sh
@pi @shrik3 以前看HN推荐过篇文章教awk*,我基本就靠这些 Orz
* https://gregable.com/2010/09/why-you-should-know-just-little-awk.html
post: https://earthly.dev/blog/awk-examples/
HN: https://news.ycombinator.com/item?id=28707463