dotfiles

<-- duh.
Log | Files | Refs | LICENSE

commit 4470ed0e0b7b2bb256a90dad7987248be068e768
parent e8895702903f94dab0f96d30784715e8d5ff98ed
Author: hhvn <dev@hhvn.uk>
Date:   Sun, 25 Apr 2021 10:39:51 +0100

.s/d/vol: sndio support

Diffstat:
M.scripts/dwmblocks/vol | 17+++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/.scripts/dwmblocks/vol b/.scripts/dwmblocks/vol @@ -1,12 +1,13 @@ #!/bin/sh -# -# dwmblocks/vol -# Created by Hayden Hamilton -# -# haydenvh.com -# Copyright (c) 2019 Hayden Hamilton. +# Copyright (c) 2019-2021 Hayden Hamilton. -toggled=$(amixer sget Master | awk '/Mono/ {print $6}' | tr -d '[]') -volume=$(amixer sget Master | awk '/Mono/ {print $4}' | tr -d '[]') +[ "$(uname)" = "Linux" ] && { + toggled=$(amixer sget Master | awk '/Mono/ {print $6}' | tr -d '[]') + volume=$(amixer sget Master | awk '/Mono/ {print $4}' | tr -d '[]') +} +[ "$(uname)" = "OpenBSD" ] && { + toggled=$(sndioctl output.mute | sed 's/.*=//;s/0/on/;s/1/off/') + volume=$(sndioctl output.level | sed -E 's/.*=//;s/(.)\.(..)(.)/\1\2.\3/;s/^0*//;s/\.0$//;s/$/%/') +} output="$(echo ${volume} | tr "\n" " ")$(echo "${toggled}" | grep 'on' >/dev/null && printf '^c#00cc00^' || printf '^c#cc0000^')$(echo ${toggled} | tr "\n" " " | sed 's/ //g')" echo "[VOL $output]"