a lot of changes and new stuff! started using mako

This commit is contained in:
retrozinndev
2024-12-19 22:06:54 -03:00
parent ab899c2acb
commit e814cf996f
59 changed files with 837 additions and 542 deletions
@@ -1,24 +1,20 @@
(deflisten json_media_data :initial "{}"
`python ./scripts/mediaplayer.py`)
(defwidget mediaplayer [ album_background ]
(defwidget big-media [ album_background ]
(box :orientation "horizontal"
:space-evenly false
:class "mediaplayer ${ album_background == true ? 'mediaplayer-album-bg' : '' }"
:style { album_background == true ? "background-image: image(url('${json_media_data.artUrl}'))" : "" }
:visible { json_media_data.title != "null" && json_media_data.artist != "null" ? true : false }
:class "big-media ${ album_background == true ? 'album-bg' : '' }"
:style { album_background == true ? "background-image: image(url('${json_media.artUrl}'))" : "" }
:visible { json_media.title != "null" && json_media.artist != "null" ? true : false }
(box :class "album-image"
:width 98
:height 87
:style "background-image: image(url('${json_media_data.artUrl}'));"
:style "background-image: image(url('${json_media.artUrl}'));"
:valign "center")
(box :orientation "vertical"
:space-evenly false
:class "right"
:halign "fill"
:hexpand true
(box :class "media-info"
:space-evenly false
@@ -26,39 +22,36 @@
:orientation "vertical"
(label :class "title"
:text "${json_media_data.title}"
:text "${json_media.title}"
:xalign 0
:wrap false
:hexpand true
:show-truncated true)
(label :class "artist"
:text "${json_media_data.artist}"
:text "${json_media.artist}"
:xalign 0
:wrap false
:hexpand true
:show-truncated true)
)
(box :class "media-controls button-row"
(box :class "controls button-row"
:orientation "horizontal"
:space-evenly false
:halign "start"
(button :class "shuffle"
:onclick "playerctl --player=${json_media_data.player} shuffle Toggle"
:onclick "playerctl --player=${json_media.player} shuffle Toggle"
"󰒝")
(button :class "previous"
:onclick "playerctl --player=${json_media_data.player} previous"
:onclick "playerctl --player=${json_media.player} previous"
"󰒮")
(button :class "play-pause"
:onclick "playerctl --player=${json_media_data.player} play-pause"
{ json_media_data.status == "playing" ? "󰏤" : "󰐊" })
:onclick "playerctl --player=${json_media.player} play-pause"
{ json_media.status == "playing" ? "󰏤" : "󰐊" })
(button :class "next"
:onclick "playerctl --player=${json_media_data.player} next"
:onclick "playerctl --player=${json_media.player} next"
"󰒭")
(button :class "repeat"
:onclick "" ; todo
"󰑖")
)
)
)
+11 -12
View File
@@ -1,4 +1,4 @@
(defwidget notification [ ?application_name ?icon_path summary body ?image ?onclick ]
(defwidget notification [ ?application_name ?icon summary body ?image ?onclickclose ?onclick ]
(eventbox :onclick "${onclick}"
(box :class "notification"
:orientation "vertical"
@@ -14,20 +14,19 @@
:halign "start"
:hexpand true
:vexpand false
(image :class "app-icon"
:path "${icon_path}"
:visible { icon_path != "" ? true : false }
:image-width 32
:image-height 32)
:visible { icon != "" ? true : false }
:icon "${icon}"
:icon-size "menu")
(label :class "app-name"
:text "${application_name}")
)
(box :space-evenly false
(button :class "close"
:onclick "${onclick}"
"󰅖")
)
(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
"󰅖")
)
(box :class "content"
@@ -35,7 +34,7 @@
(box :class "image"
:width 96
:height 96
:visible { image != "" ? true : false }
:visible { image != "" && image != "\{\}" ? true : false }
:style { image != "" ? "background-image: image(url('${image}'));" : "" }
)
+46 -43
View File
@@ -1,52 +1,55 @@
(include "widgets/control-center/notification.yuck")
(defwidget notifications []
(box :class "cc-notifications"
:space-evenly false
:orientation "vertical"
(scroll :class "vertical-scroll"
:hscroll false
:vscroll true
:height 400 ; Adjust according to control center size
:vexpand true
(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;"
(box :class "notifications"
:orientation "vertical"
:space-evenly false
(box :class "notifications"
:orientation "vertical"
:space-evenly false
(for notification in json_notification_history
(notification :application_name "${notification.applicationName}"
:image "${notification.image}"
:summary "${notification.summary}"
:body "${notification.body}")
)
(box :class "empty-notifications"
:visible { json_notification_history[0] == "null" ? true : false }
:style "margin-top: 150px;"
: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;")
)
)
(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}"
;:onclickclose "dunstctl history-rm ${notification.id.data}" ; needs fix
:onclick "makoctl invoke -n ${notification.id.data}"
:icon "${notification.app-name.data}"
)
)
(box :class "bottom button-row"
:halign "end"
(box :class "empty-notifications"
:visible { arraylength(json_notifications) == 0 ? true : false }
:style "margin-top: 50px;"
:space-evenly false
(button :class "do-not-disturb"
"󰒲")
(button :class "clear-all"
:onclick "dunstctl history-clear"
"Clear all")
: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"
:space-evenly false
(button :class "clear-all"
:onclick { arraylength(json_notifications) > 0 ? "pkill mako; hyprctl dispatch exec mako" : "" }
"󰎟 Clear")
)
)
)
@@ -1,73 +0,0 @@
(defwidget toggle-grid []
(box :class "toggle-grid"
:orientation "vertical"
(box :orientation "horizontal"
:class "row"
(grid-toggle :class "network"
:icon "󰈀"
:header "Network"
:active true ; This sets if toggle is enabled or not, put condition check here
:body "Connected" ; Put state here (e.g.: enabled, disabled)
:visible true
:onclick "notify-send 'Network' 'toggle network with nmcli!'"
)
(grid-toggle :class "bluetooth"
:icon "󰂯"
:header "Bluetooth"
:active false
:body "Connected"
:visible true
:onclick "notify-send 'Network' 'toggle network with nmcli!'"
)
(grid-toggle :class "dnd"
:icon "󰍶"
:header "Do Not Disturb"
:active false
:body "Disabled"
:visible true
:onclick "notify-send 'Network' 'toggle network with nmcli!'"
)
)
(box :orientation "horizontal"
:class "row"
:space-evenly false
(grid-toggle :class "airplane"
:icon "󰀝"
:header "Airplane Mode"
:active false
:body "Disabled"
:visible true
:onclick "notify-send 'Network' 'toggle network with nmcli!'"
)
)
)
)
(defwidget grid-toggle [ class onclick active ?icon header body visible ]
(eventbox :visible "${visible}"
:onclick "${onclick}"
:class "grid-toggle ${class} ${ active == true ? 'active' : '' } button"
(box :class "toggle"
:space-evenly false
:orientation "horizontal"
:width 142
:height 52
(label :class "icon"
:visible { icon != "" ? true : false }
:valign "center"
:text "${icon}")
(box :orientation "vertical"
:space-evenly false
(label :class "header"
:text "${header}"
:xalign 0)
(label :class "body"
:text "${body}"
:xalign 0)
)
)
)
)
+60
View File
@@ -0,0 +1,60 @@
(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)
)
(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"
(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)
)
)
)
@@ -1,17 +1,11 @@
(defpoll hostname :initial "GNU/Linux"
:interval "24h"
`cat /etc/hostname`)
(defpoll uptime_info :interval "50s"
`uptime -p | sed -e 's/^up //'`)
(defwidget quickactions []
(box :class "quickactions"
(defwidget top-bar []
(box :class "top-bar"
:orientation "horizontal"
(box :class "left"
:orientation "vertical"
:halign "start"
:space-evenly false
(label :xalign 0
:text " ${hostname}"
@@ -31,10 +25,10 @@
:onclick "hyprctl dispatch exec hyprlock"
"󰌾")
(button :class "color-picker"
:onclick "sh $HOME/.config/eww/scripts/color-picker.sh"
:onclick "hyprctl dispatch exec 'sh $HOME/.config/eww/scripts/color-picker.sh'"
"󰴱")
(button :class "powermenu"
:onclick "eww close-all; eww open powermenu"
:onclick "sh scripts/eww-window.sh close bar && sh scripts/eww-window.sh open powermenu"
"󰗽")
)
)