diff --git a/config/eww/quick-settings/quick-settings.yuck b/config/eww/quick-settings/quick-settings.yuck index 32cbd4e1..d6a3a03f 100644 --- a/config/eww/quick-settings/quick-settings.yuck +++ b/config/eww/quick-settings/quick-settings.yuck @@ -311,7 +311,7 @@ (scale :value br :onchange "$EWW_PATH/brightness.sh set {}" :min 0 - :max 101 + :max 256 :height 0 :width 0 ) diff --git a/config/eww/scripts/bluetooth.sh b/config/eww/scripts/bluetooth.sh index 6a50e292..0455be19 100755 --- a/config/eww/scripts/bluetooth.sh +++ b/config/eww/scripts/bluetooth.sh @@ -12,18 +12,23 @@ get_device() { get_state() { if [[ "$(rfkill list | grep -A 1 hci0 | grep -o no)" == "no" ]]; then + eww update bluetooth_icon=" 󰂯 " echo " 󰂯 " > "$FILE" else + eww update bluetooth_icon=" 󰂲 " echo " 󰂲 " > "$FILE" fi } [[ "$1" == "device" ]] && get_device -[[ "$1" == "toggle" ]] && rfkill toggle bluetooth +if [[ "$1" == "toggle" ]]; then + rfkill toggle bluetooth + get_state +fi if [[ $1 == "icon" ]]; then while true; do - sleep 0.1 + sleep 1 get_state tail "$FILE" done diff --git a/config/eww/scripts/brightness.sh b/config/eww/scripts/brightness.sh index f68f01ed..136d451b 100755 --- a/config/eww/scripts/brightness.sh +++ b/config/eww/scripts/brightness.sh @@ -1,67 +1,46 @@ #!/usr/bin/env bash -# @requires: brightnessctl +get_icon () { + val=$(brightnessctl get) + + if [ "$val" -le 3 ]; then + eww update br_icon=" " + + elif [ "$val" -le 38 ]; then + eww update br_icon=" " + + elif [ "$val" -le 77 ]; then + eww update br_icon=" " + + elif [ "$val" -le 115 ]; then + eww update br_icon=" " + + elif [ "$val" -le 153 ]; then + eww update br_icon=" " + + elif [ "$val" -le 191 ]; then + eww update br_icon=" " + + elif [ "$val" -le 230 ]; then + eww update br_icon=" " -percentage () { - local val=$(echo $1 | tr '%' ' ' | awk '{print $1}') - local icon1=$2 - local icon2=$3 - local icon3=$4 - local icon4=$5 - 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 "$icon3" - elif [ "$val" -le 45 ]; then - echo "$icon4" - elif [ "$val" -le 60 ]; then - echo "$icon5" - elif [ "$val" -le 75 ]; then - echo "$icon6" - elif [ "$val" -le 90 ]; then - echo "$icon7" else - echo "$icon8" + eww update br_icon=" " fi } - -get_brightness () { - (( br = $(brightnessctl get) * 100 / $(brightnessctl max) )) - echo $br -} - -get_percent () { - echo $(get_brightness)% -} - -get_icon () { - local br=$(get_percent) - echo $(percentage "$br" " " " " " " " " " " " " " " " ") -} - if [[ $1 == "br" ]]; then - get_brightness -fi - -if [[ $1 == "percent" ]]; then - get_percent + brightnessctl get fi if [[ $1 == "icon" ]]; then while true; do - sleep 0.01 + sleep 1 get_icon done fi if [[ $1 == "set" ]]; then - eww update br=$2 - brightnessctl set $2% + brightnessctl set "$2" + get_icon fi diff --git a/config/eww/scripts/network.sh b/config/eww/scripts/network.sh index f9ef48bb..c2e13fad 100755 --- a/config/eww/scripts/network.sh +++ b/config/eww/scripts/network.sh @@ -10,18 +10,22 @@ get_ssid() { get_state() { if [[ "$(rfkill list | grep -A 1 LAN | grep -o no)" == "no" ]]; then - echo " 󰖩 " + eww update network_icon=" 󰖩 " else - echo " 󰖪 " + eww update network_icon=" 󰖪 " fi } [[ "$1" == "ssid" ]] && get_ssid -[[ "$1" == "toggle" ]] && rfkill toggle wlan + +if [[ "$1" == "toggle" ]]; then + rfkill toggle wlan + get_state +fi if [[ $1 == "icon" ]]; then while true; do - sleep 0.1 + sleep 1 get_state done fi