feat(eww): make sliders work
This commit is contained in:
parent
082485d7a5
commit
30ada01972
4 changed files with 65 additions and 21 deletions
|
@ -92,7 +92,7 @@
|
|||
|
||||
(eventbox :class "left-part"
|
||||
:cursor "pointer"
|
||||
:onclick "notify-send 'set this up moron'"
|
||||
:onclick "rfkill toggle wlan"
|
||||
|
||||
(label :text " "
|
||||
:class "grid-label"
|
||||
|
@ -114,12 +114,16 @@
|
|||
|
||||
(eventbox :class "left-part"
|
||||
:cursor "pointer"
|
||||
:onclick "rfkill toggle bluetooth"
|
||||
|
||||
(label :text " "
|
||||
:class "grid-label"
|
||||
)
|
||||
)
|
||||
(eventbox :class "right-part"
|
||||
:cursor "pointer"
|
||||
:onclick "blueberry &"
|
||||
|
||||
(label :text " " :class "grid-chev")
|
||||
)
|
||||
)
|
||||
|
@ -132,13 +136,19 @@
|
|||
|
||||
(eventbox :class "left-part"
|
||||
:cursor "pointer"
|
||||
:onclick "notify-send 'set this up moron'"
|
||||
|
||||
(label :text " "
|
||||
:class "grid-label"
|
||||
)
|
||||
)
|
||||
(eventbox :class "right-part"
|
||||
:cursor "pointer"
|
||||
(label :text " " :class "grid-chev")
|
||||
:onclick "notify-send 'set this up moron'"
|
||||
|
||||
(label :text " "
|
||||
:class "grid-chev"
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
@ -162,12 +172,16 @@
|
|||
|
||||
(eventbox :class "left-part"
|
||||
:cursor "pointer"
|
||||
(label :text " "
|
||||
:onclick "swayosd --output-volume mute-toggle"
|
||||
|
||||
(label :text " ${volume_icon} "
|
||||
:class "grid-label"
|
||||
)
|
||||
)
|
||||
(eventbox :class "right-part"
|
||||
:cursor "pointer"
|
||||
:onclick "pavucontrol &"
|
||||
|
||||
(label :text " " :class "grid-chev")
|
||||
)
|
||||
)
|
||||
|
@ -180,12 +194,16 @@
|
|||
|
||||
(eventbox :class "left-part"
|
||||
:cursor "pointer"
|
||||
:onclick "swayosd --input-volume mute-toggle"
|
||||
|
||||
(label :text " "
|
||||
:class "grid-label"
|
||||
)
|
||||
)
|
||||
(eventbox :class "right-part"
|
||||
:cursor "pointer"
|
||||
:onclick "pavucontrol &"
|
||||
|
||||
(label :text " " :class "grid-chev")
|
||||
)
|
||||
)
|
||||
|
@ -198,12 +216,16 @@
|
|||
|
||||
(eventbox :class "left-part"
|
||||
:cursor "pointer"
|
||||
:onclick "notify-send 'set this up moron'"
|
||||
|
||||
(label :text " "
|
||||
:class "grid-label"
|
||||
)
|
||||
)
|
||||
(eventbox :class "right-part"
|
||||
:cursor "pointer"
|
||||
:onclick "notify-send 'set this up moron'"
|
||||
|
||||
(label :text " " :class "grid-chev")
|
||||
)
|
||||
)
|
||||
|
@ -226,9 +248,10 @@
|
|||
:height 0
|
||||
:space-evenly false
|
||||
|
||||
(label :text " " :class "slider-label")
|
||||
(label :text "${volume_icon}" :class "slider-label")
|
||||
|
||||
(scale :value 0
|
||||
(scale :value volume_value
|
||||
:onchange "$EWW_PATH/volume.sh set {}"
|
||||
:min 0
|
||||
:max 101
|
||||
:height 0
|
||||
|
@ -243,9 +266,11 @@
|
|||
:height 0
|
||||
:space-evenly false
|
||||
|
||||
(label :text " " :class "slider-label")
|
||||
(label :text " ${br_icon} " :class "slider-label" :style "margin-left: 6px;
|
||||
margin-right: -6px")
|
||||
|
||||
(scale :value 0
|
||||
(scale :value br
|
||||
:onchange "$EWW_PATH/brightness.sh set {}"
|
||||
:min 0
|
||||
:max 101
|
||||
:height 0
|
||||
|
@ -253,6 +278,7 @@
|
|||
)
|
||||
)
|
||||
)
|
||||
|
||||
)
|
||||
)
|
||||
(defwindow quick-settings-reveal
|
||||
|
|
|
@ -8,17 +8,30 @@ percentage () {
|
|||
local icon2=$3
|
||||
local icon3=$4
|
||||
local icon4=$5
|
||||
if [ "$val" -le 15 ]; then
|
||||
echo $icon1
|
||||
local icon5=$6
|
||||
local icon6=$7
|
||||
local icon7=$8
|
||||
local icon8=$9
|
||||
if [ "$val" -le 1 ]; then
|
||||
echo "$icon1"
|
||||
elif [ "$val" -le 15 ]; then
|
||||
echo "$icon2"
|
||||
elif [ "$val" -le 30 ]; then
|
||||
echo $icon2
|
||||
echo "$icon3"
|
||||
elif [ "$val" -le 45 ]; then
|
||||
echo "$icon4"
|
||||
elif [ "$val" -le 60 ]; then
|
||||
echo $icon3
|
||||
echo "$icon5"
|
||||
elif [ "$val" -le 75 ]; then
|
||||
echo "$icon6"
|
||||
elif [ "$val" -le 90 ]; then
|
||||
echo "$icon7"
|
||||
else
|
||||
echo $icon4
|
||||
echo "$icon8"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
get_brightness () {
|
||||
(( br = $(brightnessctl get) * 100 / $(brightnessctl max) ))
|
||||
echo $br
|
||||
|
@ -30,7 +43,7 @@ get_percent () {
|
|||
|
||||
get_icon () {
|
||||
local br=$(get_percent)
|
||||
echo $(percentage "$br" "" "" "" "")
|
||||
echo $(percentage "$br" " " " " " " " " " " " " " " " ")
|
||||
}
|
||||
|
||||
if [[ $1 == "br" ]]; then
|
||||
|
@ -42,7 +55,10 @@ if [[ $1 == "percent" ]]; then
|
|||
fi
|
||||
|
||||
if [[ $1 == "icon" ]]; then
|
||||
get_icon
|
||||
while true; do
|
||||
sleep 0.2
|
||||
get_icon
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ $1 == "set" ]]; then
|
||||
|
|
|
@ -23,12 +23,11 @@ percentage () {
|
|||
}
|
||||
|
||||
is_muted () {
|
||||
pacmd list-sinks | awk '/muted/ { print $2 }'
|
||||
pactl get-sink-mute $SINK | awk '{print $2}'
|
||||
}
|
||||
|
||||
get_percentage () {
|
||||
local muted=$(is_muted)
|
||||
if [[ $muted == 'yes' ]]; then
|
||||
if [[ $(is_muted) == 'yes' ]]; then
|
||||
echo 0%
|
||||
else
|
||||
vol=$(pactl get-sink-volume @DEFAULT_SINK@ | grep Volume | awk '{print $5}' | tr % " ")
|
||||
|
@ -39,7 +38,7 @@ get_percentage () {
|
|||
get_icon () {
|
||||
local vol=$(get_percentage)
|
||||
if [[ $vol == "0%" ]]; then
|
||||
echo "婢"
|
||||
echo " 婢"
|
||||
else
|
||||
echo $(percentage "$vol" "" "" "墳" "")
|
||||
fi
|
||||
|
@ -61,7 +60,10 @@ get_vol () {
|
|||
}
|
||||
|
||||
if [[ $1 == "icon" ]]; then
|
||||
get_icon
|
||||
while true; do
|
||||
sleep 0.2
|
||||
get_icon
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ $1 == "class" ]]; then
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
(deflisten notif_icon "$EWW_PATH/notif.sh icon")
|
||||
(deflisten heart_icon "tail -f $HOME/.config/.heart")
|
||||
|
||||
(defpoll volume_icon :interval "1s" "$EWW_PATH/volume.sh icon")
|
||||
(deflisten volume_icon "$EWW_PATH/volume.sh icon")
|
||||
(defpoll volume :interval "1s" "$EWW_PATH/volume.sh percentage")
|
||||
(defpoll volume_value :interval "1s" "$EWW_PATH/volume.sh vol")
|
||||
(defpoll is_muted :interval "1s" "$EWW_PATH/volume.sh muted")
|
||||
|
||||
(defpoll br_icon :interval "1s" "$EWW_PATH/brightness.sh icon")
|
||||
(deflisten br_icon "$EWW_PATH/brightness.sh icon")
|
||||
(defpoll br :interval "1s" "$EWW_PATH/brightness.sh br")
|
||||
|
||||
(defpoll completeday :interval "1h" "date '+%A, %d %B'")
|
||||
|
|
Loading…
Reference in a new issue