From df03fbf5edf83a61f81c8f93551a75b4543cffd1 Mon Sep 17 00:00:00 2001 From: Lucas Sta Maria Date: Mon, 30 Jan 2023 21:30:03 -0500 Subject: [PATCH] feat: add bluetooth devices to eww bar Signed-off-by: Lucas Sta Maria --- .config/eww/eww.yuck | 34 +++++++++++++++++++++------------- .config/eww/scripts/bluetooth | 5 +++++ 2 files changed, 26 insertions(+), 13 deletions(-) create mode 100755 .config/eww/scripts/bluetooth diff --git a/.config/eww/eww.yuck b/.config/eww/eww.yuck index a9de0dd..15369ad 100644 --- a/.config/eww/eww.yuck +++ b/.config/eww/eww.yuck @@ -30,6 +30,7 @@ (defpoll songcard_button :interval "1s" "scripts/songcardplayrender") (defpoll wifi_label :interval "1s" "scripts/wifi") +(defpoll bluetooth_label :interval "1s" "scripts/bluetooth") (defpoll volume_level :interval "1s" "scripts/volume") (defpoll volume_label :initial '{"icon": "", content: "0"}' :interval "1s" @@ -116,6 +117,7 @@ :space-evenly "false" :spacing 10 (wifi) + (bluetooth) (brightness) (volume) (power) @@ -126,6 +128,12 @@ (icon-module :icon "↑" (literal :content {wifi_label}))) +(defwidget bluetooth [] + (icon-module :class "bluetooth" + :icon "ᛒ" + :visible true + (literal :content {bluetooth_label}))) + ;; A widget for tracking brightness (defwidget brightness [] (eventbox :onhover "eww update brightness_reveal=true" @@ -208,16 +216,16 @@ (literal :content {songcardtitle}) (literal :content {songcardartist}) ;; song controls - (centerbox :class "songcard__controls" - :orientation "horizontal" - :valign "center" - :halign "center" - (button :onclick "scripts/songback" - :class "songcard__button" - (image :path "img/musicback.png" :image-width 20 :image-height 20)) - (button :onclick "scripts/songplay" - :class "songcard__button" - (literal :content {songcard_button})) - (button :onclick "scripts/songnext" - :class "songcard__button" - (image :path "img/musicnext.png" :image-width 20 :image-height 20)))))) + (centerbox :class "songcard__controls" + :orientation "horizontal" + :valign "center" + :halign "center" + (button :onclick "scripts/songback" + :class "songcard__button" + (image :path "img/musicback.png" :image-width 20 :image-height 20)) + (button :onclick "scripts/songplay" + :class "songcard__button" + (literal :content {songcard_button})) + (button :onclick "scripts/songnext" + :class "songcard__button" + (image :path "img/musicnext.png" :image-width 20 :image-height 20)))))) diff --git a/.config/eww/scripts/bluetooth b/.config/eww/scripts/bluetooth new file mode 100755 index 0000000..b7f682b --- /dev/null +++ b/.config/eww/scripts/bluetooth @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +val=$(bluetoothctl devices Connected | wc -l) + +echo "(label :class \"bluetooth__label\" :text \"$val\")"