feat: get volume using pactl

This commit is contained in:
hesam-init 2024-06-28 12:32:34 +03:30
parent 347db5657b
commit 49f4f95661
10 changed files with 137 additions and 104 deletions

View file

@ -19,7 +19,7 @@
:vexpand true :vexpand true
(user) (user)
(chooser) (chooser)
;; (weather) ; (weather)
(coolmpd :h 150 :permashow true) (coolmpd :h 150 :permashow true)
(box (box
:orientation "h" :orientation "h"

@ -0,0 +1 @@
Subproject commit 594295d5c0203c1c067a7c8004cf1d6fe835234b

View file

@ -1,5 +1,5 @@
@import "./colors.scss"; @import "./colors.scss";
@import "./bar/bar.scss"; @import "./src/bar/styles.scss";
// @import "./bottom_bar/bar.scss"; // @import "./bottom_bar/bar.scss";
@import "./control_panel/control_panel.scss"; @import "./control_panel/control_panel.scss";
@import "./dashboard/dashboard.scss"; @import "./dashboard/dashboard.scss";

View file

@ -1,22 +1,10 @@
(defpoll thour :initial "0" :interval "60s" "date +'%I'") (include "./src/utils/_revealer.yuck")
(defpoll tmin :initial "0" :interval "60s" "date +'%M'") (include "./src/_pollers.yuck")
(defpoll tpm :initial "0" :interval "60s" "date +'%p'") (include "./src/_variables.yuck")
(defpoll volumemute :initial "false" :interval "1s" "pamixer --get-mute")
(defpoll volume :initial "0" :interval "1s" "pamixer --get-volume")
(defpoll brightness :initial "0" :interval "2s" "brightnessctl -m | awk -F, '{print substr($4, 0, length($4)-1)}' | tr -d '%'")
(defpoll wifi_icon :initial "" :interval "30s" "./scripts/wifi --ICON")
(defpoll wifi_essid :initial "" :interval "30s" "./scripts/wifi --ESSID")
(defpoll wifi_radio :initial "off" :interval "2s" "nmcli radio wifi")
(defpoll calendar_day :initial "1" :interval "20h" "date '+%d'")
(defpoll calendar_year :initial "2000" :interval "20h" "date '+%Y'")
(defpoll bat0 :initial "0" :interval "30s" "bash ./scripts/sys_info --bat")
;; (defpoll baticon :initial "" :interval "30s" "bash ./scripts/sys_info --baticon")
;; (defpoll batstat :interval "30s" "cat /sys/class/power_supply/BAT0/status")
(defpoll homedir :initial "" :interval "24h" "echo ~")
(deflisten workspacejson (deflisten workspacejson
:initial '[{"focused": true, "empty": false, "name": 1}, {"focused": false, "empty": true, "name": 2}, {"focused": false, "empty": true, "name": 3}, {"focused": false, "empty": true, "name": 4}, {"focused": false, "empty": true, "name": 5}]' :initial '[{"focused": true, "empty": false, "name": 1}, {"focused": false, "empty": true, "name": 2}, {"focused": false, "empty": true, "name": 3}, {"focused": false, "empty": true, "name": 4}, {"focused": false, "empty": true, "name": 5}]'
"./scripts/workspace.py") "./scripts/workspace.py")
;; used mainly in control panel and dashboard ;; used mainly in control panel and dashboard
(defpoll hostname :initial "idk" :interval "24h" 'echo "$(whoami)"') (defpoll hostname :initial "idk" :interval "24h" 'echo "$(whoami)"')
@ -50,11 +38,11 @@
}' }'
:interval "1h" :interval "1h"
:run-while revealcontrolpanel :run-while revealcontrolpanel
"./scripts/weather.py") "./scripts/weather.py")
(defpoll datehour :initial "12" :interval "30m" "date +'%H'") (defpoll datehour :initial "12" :interval "30m" "date +'%H'")
(defpoll notesc :interval "2s" :run-while reveal4 "cat -s ~/Documents/fuck.txt") (defpoll notesc :interval "2s" :run-while reveal4 "cat -s ~/Documents/fuck.txt")
(deflisten timerdis `./scripts/timer.py subscribe`)
(defpoll quotejson :interval "1h" `./scripts/quote.py`) (defpoll quotejson :interval "1h" `./scripts/quote.py`)
(deflisten timerdis `./scripts/timer.py subscribe`)
;; dock ;; dock
(deflisten tasksjson :initial "[]" "./scripts/tasklist.py") (deflisten tasksjson :initial "[]" "./scripts/tasklist.py")
@ -104,20 +92,9 @@
;; windows for workspace switching ;; windows for workspace switching
(defvar windows "[[], [], [], [], []]") (defvar windows "[[], [], [], [], []]")
(defvar reveal1 false)
(defvar reveal2 false)
(defvar reveal3 false)
(defvar reveal4 false)
(defvar reveal5 false)
(defvar reveal6 false)
(defvar revealweather false)
(defvar revealsystray false)
(defvar revealcontrolpanel false)
(defpoll theme :interval "24h" "./scripts/toggletheme") (defpoll theme :interval "24h" "./scripts/toggletheme")
(include "./src/bar/main.yuck")
(include "./bar/bar.yuck")
;; (include "./bottom_bar/bar.yuck") ;; (include "./bottom_bar/bar.yuck")
(include "./control_panel/control_panel.yuck") (include "./control_panel/control_panel.yuck")
(include "./dashboard/dashboard.yuck") (include "./dashboard/dashboard.yuck")

