feat: update volume widget and visual
This commit is contained in:
+14
-8
@@ -13,7 +13,7 @@
|
||||
|
||||
;; слушатели
|
||||
(deflisten ws_data :initial "{}" "python3 $HOME/.config/eww/scripts/workspaces.py")
|
||||
(deflisten volume :initial "0" "python3 $HOME/.config/eww/scripts/volume.py")
|
||||
(deflisten volume :initial '{"volume": 0, "muted": false}' "python3 -u $HOME/.config/eww/scripts/volume.py")
|
||||
(deflisten layout :initial "EN" "socat -u UNIX-CONNECT:$XDG_RUNTIME_DIR/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | stdbuf -oL awk -F'>>' '/activelayout/ {split(\$2, a, \",\"); print toupper(substr(a[2], 1, 2))}'")
|
||||
(deflisten tray_count :initial "0" "python3 $HOME/.config/eww/scripts/tray_monitor.py")
|
||||
(deflisten kb_leds :initial '{"caps":"0","num":"0"}' "python3 $HOME/.config/eww/scripts/kb_leds.py")
|
||||
@@ -73,15 +73,21 @@
|
||||
|
||||
;; звук
|
||||
(defwidget volumewidget [reveal_state reveal_var]
|
||||
(eventbox :cursor "pointer" :onclick "eww update ${reveal_var}=${!reveal_state}"
|
||||
(box :class "capsule volume-pill ${reveal_state ? 'active' : ''} ${volume == 0 || volume == '' ? 'muted' : ''}"
|
||||
(eventbox :cursor "pointer"
|
||||
:onclick "eww update ${reveal_var}=${!reveal_state}"
|
||||
:onrightclick "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
|
||||
:onscroll "echo {} | sed -e 's/up/5%+/g' -e 's/down/5%-/g' | xargs wpctl set-volume -l 1.35 @DEFAULT_AUDIO_SINK@"
|
||||
(box :class "capsule volume-pill ${reveal_state ? 'active' : ''} ${volume.muted || volume.volume == 0 || volume.volume == '0' ? 'muted' : ''}"
|
||||
:space-evenly false
|
||||
(label :class "icon" :text {volume == 0 || volume == "" ? "" : (volume < 50 ? "" : "")})
|
||||
(label :class "stat-label" :text "${volume}%" :width 38)
|
||||
(revealer :reveal reveal_state :transition "slideleft"
|
||||
(label :class "icon"
|
||||
:text {volume.muted || volume.volume == 0 || volume.volume == "0" ? "" : (volume.volume < 50 ? "" : "")})
|
||||
(label :class "stat-label"
|
||||
:text "${volume.volume}%" :width 38)
|
||||
(revealer :reveal reveal_state
|
||||
:transition "slideleft"
|
||||
(box :class "slide-wrapper"
|
||||
(scale :class "vol-bar" :min 0 :max 101 :value {volume ?: 0}
|
||||
:onchange "pactl set-sink-volume @DEFAULT_SINK@ {}%"))))))
|
||||
(scale :class "vol-bar" :min 0 :max 101 :value {volume.volume}
|
||||
:onchange "wpctl set-volume @DEFAULT_AUDIO_SINK@ {}%"))))))
|
||||
|
||||
;; часы
|
||||
(defwidget timewidget [reveal_state reveal_var]
|
||||
|
||||
Reference in New Issue
Block a user