Added eww bluetooth module
This commit is contained in:
@@ -38,6 +38,19 @@ tooltip label {
|
|||||||
color: $base02;
|
color: $base02;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Bluetooth **/
|
||||||
|
.bluetooth {
|
||||||
|
color: $base0D;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bluetooth.icon {
|
||||||
|
padding-right: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bluetooth-text {
|
||||||
|
padding-left: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
/** Wifi **/
|
/** Wifi **/
|
||||||
.wifi {
|
.wifi {
|
||||||
color: $base0D;
|
color: $base0D;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
(include "./widgets/common.yuck")
|
(include "./widgets/common.yuck")
|
||||||
|
|
||||||
(include "./widgets/battery.yuck")
|
(include "./widgets/battery.yuck")
|
||||||
|
(include "./widgets/bluetooth.yuck")
|
||||||
(include "./widgets/clock.yuck")
|
(include "./widgets/clock.yuck")
|
||||||
(include "./widgets/volume.yuck")
|
(include "./widgets/volume.yuck")
|
||||||
(include "./widgets/workspaces.yuck")
|
(include "./widgets/workspaces.yuck")
|
||||||
@@ -35,6 +36,7 @@
|
|||||||
(box :halign "end"
|
(box :halign "end"
|
||||||
:orientation "h"
|
:orientation "h"
|
||||||
:space-evenly "false"
|
:space-evenly "false"
|
||||||
|
(bluetooth-module)
|
||||||
(wifi-module)
|
(wifi-module)
|
||||||
(battery-module)
|
(battery-module)
|
||||||
(volume-module)
|
(volume-module)
|
||||||
|
|||||||
29
config/eww/widgets/bluetooth.yuck
Normal file
29
config/eww/widgets/bluetooth.yuck
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
(defvar bluetooth-reveal false)
|
||||||
|
(defpoll bluetooth-status
|
||||||
|
:initial ""
|
||||||
|
:interval "10s"
|
||||||
|
"bluetoothctl show | grep -q \"Powered: yes\" && { [[ $(bluetoothctl devices Connected) ]] && echo \"connected\" || echo \"on\"; } || echo \"off\"")
|
||||||
|
(defpoll bluetooth-devices
|
||||||
|
:initial ""
|
||||||
|
:interval "20s"
|
||||||
|
"for device in $(bluetoothctl devices Connected | grep Device | cut -d ' ' -f 2); do bluetoothctl info $device | grep \"Alias\" | cut -d ' ' -f 2-; done;")
|
||||||
|
|
||||||
|
|
||||||
|
(defwidget bluetooth-module []
|
||||||
|
(eventbox :onhover "${EWW_CMD} update bluetooth-reveal=true"
|
||||||
|
:onhoverlost "${EWW_CMD} update bluetooth-reveal=false"
|
||||||
|
:onclick "$HOME/.config/rofi/menus/bluetooth/bluetooth.sh"
|
||||||
|
(box :class "module bluetooth"
|
||||||
|
:orientation "h"
|
||||||
|
:space-evenly "false"
|
||||||
|
:tooltip {bluetooth-status == "connected" ? bluetooth-devices :
|
||||||
|
bluetooth-status == "on" ? "Bluetooth: On" : "Bluetooth: Off"}
|
||||||
|
(label :text {bluetooth-status == "connected" ? "" :
|
||||||
|
bluetooth-status == "on" ? "" : ""}
|
||||||
|
:class "bluetooth icon")
|
||||||
|
(revealer :transition "slideleft"
|
||||||
|
:duration "750ms"
|
||||||
|
:reveal {bluetooth-reveal && winfo.connected}
|
||||||
|
(label :class "bluetooth-text"
|
||||||
|
:text {bluetooth-status == "connected" ? "Connected" :
|
||||||
|
bluetooth-status == "on" ? "On" : "Off"})))))
|
||||||
Reference in New Issue
Block a user