feat(eww): a lot of stuff fixed, prettier active window and media widgets

This commit is contained in:
retrozinndev
2024-12-02 15:26:21 -03:00
parent 9dbfd0cc4a
commit 138e13bded
22 changed files with 210 additions and 73 deletions
+10
View File
@@ -0,0 +1,10 @@
;(deflisten volume_out :initial '{ "volume": "100%" }'
;`sh -c "source './scripts/volume.sh'; get_json_loop"`)
(defwidget audio []
(eventbox
:onscroll `[[ {} == "up" ]]; sh -c "source './scripts/volume.sh'; increase_vol" || sh -c "source './scripts/volume.sh'; decrease_vol"`
(button "󰕾 ")
)
)
View File
+10
View File
@@ -0,0 +1,10 @@
(defpoll datetime :interval "10s"
`date +"%A %d, %H:%M"`)
(defwidget clock []
(box :class "clock"
(button :onclick "eww open calendar-window --toggle"
"${datetime}")
)
)
+5
View File
@@ -0,0 +1,5 @@
(defwidget logo []
(button :class "distro-logo"
:onclick "hyprctl dispatch exec anyrun"
" ")
)
+40
View File
@@ -0,0 +1,40 @@
(defvar media_reveal_controls false)
(deflisten media :initial "{}"
`python3 ./scripts/mediaplayer.py`)
(defwidget media []
(eventbox :onhover "eww update media_reveal_controls=true"
:onhoverlost "eww update media_reveal_controls=false"
(box :class "mediaplayer ${ media_reveal_controls ? 'revealed' : '' }"
:space-evenly false
:visible { media.title == "null" && media.artist == "null" ?
false
:
"${ active_window.class =~ media.player || active_window.title =~ media.title ? false : true }"
}
(label :class "media-title"
:text "${media.title}")
(label :class "media-artist"
:text "${media.artist}")
(revealer :class "media-controls-revealer"
:reveal { media_reveal_controls ? true : false }
:transition "slideright"
:duration "180ms"
(box
(button :class "previous"
:onclick "playerctl previous --player=${media.player}"
"󰒮")
(button :class "toggle play-pause"
:onclick "playerctl play-pause --player=${media.player}"
{ media.status == "playing" ? "󰏤" : "󰐊" })
(button :class "next"
:onclick "playerctl next --player=${media.player}"
"󰒭")
)
)
)
)
)
+9
View File
@@ -0,0 +1,9 @@
(defpoll connection_status :interval "2s"
`nmcli n c`)
(defwidget network []
(box
(button :class "network"
{ connection_status == "full" || connection_status == "partial" ? " " : "󰤭 " })
)
)
+10
View File
@@ -0,0 +1,10 @@
(deflisten json_notifications :initial "{ \"text\": 0, \"class\": [\"notification\"] }"
`swaync-client -swb`)
(defwidget notifications []
(box :class "notifications"
(button :onclick "swaync-client -t"
:class { json_notifications.class =~ "cc-open" ? 'open' : '' }
{ json_notifications.alt == "dnd-notification" ? " " : '${ json_notifications.text == 0 ? " " : " " }' })
)
)
+19
View File
@@ -0,0 +1,19 @@
(deflisten active_window :initial `{ "title": "null", "class": "null" }`
`sh ./scripts/active-window.sh`)
(defwidget window []
(eventbox
(box :class "window"
:visible { active_window.class == "null" ? false : true }
:vexpand false
:space-evenly false
:orientation { active_window.title == "" ? "horizontal" : "vertical" }
(label :class "window-class"
:text "${active_window.class}")
(label :class "window-title"
:text "${active_window.title}"
:visible { active_window.title != "" ? true : false })
)
)
)
+19
View File
@@ -0,0 +1,19 @@
(deflisten json_workspaces :initial '[{"id": "1"},{"id": "2"}]'
`sh ./scripts/workspaces.sh`)
(deflisten json_active_workspace :initial '{ "id": 1 }'
`sh ./scripts/active-workspace.sh`)
(defwidget workspaces []
(eventbox :onscroll "[[ {} == up ]] && hyprctl dispatch workspace e+1 || hyprctl dispatch workspace e-1"
(box :class "workspaces"
:space-evenly false
(for workspace in json_workspaces
(button :onclick "hyprctl dispatch workspace ${workspace.id}"
:class "${ json_active_workspace.id == workspace.id ? "active" : "default" }"
"")
)
)
)
)