From 52edd90c6a884b64eb5caa745a9ad488f80f01b2 Mon Sep 17 00:00:00 2001 From: Ahurac Date: Fri, 31 May 2024 14:52:08 +0200 Subject: [PATCH] config/eww ahrc-laptop : ajout widget son --- config/eww-ahrc--laptop/eww.yuck | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/config/eww-ahrc--laptop/eww.yuck b/config/eww-ahrc--laptop/eww.yuck index e8cc517..1523fa8 100644 --- a/config/eww-ahrc--laptop/eww.yuck +++ b/config/eww-ahrc--laptop/eww.yuck @@ -28,6 +28,11 @@ "swaync-client --subscribe" ) +(deflisten sound + :initial '{"output-volume":0,"input-volume":0,"output-muted":false}' + "listen/sound" +) + (defvar battery-icon '{ "unknown": "", "critical": "", @@ -54,6 +59,13 @@ "dnd": "󰂛" }') +(defvar sound-icon '{ + "absent": "󰕿", + "moderate": "󰖀", + "loud": "󰕾", + "muted": "󰖁" +}') + (defwidget workspaces [] (eventbox :onscroll 'action/hyprland/nearby-workspace "{}"' (box :class "workspaces" @@ -102,7 +114,19 @@ )) ) -; (defwidget sound [] "") +(defwidget sound [] + (box (eventbox + :onscroll 'action/volume "{}"' + :onclick 'pavucontrol & disown' + + "${ + sound.output-muted == true ? sound-icon["muted"] : + sound.output-volume < 33 ? sound-icon["absent"] : + sound.output-volume < 67 ? sound-icon["moderate"] : + sound-icon["loud"] + } ${sound.output-volume} %" + )) +) (defwidget network [] "${ @@ -155,7 +179,7 @@ :space-evenly false :class "right" - ; (sound) + (sound) (network) (battery) )