From be47278110e41d146e510f5c83d2f8b351522440 Mon Sep 17 00:00:00 2001 From: Trevor Vallender Date: Tue, 19 Mar 2024 17:54:14 +0000 Subject: [PATCH] Update eww volume meter to work with Pipewire --- .config/eww/eww.yuck | 4 ++-- .config/eww/scripts/getvol | 13 ++----------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/.config/eww/eww.yuck b/.config/eww/eww.yuck index 3572941..bea1d5c 100644 --- a/.config/eww/eww.yuck +++ b/.config/eww/eww.yuck @@ -7,8 +7,8 @@ (defwidget sidestuff [] (box :class "sidestuff" :orientation "h" :space-evenly false :halign "end" (metric :label "󰕾" - :value volume - :onchange "amixer -D pulse sset Master {}%") + :value { volume * 100 } + :onchange "VOL=$(bc -l <<<\"scale=2; {} / 100\") ; wpctl set-volume @DEFAULT_AUDIO_SINK@ $VOL") (metric :label "󰍛" :value {EWW_RAM.used_mem_perc} :onchange "") diff --git a/.config/eww/scripts/getvol b/.config/eww/scripts/getvol index 4e4275d..00772a2 100755 --- a/.config/eww/scripts/getvol +++ b/.config/eww/scripts/getvol @@ -1,12 +1,3 @@ -#!/bin/sh +#!/usr/bin/env bash -if command -v pamixer &>/dev/null; then - if [ true == $(pamixer --get-mute) ]; then - echo 0 - exit - else - pamixer --get-volume - fi -else - amixer -D pulse sget Master | awk -F '[^0-9]+' '/Left:/{print $3}' -fi +wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print $2}'