all repos — dotfiles @ cdb020f37a22ca9cf94b5768ca225748b8b99eb8

my *nix dotfiles

bin: contextual volume info in bar
Anirudh Oppiliappan x@icyphox.sh
Thu, 21 Apr 2022 14:57:08 +0530
commit

cdb020f37a22ca9cf94b5768ca225748b8b99eb8

parent

ef4e054f609a65e639255b16addda1c1ad656ec4

1 files changed, 12 insertions(+), 1 deletions(-)

jump to
M nix/bin/bar.nixnix/bin/bar.nix

@@ -4,6 +4,7 @@ let

name = "bar"; pamixer = "${pkgs.pamixer}/bin/pamixer"; lemonbar = "${pkgs.lemonbar-xft}/bin/lemonbar"; + btctl = "${pkgs.bluezFull}/bin/bluetoothctl"; in pkgs.writeShellScriptBin name ''

@@ -15,11 +16,21 @@ vol() {

${pamixer} --get-volume } + audio_dev() { + con="$(${btctl} info | grep Connected | awk '{ print $2 }')" + + if [[ "$con" == "yes" ]]; then + printf 'bt' + else + printf 'spkr' + fi + } + pad="%{015}" while :; do time="$(date +"%H:%M")" - echo "$pad $(dt) $pad $time %{r}bat $(bat) %{O14}vol $(vol)% $pad" + echo "$pad $(dt) $pad $time %{r}bat $(bat) %{O14}$(audio_dev) $(vol)% $pad" sleep 0.5 done | ${lemonbar} -n bar -f 'Input:style=Regular:size=12:antialias=true' -g x30 \ -F '${theme.base00}' -B '${theme.base07}'