Files
colorshell/eww/widgets/control-center/toggles.yuck
T

62 lines
1.9 KiB
Plaintext

(defwidget toggles []
(box :class "toggles-grid"
:orientation "vertical"
(box :class "toggles toggles1"
(_toggle :icon '󰤨'
:label "Network"
:enabled { network_status == "full" ? true : false }
:onenable "nmcli n on"
:ondisable "nmcli n off"
:visible true
:class "network")
(_toggle :icon '󰂯'
:label "Bluetooth"
:enabled { bluetooth_powered == "yes" ? true : false }
:onenable "bluetoothctl power on"
:ondisable "bluetoothctl power off"
:visible true)
(_toggle :icon '󰍶'
:label "Do Not Disturb"
:show-arrow false
:enabled { notification_modes =~ "dnd" ? true : false }
:onenable "makoctl mode -a dnd"
:ondisable "makoctl mode -r dnd"
:visible true
:class "dnd")
)
(box :class "toggles toggles2"
:visible false
(_toggle :icon '󰀝'
:label "Airplane Mode"
:show-arrow false
:onenable "notify-send -a 'Airplane Mode' 'Toggle AP mode!'"
:ondisable ""
:visible true)
)
)
)
(defwidget _toggle [ ?class icon label ?onclickarrow ?enabled onenable ondisable visible ?min-width ]
(checkbox :onchecked "${onenable}"
:onunchecked "${ondisable}"
:checked { enabled == true ? true : false }
:class "toggle-checkbox ${class}"
(box :class "toggle"
:space-evenly false
:valign "center"
(label :text "${icon}"
:class "icon"
:unindent true
:limit-width 1
:show-truncated false
:xalign 0)
(label :text "${label}"
:class "label"
:xalign 0)
)
)
)