eww: Add WIP bluetooth widget

This commit is contained in:
2024-05-19 12:22:00 +02:00
parent cb7c1dc23c
commit a5b2a89963
2 changed files with 39 additions and 10 deletions

View File

@ -126,6 +126,13 @@ scale trough {
color: red; color: red;
} }
.bluetooth {
}
.bluetooth.active {
}
.battery-gauge { .battery-gauge {
color: $highlight1; color: $highlight1;
transition: all 0.5s; transition: all 0.5s;

View File

@ -36,6 +36,7 @@
:class "bottom" :class "bottom"
:space-evenly false :space-evenly false
(vpn) (vpn)
(bluetooth)
(speaker) (speaker)
(temperature) (temperature)
(battery) (battery)
@ -71,9 +72,37 @@
(label :text n)) (label :text n))
) )
(defwidget vpn []
(button :valign "end"
:class "vpn thingy ${vpn_status.class}"
:onclick "${vpn_status.on_click}"
:tooltip "${vpn_status.tooltip}"
(label :text "${vpn_status.icon}")
))
(defwidget bluetooth []
(eventbox :onhover "${EWW_CMD} update show_bluetooth=true"
:onhoverlost "${EWW_CMD} update show_bluetooth=false"
(box :orientation "v"
:class "thingy bluetooth ${show_bluetooth ? "active" : ""}"
:space-evenly false
(revealer :transition "slidedown"
:reveal show_bluetooth
(box :orientation "v"
(button :class "clickable" :onclick "ba lurar" (label :text "LUR"))
(button :class "clickable" :onclick "ba högtalare" (label :text "HÖG"))
(button :class "clickable" :onclick "ba bluetoothctl disconnect" (label :text "---"))
)
)
(label :text "BLT")
(revealer :transition "slideup"
:reveal {!show_bluetooth}
(label :text "---")
)
)))
(defwidget speaker [] (defwidget speaker []
(eventbox (eventbox :onhover "${EWW_CMD} update show_volume=true"
:onhover "${EWW_CMD} update show_volume=true"
:onhoverlost "${EWW_CMD} update show_volume=false" :onhoverlost "${EWW_CMD} update show_volume=false"
(box :orientation "v" (box :orientation "v"
:class "thingy volbox ${show_volume ? "active" : ""}" :class "thingy volbox ${show_volume ? "active" : ""}"
@ -95,14 +124,6 @@
) )
))) )))
(defwidget vpn []
(button :valign "end"
:class "vpn thingy ${vpn_status.class}"
:onclick "${vpn_status.on_click}"
:tooltip "${vpn_status.tooltip}"
(label :text "${vpn_status.icon}")
))
(defwidget temperature [] (defwidget temperature []
(box :orientation "v" (box :orientation "v"
:valign "end" :valign "end"
@ -174,6 +195,7 @@
)) ))
(defvar show_volume false) (defvar show_volume false)
(defvar show_bluetooth false)
(defpoll workspaces :interval "1s" "eww-workspaces") (defpoll workspaces :interval "1s" "eww-workspaces")
(defpoll volume_out :interval "1s" "pamixer --get-volume") (defpoll volume_out :interval "1s" "pamixer --get-volume")