feat(eww): add dyna icons for bluet and wifi
This commit is contained in:
parent
117899ed59
commit
57b75324d4
5 changed files with 54 additions and 8 deletions
|
@ -58,7 +58,7 @@
|
|||
margin-top: -10px;
|
||||
margin-left: -10px;
|
||||
margin-bottom: 10px;
|
||||
padding: 6px;
|
||||
padding: 3px;
|
||||
border: 2px solid $contrastbg;
|
||||
border-top-right-radius: 20px;
|
||||
border-top-left-radius: 10px;
|
||||
|
|
|
@ -92,8 +92,8 @@
|
|||
|
||||
(eventbox :class "left-part"
|
||||
:cursor "pointer"
|
||||
:onclick "rfkill toggle wlan"
|
||||
(label :text " "
|
||||
:onclick "$EWW_PATH/network.sh toggle"
|
||||
(label :text " ${network_icon} "
|
||||
:class "grid-label"
|
||||
)
|
||||
)
|
||||
|
@ -113,9 +113,9 @@
|
|||
|
||||
(eventbox :class "left-part"
|
||||
:cursor "pointer"
|
||||
:onclick "rfkill toggle bluetooth"
|
||||
:onclick "$EWW_PATH/bluetooth.sh toggle"
|
||||
|
||||
(label :text " "
|
||||
(label :text " ${bluetooth_icon} "
|
||||
:class "grid-label"
|
||||
)
|
||||
)
|
||||
|
@ -156,7 +156,7 @@
|
|||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
(box :orientation "h"
|
||||
:space-evenly true
|
||||
:spacing 54
|
||||
:spacing 60
|
||||
:width 0
|
||||
:height 0
|
||||
:halign "center"
|
||||
|
@ -169,7 +169,7 @@
|
|||
:limit-width 10
|
||||
)
|
||||
|
||||
(label :text "todo"
|
||||
(label :text "${bluetooth_dev}"
|
||||
:class "sub-label"
|
||||
:width 0
|
||||
:height 0
|
||||
|
|
27
config/eww/scripts/bluetooth.sh
Executable file
27
config/eww/scripts/bluetooth.sh
Executable file
|
@ -0,0 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
get_device() {
|
||||
if [[ $(bluetoothctl devices Connected) != "" ]]; then
|
||||
bluetoothctl devices Connected | awk '{ for (i = 3; i <= NF; i++) { printf("%s ", $i) } printf("\n") }'
|
||||
else
|
||||
echo "Disconnected"
|
||||
fi
|
||||
}
|
||||
|
||||
get_state() {
|
||||
if [[ "$(rfkill list | grep -A 1 hci0 | grep -o no)" == "no" ]]; then
|
||||
echo " "
|
||||
else
|
||||
echo " "
|
||||
fi
|
||||
}
|
||||
|
||||
[[ "$1" == "device" ]] && get_device
|
||||
[[ "$1" == "toggle" ]] && rfkill toggle bluetooth
|
||||
|
||||
if [[ $1 == "icon" ]]; then
|
||||
while true; do
|
||||
sleep 0.1
|
||||
get_state
|
||||
done
|
||||
fi
|
|
@ -8,4 +8,20 @@ get_ssid() {
|
|||
fi
|
||||
}
|
||||
|
||||
get_state() {
|
||||
if [[ "$(rfkill list | grep -A 1 LAN | grep -o no)" == "no" ]]; then
|
||||
echo " "
|
||||
else
|
||||
echo " "
|
||||
fi
|
||||
}
|
||||
|
||||
[[ "$1" == "ssid" ]] && get_ssid
|
||||
[[ "$1" == "toggle" ]] && rfkill toggle wlan
|
||||
|
||||
if [[ $1 == "icon" ]]; then
|
||||
while true; do
|
||||
sleep 0.1
|
||||
get_state
|
||||
done
|
||||
fi
|
||||
|
|
|
@ -2,8 +2,11 @@
|
|||
(deflisten heart_icon "tail -f $HOME/.config/.heart")
|
||||
(deflisten mic_icon "$EWW_PATH/mic.sh icon")
|
||||
|
||||
(deflisten network_ssid "zscroll -l 10 -u true \"$EWW_PATH/network.sh ssid\"")
|
||||
(deflisten network_ssid "zscroll -d 0.7 -l 10 -p '. ' -u true \"$EWW_PATH/network.sh ssid\"")
|
||||
(deflisten network_icon "$EWW_PATH/network.sh icon")
|
||||
|
||||
(deflisten bluetooth_dev "zscroll -d 0.7 -l 10 -p '. ' -u true \"$EWW_PATH/bluetooth.sh device\"")
|
||||
(deflisten bluetooth_icon "$EWW_PATH/bluetooth.sh icon")
|
||||
|
||||
(deflisten volume_icon "$EWW_PATH/volume.sh icon")
|
||||
(defpoll volume :interval "1s" "$EWW_PATH/volume.sh percentage")
|
||||
|
|
Loading…
Reference in a new issue