75 lines
2.5 KiB
Plaintext
75 lines
2.5 KiB
Plaintext
(defwidget tiles []
|
|
(box :class "tiles-grid"
|
|
:orientation "vertical"
|
|
(box :class "tiles tiles1"
|
|
(tile :icon ''
|
|
:label "Network"
|
|
:enabled { network_status == "full" ? true : false }
|
|
:onenable "nmcli n on"
|
|
:ondisable "nmcli n off"
|
|
:visible true
|
|
:class "network")
|
|
|
|
(tile :icon ''
|
|
:label "Bluetooth"
|
|
:enabled { bluetooth_powered == "yes" ? true : false }
|
|
:onenable "bluetoothctl power on"
|
|
:ondisable "bluetoothctl power off"
|
|
:visible true)
|
|
|
|
(tile :icon ''
|
|
:label "Do Not Disturb"
|
|
:enabled { notification_modes =~ "dnd" ? true : false }
|
|
:onenable "makoctl mode -a dnd"
|
|
:ondisable "makoctl mode -r dnd"
|
|
:visible true
|
|
:class "dnd")
|
|
)
|
|
(box :class "tiles tiles2"
|
|
:visible true
|
|
(tile :icon ''
|
|
:label "Airplane Mode"
|
|
:enabled { (network_status != "full" && network_status != "partial") && bluetooth_powered != "yes" ? true : false }
|
|
:onenable "bluetoothctl power off; nmcli n off"
|
|
:ondisable "bluetoothctl power on; nmcli n on")
|
|
(tile :icon ''
|
|
:label "Screen Record"
|
|
:enabled "${is_recording}"
|
|
:onenable "hyprctl dispatch exec \"sh $HOME/.config/eww/scripts/screen-recording.sh\" >> /dev/null"
|
|
:ondisable "kill $(cat $HOME/.cache/recording.pid)"
|
|
:class "screen-rec")
|
|
(tile :icon ''
|
|
:label "Night Light"
|
|
:enabled "${night_light}"
|
|
:onenable "hyprctl dispatch exec \"sh $HOME/.config/eww/scripts/night-light.sh\""
|
|
:ondisable "kill $(cat $HOME/.cache/night-light.pid)"
|
|
:class "night-light")
|
|
)
|
|
)
|
|
)
|
|
|
|
(defwidget tile [ ?class icon label ?onclickarrow ?enabled onenable ondisable ?visible ?min-width ]
|
|
(checkbox :onchecked "${onenable}"
|
|
:onunchecked "${ondisable}"
|
|
:visible { visible == "" || visible ? true : false }
|
|
:checked { enabled == "" || !enabled ? false : true }
|
|
:class "tile-checkbox ${class}"
|
|
|
|
(box :class "tile"
|
|
: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)
|
|
)
|
|
)
|
|
)
|