270 lines
6.9 KiB
Text
270 lines
6.9 KiB
Text
(defwidget bar []
|
|
(centerbox :orientation "h"
|
|
(leftgroup)
|
|
(music)
|
|
(rightgroup)))
|
|
|
|
(defwidget leftgroup []
|
|
(box :class "leftgroup" :orientation "h" :space-evenly false :halign "start"
|
|
(workspaces :array workspacesArray)
|
|
(windowtitle)))
|
|
|
|
(defwidget rightgroup []
|
|
(box :class "rightgroup" :orientation "h" :space-evenly false :halign "end"
|
|
(idleinhibit)
|
|
(volume)
|
|
(network)
|
|
(vpn)
|
|
(bluetooth)
|
|
(sysdisk)
|
|
(sysmem)
|
|
(clock)
|
|
(tray)))
|
|
|
|
(deflisten workspacesArray :initial "${[1]}"
|
|
`~/.config/eww/scripts/getWorkspaces.sh`)
|
|
|
|
(defwidget workspaces [array]
|
|
(box :class "workspaces"
|
|
:orientation "h"
|
|
:space-evenly true
|
|
:halign "start"
|
|
|
|
(for entry in array
|
|
(button :onclick `swaymsg workspace "${entry.name}"`
|
|
:class {entry.focused ? "focused" : ""}
|
|
`${replace(entry.name,".*:","")}`))))
|
|
|
|
(deflisten active_window_name :initial false
|
|
:interval "1s"
|
|
"scripts/activewindow")
|
|
(defwidget windowtitle []
|
|
(box :class "active_window"
|
|
{active_window_name}))
|
|
|
|
(defwidget clock []
|
|
(button :onclick 'notify-send "test"'
|
|
{formattime(EWW_TIME,"%b %d, %Y | %H:%M")}))
|
|
|
|
(defwidget network []
|
|
(button :onclick 'nm-connection-editor'
|
|
"🖧"))
|
|
|
|
(defwidget bluetooth []
|
|
(button :onclick 'blueman-manager'
|
|
""))
|
|
|
|
(defpoll inhibit_active :initial false
|
|
:interval "1s"
|
|
"scripts/inhibit-status")
|
|
|
|
(defwidget idleinhibit []
|
|
(button :onclick {inhibit_active ? 'killall eww-idle-inhibit' : 'scripts/eww-idle-inhibit'}
|
|
:class {inhibit_active ? "active" : ""}
|
|
{inhibit_active ? "" : ""}))
|
|
|
|
|
|
(defwidget revealer-on-hover [revealvar revealvar-name ?class ?duration ?transition]
|
|
(box
|
|
:class "${class} revealer-on-hover"
|
|
:orientation "h"
|
|
:space-evently false
|
|
(eventbox
|
|
:onhover "${EWW_CMD} update ${revealvar-name}=true"
|
|
:onhoverlost "${EWW_CMD} update ${revealvar-name}=false"
|
|
(box
|
|
:space-evenly false
|
|
(children :nth 0)
|
|
(revealer
|
|
:reveal revealvar
|
|
:transition {transition ?: "slideright"}
|
|
:duration {duration ?: "500ms"}
|
|
(children :nth 1))))))
|
|
|
|
(defvar reveal_volume false)
|
|
(defwidget volume []
|
|
(revealer-on-hover
|
|
:revealvar reveal_volume
|
|
:revealvar-name "reveal_volume"
|
|
(button :onclick 'pavucontrol-qt --tab 3'
|
|
{(volume_level == 0) ? "" : ((volume_level > 50) ? "" : "")})
|
|
(volume_children)))
|
|
|
|
(defpoll volume_level :initial 0
|
|
:interval "1s"
|
|
"scripts/getvol")
|
|
(defwidget volume_children []
|
|
(box :class "reveal_children"
|
|
:orientation "h"
|
|
:space-evenly false
|
|
:halign "center"
|
|
(scale
|
|
:min 0
|
|
:max 100
|
|
:value {volume_level}
|
|
:orientation "h"
|
|
:onchange "wpctl set-volume @DEFAULT_AUDIO_SINK@ {}%;paplay 'volume.ogg'")))
|
|
|
|
(defvar reveal_tray false)
|
|
(defwidget tray []
|
|
(revealer-on-hover
|
|
:revealvar reveal_tray
|
|
:revealvar-name "reveal_tray"
|
|
{reveal_tray ? "" : ""}
|
|
(tray_children)))
|
|
|
|
|
|
(defwidget tray_children []
|
|
(box :class "tray_children"
|
|
:orientation "h"
|
|
:space-evenly false
|
|
:halign "center"
|
|
(systray
|
|
:orientation "h"
|
|
:space-evenly true
|
|
:spacing 10
|
|
:prepend-new true)))
|
|
|
|
(defpoll vpn_active :initial false
|
|
:interval "5s"
|
|
"scripts/vpn-status")
|
|
|
|
(defvar reveal_vpn false)
|
|
(defwidget vpn []
|
|
(revealer-on-hover
|
|
:revealvar reveal_vpn
|
|
:revealvar-name "reveal_vpn"
|
|
(button :onclick 'notify-send "test"'
|
|
:class {vpn_active ? "active" : ""}
|
|
{vpn_active ? "" : ""})
|
|
(vpn_children)))
|
|
|
|
(defpoll home_vpn_active :initial false
|
|
:interval "5s"
|
|
"scripts/vpn-status Home")
|
|
|
|
(defpoll proton_vpn_active :initial false
|
|
:interval "5s"
|
|
"scripts/vpn-status Proton")
|
|
|
|
(defwidget vpn_children []
|
|
(box :class "reveal_children"
|
|
:orientation "h"
|
|
:space-evenly false
|
|
:halign "center"
|
|
(button :onclick 'scripts/nmcli-vpn "HomeVPN"'
|
|
:class {home_vpn_active ? "active" : ""}
|
|
{home_vpn_active ? "" : ""})
|
|
(button :onclick 'scripts/nmcli-vpn "Proton SE-NL"'
|
|
:class {proton_vpn_active ? "active" : ""}
|
|
{proton_vpn_active ? "" : ""})))
|
|
|
|
(defvar reveal_sysmem false)
|
|
(defwidget sysmem []
|
|
(revealer-on-hover
|
|
:revealvar reveal_sysmem
|
|
:revealvar-name "reveal_sysmem"
|
|
(metric :label " "
|
|
:value {EWW_RAM.used_mem_perc}
|
|
:onchange "")
|
|
(sysmem_children)))
|
|
|
|
(defwidget sysmem_children []
|
|
(box :class "reveal_children"
|
|
:orientation "h"
|
|
:space-evenly false
|
|
:halign "center"
|
|
(metric :label " "
|
|
:value {round((EWW_RAM.total_mem - EWW_RAM.free_mem) / EWW_RAM.total_mem,2) * 100}
|
|
:onchange "")
|
|
(metric :label " "
|
|
:value {round((EWW_RAM.total_swap - EWW_RAM.free_swap) / EWW_RAM.total_swap,2) * 100}
|
|
:onchange "")))
|
|
|
|
(defvar reveal_sysdisk false)
|
|
(defwidget sysdisk []
|
|
(revealer-on-hover
|
|
:revealvar reveal_sysdisk
|
|
:revealvar-name "reveal_sysdisk"
|
|
(metric :label "/home "
|
|
:value {EWW_DISK["/home"].used_perc}
|
|
:onchange "")
|
|
(sysdisk_children)))
|
|
|
|
(defwidget sysdisk_children []
|
|
(box :class "reveal_children"
|
|
:orientation "h"
|
|
:space-evenly false
|
|
:halign "center"
|
|
(metric :label "/ "
|
|
:value {EWW_DISK["/"].used_perc}
|
|
:onchange "")
|
|
(metric :label "/boot "
|
|
:value {EWW_DISK["/boot"].used_perc}
|
|
:onchange "")))
|
|
|
|
(defwidget music []
|
|
(box :class "music"
|
|
:orientation "h"
|
|
:space-evenly false
|
|
:halign "center"
|
|
{music != "" ? "🎵${music}" : ""}))
|
|
|
|
(defwidget metric [label value onchange]
|
|
(box :orientation "h"
|
|
:class "metric"
|
|
:space-evenly false
|
|
(box :class "label" label)
|
|
(circular-progress
|
|
:active {onchange != ""}
|
|
:value value
|
|
:start-at 0
|
|
:thickness 10
|
|
:clockwise true
|
|
:onchange onchange)))
|
|
|
|
(deflisten music :initial ""
|
|
"playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true")
|
|
|
|
(defpoll volume :interval "1s"
|
|
"scripts/getvol")
|
|
|
|
(defpoll time :interval "10s"
|
|
"date '+%H:%M %b %d, %Y'")
|
|
|
|
(defwindow phl_278e1_bar
|
|
:monitor "PHL 278E1"
|
|
:windowtype "dock"
|
|
:exclusive true
|
|
:geometry (geometry :x "0%"
|
|
:y "0%"
|
|
:width "100%"
|
|
:height "30px"
|
|
:anchor "top center")
|
|
:reserve (struts :side "top" :distance "4%")
|
|
(bar))
|
|
|
|
(defwindow cr270cu_bar
|
|
:monitor "CR270CU"
|
|
:windowtype "dock"
|
|
:exclusive true
|
|
:geometry (geometry :x "0%"
|
|
:y "0%"
|
|
:width "100%"
|
|
:height "30px"
|
|
:anchor "top center")
|
|
:reserve (struts :side "top" :distance "4%")
|
|
(bar))
|
|
|
|
(defwindow lg_ultrawide_bar
|
|
:monitor "LG ULTRAWIDE"
|
|
:windowtype "dock"
|
|
:exclusive true
|
|
:geometry (geometry :x "0%"
|
|
:y "0%"
|
|
:width "100%"
|
|
:height "30px"
|
|
:anchor "top center")
|
|
:reserve (struts :side "top" :distance "4%")
|
|
(bar))
|
|
|