From 1430ce8ea936af8cb3cfe6f3f82da366b9dad507 Mon Sep 17 00:00:00 2001 From: Elias Almqvist Date: Fri, 6 Jan 2023 16:09:27 +0100 Subject: [PATCH] Laptop fixes --- eww/.config/eww/eww.yuck | 28 +++++++++++++++------------- eww/.config/eww/scripts/battery | 4 ++-- eww/.config/eww/scripts/wifi | 10 +++++----- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/eww/.config/eww/eww.yuck b/eww/.config/eww/eww.yuck index ebb23c4..bbfb9d6 100644 --- a/eww/.config/eww/eww.yuck +++ b/eww/.config/eww/eww.yuck @@ -104,10 +104,10 @@ ;; Control widget (container) (defwidget control [] (box :class "control" :spacing 12 :space-evenly false :orientation "v" - ;; (wifi) - ;; (bat) (music) (volume) + (wifi) + (bat) (time) ) ) @@ -149,7 +149,7 @@ :reveal volume :duration "450ms" (scale :class "volbar" - :value current-volume + :value {current-volume != "" ? current-volume : "0"} :orientation "v" :flipped true :tooltip "Volume: ${current-volume}%" @@ -181,12 +181,14 @@ ;; Wifi Widgets ;; (defwidget wifi [] - (box :orientation "v" - :halign "middle" - :tooltip "SSID: ${wifi-name}" - (button :class "icon wifi-icon" wifi-icon - ))) -(defpoll wifi-icon :interval "1s" "scripts/wifi icon") + (revealer :reveal {wifi-status == "true"} + (box :orientation "v" + :halign "middle" + :tooltip "SSID: ${wifi-name}" + (label :class "icon wifi" + "" + )))) +(defpoll wifi-status :interval "1s" "scripts/wifi status") (defpoll wifi-name :interval "1s" "scripts/wifi name") ;; Workspaces container @@ -248,10 +250,10 @@ ))) (defpoll music-active :interval "200ms" "scripts/musicstatus") -(defpoll music-status :interval "200ms" "playerctl status") -(defpoll artUrl :interval "200ms" "playerctl metadata artUrl") -(defpoll title :interval "200ms" "playerctl metadata title") -(defpoll artist :interval "200ms" "playerctl metadata artist") +(defpoll music-status :interval "200ms" "playerctl status &>/dev/null") +(defpoll artUrl :interval "200ms" "playerctl metadata artUrl &>/dev/null") +(defpoll title :interval "200ms" "playerctl metadata title &>/dev/null") +(defpoll artist :interval "200ms" "playerctl metadata artist &>/dev/null") (defpoll songtime :interval "500ms" "scripts/getSongDuration") (defvar music false) diff --git a/eww/.config/eww/scripts/battery b/eww/.config/eww/scripts/battery index 300c017..f90f48e 100755 --- a/eww/.config/eww/scripts/battery +++ b/eww/.config/eww/scripts/battery @@ -25,10 +25,10 @@ elif [ "$per" -gt "20" ]; then icon="" elif [ "$per" -gt "10" ]; then icon="" - notify-send -u critical "Battery Low" "Connect Charger" + # notify-send -u critical "Battery Low" "Connect Charger" elif [ "$per" -gt "0" ]; then icon="" - notify-send -u critical "Battery Low" "Connect Charger" + notify-send -u critical "Battery Low" "Connect Charger! Battery at $per%" else echo  && exit fi diff --git a/eww/.config/eww/scripts/wifi b/eww/.config/eww/scripts/wifi index f0c0033..80fa766 100755 --- a/eww/.config/eww/scripts/wifi +++ b/eww/.config/eww/scripts/wifi @@ -1,13 +1,13 @@ #!/bin/sh -symbol() { -[ $(cat /sys/class/net/w*/operstate) = down ] && echo  && exit -echo  +status() { +[ $(cat /sys/class/net/w*/operstate) = down ] && echo false && exit +echo true } name() { -nmcli | grep "^wlp" | sed 's/\ connected\ to\ /Connected to /g' | cut -d ':' -f2 + nmcli | grep "^wlp" | sed 's/\ connected\ to\ /Connected to /g' | cut -d ':' -f2 } -[ "$1" = "icon" ] && symbol && exit +[ "$1" = "status" ] && status && exit [ "$1" = "name" ] && name && exit