也许是rtfm时刻,但i3+dunst怎么弄不出在mute前发出个消息,我晕

@pi 花两分钟写了个(更丑陋的)脚本:我的天为什么shell script能活到21世纪啊

toggleVolume.sh

#!/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

@shrik3 啊!对不起我是说dunst那个notification daemon的(un)mute。感觉大概是dunst实现方式的问题,它在mute前发出的信息会瞬间被mute吞掉,然后在unmute时才(跟积压的其他通知一起)吐出来……

想到的duck tape解决方法是(un)mute前写状态到文件,让bar去抓状态。。

音频我在用i3默认设置里那个XF86 keys (pactl w/ pulseAudio),不过说起来连蓝牙时有一点点调整音量的问题,感觉是$DEFAULT_SINK哪里不对……(还能用就不修.jpg
@pi
> 写状态到文件

自信点,这叫socket !
@shrik3 我在单位集群各server上有crontab挂一个300字的one liner,五分钟一次写系统状态到文件,纸糊但达到了在任何机上都能一键查看哪台空闲能跑东西的效果……

缺点是one liner过长,把大概没看懂的一个sysadmin吓到写邮件问我在干什么浪费服务器资源,草
@fulkrum @shrik3 除了串联sed/awk/perl不敢写不敢写,bash script过于不可名状。。
@fulkrum 我在HN看到另一篇awk安利,拯救了很多时间,不过平时用不到的就都没记住……

post: https://earthly.dev/blog/awk-examples/
HN: https://news.ycombinator.com/item?id=28707463
Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.