View file

@ -0,0 +1,16 @@
(defpoll thour :initial "0" :interval "60s" "date +'%I'")
(defpoll tmin :initial "0" :interval "60s" "date +'%M'")
(defpoll tpm :initial "0" :interval "60s" "date +'%p'")
(defpoll volumemute :initial "false" :interval "1s" "pamixer --get-mute")
(defpoll volume :initial "0" :interval "1s" "pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}' | tr -d '%'")
(defpoll mic_volume :initial "0" :interval "1s" "pactl get-source-volume @DEFAULT_SOURCE@ | awk '{print $5}' | tr -d '%'")
(defpoll brightness :initial "0" :interval "2s" "brightnessctl -m | awk -F, '{print substr($4, 0, length($4)-1)}' | tr -d '%'")
(defpoll wifi_icon :initial "" :interval "30s" "./scripts/wifi --ICON")
(defpoll wifi_essid :initial "" :interval "30s" "./scripts/wifi --ESSID")
(defpoll wifi_radio :initial "off" :interval "2s" "nmcli radio wifi")
(defpoll calendar_day :initial "1" :interval "20h" "date '+%d'")
(defpoll calendar_year :initial "2000" :interval "20h" "date '+%Y'")
(defpoll bat0 :initial "0" :interval "30s" "bash ./scripts/sys_info --bat")
;; (defpoll baticon :initial "" :interval "30s" "bash ./scripts/sys_info --baticon")
;; (defpoll batstat :interval "30s" "cat /sys/class/power_supply/BAT0/status")
(defpoll homedir :initial "" :interval "24h" "echo ~")

View file

@ -0,0 +1,13 @@
(defvar revealVolume false)
(defvar revealMicrophone false)
(defvar revealBrightness false)
(defvar reveal1 false)
(defvar reveal2 false)
(defvar reveal3 false)
(defvar reveal4 false)
(defvar reveal5 false)
(defvar reveal6 false)
(defvar revealweather false)
(defvar revealsystray false)
(defvar revealcontrolpanel false)

View file

