(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 > /dev/null" :ondisable "nmcli n off > /dev/null" :visible true :class "network") (tile :icon '󰂯' :label "Bluetooth" :enabled { bluetooth_powered == "yes" ? true : false } :onenable "bluetoothctl power on > /dev/null" :ondisable "bluetoothctl power off > /dev/null" :visible { bluetooth_powered == "" ? false : 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 } :timeout "2s" :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) ) ) )