✨ eww: add new features and fix issues
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
(defwidget output-slider []
|
||||
(box :class "output-slider"
|
||||
:space-evenly true
|
||||
|
||||
(overlay
|
||||
(scale :min 0
|
||||
:max 100
|
||||
:value "${volume_json.output}"
|
||||
:orientation "horizontal"
|
||||
:draw-value false
|
||||
:flipped false
|
||||
:onchange "wpctl set-volume @DEFAULT_AUDIO_SINK@ $(awk -v n={} 'BEGIN { print (n / 100) }')")
|
||||
|
||||
(label :text ""
|
||||
:xalign 0)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1,19 @@
|
||||
(defwidget source-slider []
|
||||
(box :class "source-slider"
|
||||
:space-evenly true
|
||||
|
||||
(overlay
|
||||
(scale :min 0
|
||||
:max 100
|
||||
:value "${volume_json.source}"
|
||||
:orientation "horizontal"
|
||||
:draw-value false
|
||||
:flipped false
|
||||
:onchange "wpctl set-volume @DEFAULT_AUDIO_SOURCE@ $(awk -v n={} 'BEGIN { print (n / 100) }')"
|
||||
:class "output-volume-slider")
|
||||
|
||||
(label :text ""
|
||||
:xalign 0)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -1,10 +1,15 @@
|
||||
|
||||
;(deflisten volume_out :initial '{ "volume": "100%" }'
|
||||
;`sh -c "source './scripts/volume.sh'; get_json_loop"`)
|
||||
(deflisten json_audio :initial `{ "output": 35, "source": 80 }`
|
||||
`sh ./scripts/get-volume-watch.sh`)
|
||||
|
||||
(defwidget audio []
|
||||
(eventbox
|
||||
:onscroll `[[ {} == "up" ]]; sh -c "source './scripts/volume.sh'; increase_vol" || sh -c "source './scripts/volume.sh'; decrease_vol"`
|
||||
(button " ")
|
||||
(eventbox :onclick "eww open --toggle audio-popup"
|
||||
:class "audio-eventbox"
|
||||
(box :class "audio"
|
||||
(eventbox :onscroll `[ {} == "up" ] && wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+ || wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-`
|
||||
(label :text "${ json_audio.output != 0 ? '' : '' } ${json_audio.output}%"))
|
||||
(eventbox :onscroll `[ {} == "up" ] && wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 5%+ || wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 5%-`
|
||||
(label :text "${ json_audio.source != 0 ? '' : '' } ${json_audio.source}%"))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
(defwidget battery [ ?device ]
|
||||
(box :class "battery"
|
||||
:visible { EWW_BATTERY != "" ? true : false }
|
||||
(label :text " ${EWW_BATTERY}%")
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
|
||||
(defwidget control-center-toggle []
|
||||
(box :class "control-center-toggle"
|
||||
(button :onclick "eww open --toggle control-center"
|
||||
" ")
|
||||
)
|
||||
)
|
||||
+33
-25
@@ -1,40 +1,48 @@
|
||||
|
||||
(defvar media_reveal_controls false)
|
||||
|
||||
(deflisten media :initial "{}"
|
||||
(deflisten json_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" ?
|
||||
:visible { json_media.title == "null" && json_media.artist == "null" ?
|
||||
false
|
||||
:
|
||||
"${ active_window.class =~ media.player || active_window.title =~ media.title ? false : true }"
|
||||
"${ active_window.class =~ json_media.player || active_window.title =~ json_media.title ? false : true }"
|
||||
}
|
||||
(box :class "mediaplayer ${ media_reveal_controls ? 'revealed' : '' }"
|
||||
:space-evenly false
|
||||
|
||||
(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}"
|
||||
"")
|
||||
)
|
||||
)
|
||||
(box :class "media"
|
||||
:space-evenly false
|
||||
(label :class "player"
|
||||
:text { json_media.player == "spotify" ? " " : " " })
|
||||
(label :class "media-title"
|
||||
:text "${json_media.title}"
|
||||
:limit-width 40)
|
||||
(box :class "separator")
|
||||
(label :class "media-artist"
|
||||
:text "${json_media.artist}"
|
||||
:limit-width 25)
|
||||
)
|
||||
(revealer :class "media-controls-revealer"
|
||||
:reveal { media_reveal_controls ? true : false }
|
||||
:transition "slideright"
|
||||
:duration "180ms"
|
||||
(box :class "media-controls"
|
||||
(button :class "previous"
|
||||
:onclick "playerctl previous --player=${json_media.player}"
|
||||
"")
|
||||
(button :class "toggle play-pause"
|
||||
:onclick "playerctl play-pause --player=${json_media.player}"
|
||||
{ json_media.status == "playing" ? "" : "" })
|
||||
(button :class "next"
|
||||
:onclick "playerctl next --player=${json_media.player}"
|
||||
"")
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
(defpoll connection_status :interval "2s"
|
||||
(defpoll connection_status :interval "5s"
|
||||
`nmcli n c`)
|
||||
|
||||
(defwidget network []
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
(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 ? " " : " " }' })
|
||||
)
|
||||
)
|
||||
@@ -3,17 +3,25 @@
|
||||
`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" }
|
||||
(box :class "window"
|
||||
:visible { active_window.class == "null" ? false : true }
|
||||
:vexpand false
|
||||
:space-evenly false
|
||||
:orientation "horizontal"
|
||||
|
||||
(image :class "icon"
|
||||
:icon "${active_window.initialClass}"
|
||||
:icon-size "toolbar")
|
||||
|
||||
(box :class "info"
|
||||
:orientation { active_window.title == "" ? "horizontal" : "vertical" }
|
||||
:space-evenly false
|
||||
(label :class "window-class"
|
||||
:text "${active_window.class}")
|
||||
(label :class "window-title"
|
||||
:text "${active_window.title}"
|
||||
:visible { active_window.title != "" ? true : false })
|
||||
:visible { active_window.title != "" ? true : false }
|
||||
:limit-width 45)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
`sh ./scripts/active-workspace.sh`)
|
||||
|
||||
(defwidget workspaces []
|
||||
(eventbox :onscroll "[[ {} == up ]] && hyprctl dispatch workspace e+1 || hyprctl dispatch workspace e-1"
|
||||
(eventbox :onscroll "[[ {} == up ]] && hyprctl dispatch workspace e+1 >> /dev/null || hyprctl dispatch workspace e-1 >> /dev/null"
|
||||
(box :class "workspaces"
|
||||
:space-evenly false
|
||||
(for workspace in json_workspaces
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
|
||||
(deflisten json_media_data :initial "{}"
|
||||
`python ./scripts/mediaplayer.py`)
|
||||
|
||||
(defwidget mediaplayer [ 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 }
|
||||
|
||||
(box :class "album-image"
|
||||
:width 98
|
||||
:height 87
|
||||
:style "background-image: image(url('${json_media_data.artUrl}'));"
|
||||
:valign "center")
|
||||
|
||||
(box :orientation "vertical"
|
||||
:space-evenly false
|
||||
:class "right"
|
||||
:halign "fill"
|
||||
|
||||
(box :class "media-info"
|
||||
:space-evenly false
|
||||
:halign "fill"
|
||||
:orientation "vertical"
|
||||
|
||||
(label :class "title"
|
||||
:text "${json_media_data.title}"
|
||||
:xalign 0
|
||||
:wrap false
|
||||
:hexpand true
|
||||
:show-truncated true)
|
||||
(label :class "artist"
|
||||
:text "${json_media_data.artist}"
|
||||
:xalign 0
|
||||
:wrap false
|
||||
:hexpand true
|
||||
:show-truncated true)
|
||||
)
|
||||
|
||||
(box :class "media-controls button-row"
|
||||
:orientation "horizontal"
|
||||
:space-evenly false
|
||||
:halign "start"
|
||||
|
||||
(button :class "shuffle"
|
||||
:onclick "playerctl --player=${json_media_data.player} shuffle Toggle"
|
||||
"")
|
||||
(button :class "previous"
|
||||
:onclick "playerctl --player=${json_media_data.player} previous"
|
||||
"")
|
||||
(button :class "play-pause"
|
||||
:onclick "playerctl --player=${json_media_data.player} play-pause"
|
||||
{ json_media_data.status == "playing" ? "" : "" })
|
||||
(button :class "next"
|
||||
:onclick "playerctl --player=${json_media_data.player} next"
|
||||
"")
|
||||
(button :class "repeat"
|
||||
:onclick "" ; todo
|
||||
"")
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1,61 @@
|
||||
(defwidget notification [ ?application_name ?icon_path summary body ?image ?onclick ]
|
||||
(eventbox :onclick "${onclick}"
|
||||
(box :class "notification"
|
||||
:orientation "vertical"
|
||||
:height 96
|
||||
:space-evenly false
|
||||
|
||||
(box :class "top"
|
||||
:orientation "horizontal"
|
||||
:space-evenly false
|
||||
|
||||
(box :class "app-info"
|
||||
:space-evenly false
|
||||
:halign "start"
|
||||
:hexpand true
|
||||
:vexpand false
|
||||
|
||||
(image :class "app-icon"
|
||||
:path "${icon_path}"
|
||||
:visible { icon_path != "" ? true : false }
|
||||
:image-width 32
|
||||
:image-height 32)
|
||||
(label :class "app-name"
|
||||
:text "${application_name}")
|
||||
)
|
||||
(box :space-evenly false
|
||||
(button :class "close"
|
||||
:onclick "${onclick}"
|
||||
"")
|
||||
)
|
||||
)
|
||||
|
||||
(box :class "content"
|
||||
:space-evenly false
|
||||
(box :class "image"
|
||||
:width 96
|
||||
:height 96
|
||||
:visible { image != "" ? true : false }
|
||||
:style { image != "" ? "background-image: image(url('${image}'));" : "" }
|
||||
)
|
||||
|
||||
(box :class "text"
|
||||
:orientation "vertical"
|
||||
:space-evenly false
|
||||
|
||||
(label :class "summary"
|
||||
:text "${summary}"
|
||||
:xalign 0
|
||||
:show-truncated true
|
||||
:halign "start")
|
||||
|
||||
(label :class "body"
|
||||
:markup "${body}"
|
||||
:xalign 0
|
||||
:show-truncated false
|
||||
:wrap true)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -0,0 +1,55 @@
|
||||
(include "widgets/control-center/notification.yuck")
|
||||
|
||||
(deflisten json_notification_history :initial "{[]}"
|
||||
`python ./scripts/notification-watcher.py`)
|
||||
|
||||
(defwidget notifications []
|
||||
(box :class "cc-notifications"
|
||||
:space-evenly false
|
||||
:orientation "vertical"
|
||||
|
||||
(scroll :class "vertical-scroll"
|
||||
:hscroll false
|
||||
:vscroll true
|
||||
:height 400 ; Adjust according to your screen size
|
||||
:vexpand true
|
||||
|
||||
(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;")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(box :class "bottom button-row"
|
||||
:halign "end"
|
||||
:space-evenly false
|
||||
(button :class "do-not-disturb"
|
||||
"")
|
||||
(button :class "clear-all"
|
||||
:onclick "dunstctl history-clear"
|
||||
"Clear all ")
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -1,10 +1,37 @@
|
||||
(defpoll uptime_info :interval "25s"
|
||||
`echo "$(cat /etc/hostname), Uptime: $( uptime -p | sed -e 's/^up //')"`)
|
||||
(deflisten hostname :initial "GNU/Linux"
|
||||
`cat /etc/hostname`)
|
||||
|
||||
(defpoll uptime_info :interval "50s"
|
||||
`uptime -p | sed -e 's/^up //'`)
|
||||
|
||||
(defwidget quickactions []
|
||||
(box :orientation "horizontal"
|
||||
(label :xalign 0
|
||||
:text "${uptime_info}")
|
||||
(box :class "quickactions"
|
||||
:orientation "horizontal"
|
||||
|
||||
(box :class "left"
|
||||
:orientation "vertical"
|
||||
:halign "start"
|
||||
|
||||
(label :xalign 0
|
||||
:text " ${hostname}"
|
||||
:class "hostname")
|
||||
|
||||
(label :xalign 0
|
||||
:text " ${uptime_info}"
|
||||
:class "uptime")
|
||||
)
|
||||
|
||||
(box :orientation "horizontal"
|
||||
:class "button-row"
|
||||
:space-evenly false
|
||||
:halign "end"
|
||||
|
||||
(button :class "lock"
|
||||
:onclick "hyprctl dispatch exec hyprlock"
|
||||
"")
|
||||
(button :class "powermenu"
|
||||
:onclick "eww close-all; eww open powermenu"
|
||||
"")
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
(defwidget toggle-grid []
|
||||
(box :class "toggle-grid"
|
||||
(grid-toggle :class "network"
|
||||
:icon ""
|
||||
:header "Network"
|
||||
:active true ; This sets if toggle is enabled or not, put condition check here
|
||||
:body "Connected" ; Generally put state here
|
||||
:visible true
|
||||
:max-width 128
|
||||
:max-height 48
|
||||
:onclick "notify-send 'Network' 'toggle network with nmcli!'"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defwidget grid-toggle [ class onclick active ?icon header body visible max-width max-height ]
|
||||
(eventbox :visible "${visible}"
|
||||
:onclick "${onclick}"
|
||||
:class "${class} ${ active ? 'active' : '' }"
|
||||
(box :class "toggle"
|
||||
:space-evenly false
|
||||
:orientation "horizontal"
|
||||
|
||||
(label :class "icon"
|
||||
:visible { icon != "" ? true : false }
|
||||
:valign "center"
|
||||
"${icon}")
|
||||
|
||||
(box :orientation "vertical"
|
||||
(label :class "header"
|
||||
"${header}")
|
||||
(label :class "body"
|
||||
"${body}")
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
Reference in New Issue
Block a user