@ -3,10 +3,8 @@
:geometry (geometry :geometry (geometry
:x "0%" :x "0%"
:y "0%" :y "0%"
:width "42"
:height "1080"
:anchor "center left") :anchor "center left")
;; :reserve (struts :distance "60" :side "left") ; :reserve (struts :distance "60" :side "left")
;; :stacking "bg" ;; :stacking "bg"
:exclusive true :exclusive true
:monitor 0 :monitor 0
@ -65,7 +63,7 @@
:class "bottom_modules" :class "bottom_modules"
:vexpand false :vexpand false
:hexpand false :hexpand false
(stray) ; (stray)
(sliders) (sliders)
(clock) (clock)
; (battery) ; (battery)
@ -227,8 +225,8 @@
(label :class "icon" :style "font-size: 18px;" :text wifi_icon)) (label :class "icon" :style "font-size: 18px;" :text wifi_icon))
(reveal_on_hover (reveal_on_hover
:revealval reveal1 :var revealVolume
:revealvalstr "reveal1" :varname "revealVolume"
(box (box
:orientation "v" :orientation "v"
:space-evenly false :space-evenly false
@ -247,8 +245,8 @@
:flipped true)) :flipped true))
(reveal_on_hover (reveal_on_hover
:revealval reveal2 :var revealMicrophone
:revealvalstr "reveal2" :varname "revealMicrophone"
(box (box
:orientation "v" :orientation "v"
:space-evenly false :space-evenly false
@ -258,17 +256,17 @@
) )
(scale (scale
:class "volslide" :class "volslide"
:value volume :value mic_volume
:onchange "pactl set-source-volume @DEFAULT_SOURCE@ {}%" :onchange "pactl set-source-volume @DEFAULT_SOURCE@ {}%"
:orientation "v" :orientation "v"
:tooltip "${volume}%" :tooltip "${mic_volume}%"
:max 100 :max 101
:min 0 :min 0
:flipped true)) :flipped true))
(reveal_on_hover (reveal_on_hover
:revealval reveal5 :var revealBrightness
:revealvalstr "reveal5" :varname "revealBrightness"
(box (box
:orientation "v" :orientation "v"
:space-evenly false :space-evenly false
@ -285,25 +283,6 @@
:flipped true)) :flipped true))
)) ))
(defwidget reveal_on_hover [revealval revealvalstr ?class ?transition]
(box
:class "reveal_on_hover ${class}"
:orientation "v"
:space-evenly false
:valign "end"
(eventbox
:onhover `${EWW_CMD} update ${revealvalstr}=true`
:onhoverlost `${EWW_CMD} update ${revealvalstr}=false`
(box
:space-evenly false
:orientation "v"
(children :nth 0)
(revealer
:reveal revealval
:transition {transition ?:"slidedown"}
:duration "500ms"
(children :nth 1))))))
;; other windows ;; other windows
(defwindow calendar (defwindow calendar
:geometry (geometry :x "0" :geometry (geometry :x "0"

View file

@ -0,0 +1,47 @@
(defwidget hovered-sign [var]
(box :space-evenly false
(revealer :reveal {!var}
:duration "100ms"
:transition "slideleft"
(children :nth 0))
(revealer :reveal {var}
:duration "100ms"
:transition "slideleft"
(children :nth 1))))
(defwidget reveal_on_hover [var varname ?class ?duration ?transition]
(box
:class "reveal_on_hover ${class}"
:orientation "v"
:space-evenly false
:valign "end"
(eventbox
:onhover `${EWW_CMD} update ${varname}=true`
:onhoverlost `${EWW_CMD} update ${varname}=false`
(box
:space-evenly false
:orientation "v"
(children :nth 0)
(revealer
:reveal var
:transition {transition ?:"slidedown"}
:duration "500ms"
(children :nth 1))))))
(defwidget clickbox [var varname ?class ?duration ?transition]
(box :class "${class} clickbox" :orientation "h" :space-evenly false
(button :onclick "eww update ${varname}=${ var ? false : true }"
(children :nth 0)
)
(revealer :reveal var
:transition {transition ?: "slideleft"}
:duration {duration ?: "500ms"}
(box :class "${class}"
:space-evenly false
(children :nth 1)
(button :onclick "eww update ${varname}=false" :class "close" (label :text "Close"))
)
)
)
)