eww: add new tiles to control-center, new notification popup, new styles for a lot of widgets

This commit is contained in:
retrozinndev
2025-01-07 16:26:20 -03:00
parent 435b222e03
commit c505ecf4cf
43 changed files with 802 additions and 319 deletions
+2 -1
View File
@@ -1,7 +1,8 @@
(defwidget audio []
(eventbox :onclick "sh scripts/eww-window.sh toggle volume-control"
(eventbox :onclick "sh ${EWW_CONFIG_DIR}/scripts/eww-window.sh toggle volume-control"
:class "audio-eventbox"
:cursor "pointer"
(box :class "audio ${window_state_volume-control}"
(eventbox :onscroll `[ {} == "up" ] && wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ || wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-`
(label :text "${ json_volume.output != 0 ? '󰕾' : '󰝟' } ${json_volume.output}%"))
+1 -1
View File
@@ -1,6 +1,6 @@
(defwidget battery [ ?device ]
(box :class "battery"
:visible { EWW_BATTERY != "" ? true : false }
(label :text "󰁹 ${EWW_BATTERY}%")
(label :text "󰁹 ${ EWW_BATTERY != '' ? EWW_BATTERY?.status : '' }%")
)
)
+23 -5
View File
@@ -1,8 +1,26 @@
(defwidget clock []
(box :class "clock"
:tooltip "${day-name}, ${month-name} ${day}"
(button :onclick "sh scripts/eww-window.sh toggle calendar-window"
:class "${window_state_calendar-window == 'open' ? 'cal-open' : ''}"
"${day-name} ${day}, ${time}")
(box :class "clock"
:tooltip { formattime(EWW_TIME, "%A, %B %d") }
(eventbox :onclick "sh scripts/eww-window.sh toggle calendar-window"
:class '${ window_state_calendar-window == "open" ? "cal-open" : "" } button'
(box :space-evenly false
(box :space-evenly false
:class "time"
(label :text "󰸗"
:class "icon")
(label :text "${ formattime(EWW_TIME, "%A") }")
(revealer :reveal { window_state_calendar-window == "closed" }
:transition "slideright"
:duration "240ms"
:class "unrevealer"
(label :text { formattime(EWW_TIME, "%d, %H:%M") } )
)
)
)
)
)
)
+17
View File
@@ -0,0 +1,17 @@
(defwidget hardware [ ?cpu ?memory ?visible ]
(eventbox :class "hardware-eventbox button"
:onclick "sh ${EWW_CONFIG_DIR}/scripts/eww-window.sh toggle hardware-monitor"
:visible { visible == "" || visible ? true : false }
(box :class "hardware"
:space-evenly false
(box :class "cpu"
:visible { cpu == "" || cpu ? true : false }
(label :text " ${ round(EWW_CPU?.avg, 0) }%")
)
(box :class "memory"
:visible { memory == "" || memory ? true : false }
(label :text " ${ round(EWW_RAM?.used_mem_perc, 0) }%")
)
)
)
)
+10 -4
View File
@@ -6,8 +6,8 @@
:onhoverlost "${EWW_CMD} update media_reveal_controls=false"
:visible { json_media == "" || (json_media.title == "null" &&
json_media.artist == "null") ||
(active_window.class =~ json_media.player ||
active_window.title =~ json_media.title) ?
(json_active_window.class =~ json_media.player ||
json_active_window.title =~ json_media.title) ?
false : true
}
:onclick "sh scripts/eww-window.sh toggle floating-media"
@@ -27,7 +27,9 @@
:text "${json_media.title}"
:limit-width 40)
(box :class "separator")
(separator :orientation "horizontal"
:alpha 0.8
:style "border-radius: 2x;")
(label :class "media-artist"
:text "${json_media.artist}"
@@ -37,9 +39,13 @@
(revealer :class "media-controls-revealer"
:reveal { media_reveal_controls ? "${ window_state_floating-media == 'closed' ? true : false }" : false }
:transition "slideright"
:duration "180ms"
:duration "220ms"
(box :class "media-controls"
(button :class "url"
:onclick "wl-copy '${json_media.url}'"
:tooltip "Copy link to Clipboard"
"󰌷")
(button :class "previous"
:onclick "playerctl previous --player=${json_media.player}"
"󰒮")
+5 -2
View File
@@ -1,5 +1,8 @@
(defwidget network []
(box :class "network"
(button "${ network_status == 'full' ? ' ' : '󰤭 ' }")
(eventbox :class "button network-eventbox"
:onclick "hyprctl dispatch exec 'nm-connection-editor'"
(box :class "network"
(label :text "${ network_status == 'full' ? ' ' : '󰤭 ' }")
)
)
)
+8 -7
View File
@@ -1,26 +1,27 @@
(defwidget window []
(box :class "window"
:visible { active_window.class == "" || active_window.class == "null" ? false : true }
:visible { json_active_window.class == "" || json_active_window.class == "null" ? false : true }
:space-evenly false
:valign "center"
:orientation "horizontal"
(image :class "icon"
:icon "${ active_window.initialClass =~ 'zen-(.*)$' ? 'zen-browser' : active_window.initialClass }"
:icon "${ json_active_window.initialClass =~ 'zen-(.*)$' ? 'zen-browser' : json_active_window.initialClass }"
:icon-size "toolbar")
(box :class "info"
:orientation { active_window.title == "" ? "horizontal" : "vertical" }
:orientation { json_active_window.title == "" ? "horizontal" : "vertical" }
:space-evenly false
(label :class "window-class"
:text "${active_window.class}"
:text "${json_active_window.class}"
:xalign 0
:yalign 0)
(label :class "window-title"
:text "${active_window.title}"
:visible { active_window.title != "" ? true : false }
:text "${json_active_window.title}"
:visible { json_active_window.title != "" ? true : false }
:limit-width 45
:tooltip "${active_window.title}"
:tooltip "${json_active_window.title}"
:xalign 0
:yalign 0)
)
+1
View File
@@ -6,6 +6,7 @@
:onhover "${EWW_CMD} update hover_workspaces=true"
:onhoverlost "${EWW_CMD} update hover_workspaces=false"
(box :class "workspaces"
:valign "center"
(literal :content literal_workspaces)
)
)
+2 -3
View File
@@ -1,7 +1,6 @@
(defwidget big-media [ show-album-bg show-album-image ?album-image-size ?style-background-color ?visible ]
(defwidget big-media [ show-album-bg show-album-image ?album-image-size ?style ?visible ]
(box :class "big-media ${ show-album-bg ? 'album-bg' : '' } ${ show-album-image ? 'album-image' : '' }"
:style "${ show-album-bg ? 'background-image: image(url(\"${json_media.artUrl}\"))' : '' } ${
style-background-color != '' ? 'background-color: ${style-background-color}' : '' }"
:style "${ show-album-bg ? 'background-image: url(\"${json_media.artUrl}\");' : '' } ${style}"
:visible { visible == "" ? true : "${ visible ? true : false }" }
:space-evenly false
:orientation "vertical"
+2 -3
View File
@@ -23,9 +23,8 @@
:text "${application_name}")
)
(button :class "close"
:style "border-radius: 10px; padding: 6px; padding-left: 10px; padding-right: 10px;"
:onclick "${onclickclose}"
:visible false ; Temporary, will try doing something to remove history items
:visible true
"󰅖")
)
@@ -43,7 +42,7 @@
:space-evenly false
(label :class "summary"
:text "${summary}"
:markup "${summary}"
:xalign 0
:halign "start"
:show-truncated true)
+32 -48
View File
@@ -1,54 +1,38 @@
(defwidget notifications []
(box :class "cc-notifications"
:orientation "vertical"
:space-evenly false
(scroll :class "vertical-scroll"
:hscroll false
:vscroll true
:hexpand true
:vexpand true
:height 500
:style "border-radius: 16px;"
(scroll :class "cc-notifications scroll"
:hscroll false
:vscroll true
:vexpand true
:style "border-radius: 16px;"
(box :class "notifications"
:orientation "vertical"
:space-evenly false
(for notification in json_notifications
(notification :application_name "${notification.app-name.data}"
:image "${notification.app-icon.data}"
:summary "${notification.summary.data}"
:body "${notification.body.data}"
:onclick "makoctl invoke -n ${notification.id.data} view"
:icon "${notification.app-name.data}"
)
)
(box :class "empty-notifications"
:visible { arraylength(json_notifications) == 0 ? true : false }
:style "margin-top: 50px;"
:space-evenly false
:orientation "vertical"
:halign "center"
(label :class "bell-icon"
:text "󱇦"
:style "font-size: 96px")
(label :text "You're done!"
:style "margin-left: 12px;")
)
)
)
(box :class "bottom button-row"
:halign "end"
(box :class "notifications"
:orientation "vertical"
:space-evenly false
(button :class "clear-all"
:onclick { arraylength(json_notifications) > 0 ? "pkill mako; hyprctl dispatch exec mako" : "" }
"󰎟 Clear")
(for notification in { json_notification_history["history"] }
(notification :application_name "${notification.app-name.data}"
:image "${notification.app-icon.data}"
:summary "${notification.summary.data}"
:body "${notification.body.data}"
:onclickclose "sh scripts/notification-remove.sh ${notification.id.data}"
:icon "${notification.app-name.data}")
)
(box :class "empty-notifications"
:visible { arraylength(json_notification_history["history"]) == 0 }
:style "margin-top: 50px;"
:space-evenly false
:orientation "vertical"
:halign "center"
:valign "center"
(label :class "bell-icon"
:text "󱇦"
:style "font-size: 96px")
(label :text "You're done!"
:style "margin-left: 12px;")
)
)
)
)
+74
View File
@@ -0,0 +1,74 @@
(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)
)
)
)
-61
View File
@@ -1,61 +0,0 @@
(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)
)
)
)
+4
View File
@@ -0,0 +1,4 @@
(defwidget separator [ ?orientation ?alpha ?style ]
(box :class "separator ${ orientation == '' || orientation == 'horizontal' ? 'horizontal' : 'vertical' }"
:style "opacity: ${ alpha == '' ? 1 : alpha }; ${style}")
)