updated volumes

This commit is contained in:
Nickiel12 2023-10-30 18:12:43 -07:00
parent 34172f0ecb
commit 2d426949d9
4 changed files with 50 additions and 24 deletions

View file

@ -73,17 +73,20 @@
(defvar volume-visible false) (defvar volume-visible false)
(defwidget _volume [volume] (defwidget _volume [volume]
(box (eventbox
:hexpand false :onscroll "./scripts/volume {} ${EWW_EXECUTABLE}"
:class {volume > 100 ? "alert" : "regular"} :onclick "./scripts/volume toggle ${EWW_EXECUTABLE}"
(revealer-on-hover (box
:toggle volume-visible :hexpand false
:togglename "volume-visible" :class {volume > 100 ? "alert" : "regular"}
(label :text {volume <= 0 ? "󰝟 " : (revealer-on-hover
volume < 33 ? "󰕿 " : :toggle volume-visible
volume < 66 ? "󰖀 " : :togglename "volume-visible"
volume < 99 ? "󰕾 " : "󱄡 "}) (label :text {volume <= 0 ? "󰝟 " :
(label :text "${volume}%")))) volume < 33 ? "󰕿 " :
volume < 66 ? "󰖀 " :
volume < 99 ? "󰕾 " : "󱄡 "})
(label :text "${volume}%")))))
(defvar battery-visible false) (defvar battery-visible false)
@ -144,19 +147,9 @@
{music != "" ? "🎵${music}" : ""})) {music != "" ? "🎵${music}" : ""}))
(defpoll volume :interval "1s" (defpoll volume :interval "1s"
"pw-volume status | jq '.percentage'") {"pw-volume status | jq '.percentage // 0'" ?: 500})
(defpoll time :interval "10s" (defpoll time :interval "10s"
"date '+%H:%M %b %d, %Y'") "date '+%H:%M %b %d, %Y'")
(defwindow bar (include "windows.yuck")
:monitor 1
:exclusive true
:windowtype "dock"
:geometry (geometry :x "0%"
:y "0%"
:width "90%"
:height "10px"
:anchor "top center")
:reserve (struts :side "top" :distance "4%")
(bar))

View file

@ -0,0 +1,12 @@
#!/bin/sh
case $1 in
"*") command="";;
"up") command="change +2%";;
"down") command="change -1.5%";;
"toggle") command="mute toggle";;
esac
[ -n "$command" ] && pw-volume $command
$2 update volume=$(pw-volume status | jq '.percentage // 0')

View file

@ -0,0 +1,12 @@
(defwindow bar
:monitor 1
:exclusive true
:windowtype "dock"
:geometry (geometry :x "0%"
:y "0%"
:width "90%"
:height "10px"
:anchor "top center")
:reserve (struts :side "top" :distance "4%")
(bar))

View file

@ -1,4 +1,4 @@
{lib, ...}: {lib, pkgs, ...}:
let let
workspaces = workspaces =
@ -20,7 +20,16 @@ in
"$mod ALT, mouse:272, resizewindow" "$mod ALT, mouse:272, resizewindow"
]; ];
# binde, will repeat when held
#https://wiki.hyprland.org/Configuring/Binds/#bind-flags
binde = [
",XF86AudioRaiseVolume, exec, pw-volume change +1%; ${pkgs.eww}/bin/eww update volume=$(pw-volume status | jq '.percentage // 10')"
",XF86AudioLowerVolume, exec, pw-volume change -1%; ${pkgs.eww}/bin/eww update volume=$(pw-volume status | jq '.percentage // 10')"
];
bind = [ bind = [
",XF86AudioMute, exec, pw-volume mute toggle"
"$mod, RETURN, exec, kitty" "$mod, RETURN, exec, kitty"
"$mod, r, exec, rofi -show run window" "$mod, r, exec, rofi -show run window"
"$mod, q, killactive" "$mod, q, killactive"