Files
illogical-impulse/early/.config/eww/modules/winstuff.yuck
T
2024-02-22 15:35:06 +07:00

163 lines
5.1 KiB
Plaintext
Executable File

(defwidget winstarticon []
(eventbox
:class "winbutton-only thewinbutton"
:onclick "scripts/toggle-winstart.sh &"
:onmiddleclick "playerctl play-pause"
:onrightclick "playerctl next || playerctl position `bc <<< \"100 * $(playerctl metadata mpris:length) / 1000000 / 100\"`"
(box
:class "winbutton-pad"
(box
:class "winstarticon-${rev_winstart} winbutton-${rev_winstart}"
)
)
)
)
(defwidget winactions []
(eventbox
:class "winbutton"
:onhover "${EWW_CMD} update winactions_hover=true &"
:onhoverlost "${EWW_CMD} update winactions_hover=false &"
:onclick "scripts/toggle-winactions.sh &"
:onscroll "echo $(echo {} | sed -e 's/down/-U 3/g' -e 's/up/-A 3/g' | xargs light) && scripts/brightness osd &"
(box
:class "winbutton-pad"
(box
:class "wintimedate winbutton-${winactions_hover || rev_winactions}"
:space-evenly false
(box
:orientation "h"
:space-evenly false
(image :class "winicon" :path "images/svg/dark/wifi${net.level}.svg")
(image :class "winicon" :path "images/svg/dark/vol${volume.audio == 1 ? round(volume.percent / 33, 0) : 'mute'}.svg")
(image :class "winicon" :path "images/svg/dark/bat${round(battery.percentage / 10, 0)}.svg")
)
)
)
)
)
(defwidget windate []
(eventbox
:class "winbutton"
:onhover "${EWW_CMD} update winnotif_hover=true &"
:onhoverlost "${EWW_CMD} update winnotif_hover=false &"
:onclick "scripts/toggle-winnotif.sh &"
:onscroll "echo $(echo {} | sed -e 's/down/-/g' -e 's/up/+/g' | xargs -I% wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.03%) && scripts/volume osd"
(box
:class "winbutton-pad"
(box
:class "wintimedate winbutton-${winnotif_hover || rev_winnotif}"
:space-evenly false
(box
:orientation "v"
:space-evenly false
(box
:space-evenly false
:halign "end"
:class "wintime"
(label :text "${time.hour}" :class "winbartext")
(label :text ":" :class "winbartext")
(label :text {time.minute} :class "winbartext")
)
(label
:class "winbartext"
:text "${time.date}/${time.year}"
)
)
(revealer
:reveal {arraylength(notifications) > 0}
:transition "slideleft"
:duration "200ms"
:class "dummy${notifications[0].id}"
(box
:halign "center"
:valign "center"
:class "winnotif-badge"
(label :class "winbartext" :text "${arraylength(notifications)}")
)
)
)
)
)
)
(defwidget wintaskbar []
(box
:orientation "h"
:space-evenly false
:onscroll "echo {} | sed -e \"s/up/-1/g\" -e \"s/down/+1/g\" | xargs hyprctl dispatch workspace"
(for app in tasks
(overlay
(eventbox
:class "winbutton-only"
:onclick "${app.count > 0 ? ('hyprctl dispatch workspace ' + app.workspace[0] + ' &') : (app.exec)}"
; :tooltip "${app.class}"
; :onclick "hyprctl dispatch workspace ${app.workspace[0]} && hyprctl dispatch focuswindow address:${app.address[0]} &"
(box
:class "winbutton-pad"
(box
:class "wintaskbaricon"
:style "
background-image: url('${app.icon}');
${app.class == awin.class ? 'background-color: rgba(108, 112, 134, 0.4); border: 1px solid rgba(108, 112, 134, 0.15); border-top: 1px solid rgba(108, 112, 134, 0.15);' : ''}
"
)
)
)
(box :class "wintaskbar-indicator-${app.class == awin.class ? 'true' : (app.count > 0 ? 'false' : 'none')}")
)
)
; Dummy keep alive
(revealer :transition "slideright" :reveal false (label :text {awin.class}))
)
)
(defwidget wintaskview-button []
(eventbox
:class "winbarbutton-h wintaskviewicon-interaction"
:onclick "scripts/toggle-wintaskview.sh &"
:onmiddleclick "playerctl play-pause"
:onrightclick "playerctl next || playerctl position `bc <<< \"100 * $(playerctl metadata mpris:length) / 1000000 / 100\"`"
(box
:class "winbutton-pad"
(box
:class "wintaskviewicon winbutton-${rev_wintaskview}"
:path "images/icons/wintaskview.png"
:image-width 26
:image-height 26
)
)
)
)
(defwidget wintray-button []
(eventbox
:class "winbarbutton-h${tray_is_open ? '-open' : ''}"
:onclick "pkill waybar || waybar -c ~/.config/eww/scripts/custom_configs/waybar-tray-config/config && sleep 0.9 && scripts/update-tray.sh &"
(box
:class "winbutton-pad"
(image
:style "padding: 0 5px;"
:path "images/svg/dark/uparrow.svg"
:image-width 20
:image-height 20
)
)
)
)
(defwidget winlang []
(eventbox
:class "winbarbutton-h${rev_winlang ? '-open' : ''}"
:onclick "scripts/toggle-winlang.sh"
(box
:class "winbutton-pad"
(label
:class "winbartext"
:width 40
:text "${lang_ibus.name_abbr}"
)
)
)
)