added a volume widget

This commit is contained in:
2025-03-08 07:32:28 +01:00
parent 5019df965c
commit df4ae637d5
6 changed files with 32 additions and 1 deletions

View File

@@ -47,4 +47,5 @@
(hyprsunset) (hyprsunset)
(datetime) (datetime)
(stray) (stray)
(volume)
(swaync))) (swaync)))

View File

@@ -7,3 +7,4 @@
@import 'widgets/hypr_workspaces.scss'; @import 'widgets/hypr_workspaces.scss';
@import 'widgets/sysmon.scss'; @import 'widgets/sysmon.scss';
@import 'widgets/swaync.scss'; @import 'widgets/swaync.scss';
@import 'widgets/volume.scss';

View File

@@ -7,3 +7,4 @@
(include "widgets/hypr_activewindow.yuck") (include "widgets/hypr_activewindow.yuck")
(include "widgets/sysmon.yuck") (include "widgets/sysmon.yuck")
(include "widgets/swaync.yuck") (include "widgets/swaync.yuck")
(include "widgets/volume.yuck")

11
eww/widgets/volume.scss Normal file
View File

@@ -0,0 +1,11 @@
.sourcevol{
background: steelblue;
color: black;
}
.sinkvol{
background: slateblue;
color: black;
}
.muted{
background: tomato;
}

17
eww/widgets/volume.yuck Normal file
View File

@@ -0,0 +1,17 @@
(defpoll sourcevol :interval "1s" `wpctl get-volume @DEFAULT_SOURCE@ | awk -F ' ' '{print $2}'`)
(defpoll sourcemute :interval "1s" `wpctl get-volume @DEFAULT_SOURCE@ | awk -F ' ' '{print $3}'`)
(defpoll sinkvol :interval "1s" `wpctl get-volume @DEFAULT_SINK@ | awk -F ' ' '{print $2}'`)
(defpoll sinkmute :interval "1s" `wpctl get-volume @DEFAULT_SINK@ | awk -F ' ' '{print $3}'`)
(defwidget volume []
(box
:space-evenly false
:spacing 3
(eventbox
:class "sourcevol${sourcemute == "[MUTED]" ? " muted" : ""}"
:onclick "wpctl set-mute @DEFAULT_SOURCE@ toggle"
(label :text "${sourcemute == "[MUTED]" ? "󰍭" : "󰍬"} ${sourcevol}"))
(eventbox
:class "sinkvol${sinkmute == "[MUTED]" ? " muted" : ""}"
:onclick "wpctl set-mute @DEFAULT_SINK@ toggle"
(label :text "${sinkmute == "[MUTED]" ? "󰟎" : "󰋋"} ${sinkvol}"))))

View File

@@ -132,7 +132,7 @@ bindel = ,XF86AudioMute, exec, swayosd-client --output-volume mute-toggle
# Input volume control # Input volume control
bindel = SHIFT ,XF86AudioRaiseVolume, exec, swayosd-client --input-volume raise --max-volume 150 bindel = SHIFT ,XF86AudioRaiseVolume, exec, swayosd-client --input-volume raise --max-volume 150
bindel = SHIFT ,XF86AudioLowerVolume, exec, swayosd-client --input-volume lower --max-volume 150 bindel = SHIFT ,XF86AudioLowerVolume, exec, swayosd-client --input-volume lower --max-volume 150
bindel = SHIFT ,XF86AudioMute, exec, pactl set-source-mute alsa_input.usb-DCMT_Technology_USB_Condenser_Microphone_214b206000000178-00.mono-fallback toggle bindel = SHIFT ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_SOURCE@ toggle
# Requires playerctl # Requires playerctl
bindl = , XF86AudioNext, exec, swayosd-client --playerctl next bindl = , XF86AudioNext, exec, swayosd-client --playerctl next