2023-10-24 18:31:26 -07:00
|
|
|
(defwidget bar []
|
|
|
|
(centerbox :orientation "h"
|
2023-10-29 19:20:10 -07:00
|
|
|
(workspaces :current-idx current-workspace)
|
2023-10-24 18:31:26 -07:00
|
|
|
(music)
|
2023-10-26 18:26:39 -07:00
|
|
|
(info)))
|
2023-10-24 18:31:26 -07:00
|
|
|
|
2023-10-26 18:26:39 -07:00
|
|
|
(deflisten current-workspace :initial "1" "bash ./scripts/get-active-workspace")
|
2023-10-29 19:20:10 -07:00
|
|
|
(defwidget workspaces [current-idx]
|
2023-10-26 18:26:39 -07:00
|
|
|
(box
|
|
|
|
:halign "start"
|
|
|
|
:hexpand false
|
2023-10-29 19:20:10 -07:00
|
|
|
:class "bar-main"
|
2023-10-26 18:26:39 -07:00
|
|
|
:space-evenly true
|
|
|
|
:spacing "12"
|
|
|
|
:css "* {margin-left: 20px; margin-right: 20px;}"
|
|
|
|
(box
|
2023-10-29 19:20:10 -07:00
|
|
|
:class {current-idx == "1" ? "active-workspace" : "regular"}
|
|
|
|
(label :text ""))
|
2023-10-26 18:26:39 -07:00
|
|
|
(box
|
2023-10-29 19:20:10 -07:00
|
|
|
:class {current-idx == "2" ? "active-workspace" : "regular"}
|
|
|
|
(label :text ""))
|
2023-10-26 18:26:39 -07:00
|
|
|
(box
|
2023-10-29 19:20:10 -07:00
|
|
|
:class {current-idx == "3" ? "active-workspace" : "regular"}
|
|
|
|
(label :text ""))
|
2023-10-26 18:26:39 -07:00
|
|
|
(box
|
2023-10-29 19:20:10 -07:00
|
|
|
:class {current-idx == "4" ? "active-workspace" : "regular"}
|
|
|
|
(label :text ""))
|
2023-10-26 18:26:39 -07:00
|
|
|
(box
|
2023-10-29 19:20:10 -07:00
|
|
|
:class {current-idx == "5" ? "active-workspace" : "regular"}
|
|
|
|
(label :text ""))
|
2023-10-26 18:26:39 -07:00
|
|
|
(box
|
2023-10-29 19:20:10 -07:00
|
|
|
:class {current-idx == "6" ? "active-workspace" : "regular"}
|
|
|
|
(label :text ""))
|
2023-10-26 18:26:39 -07:00
|
|
|
(box
|
2023-10-29 19:20:10 -07:00
|
|
|
:class {current-idx == "7" ? "active-workspace" : "regular"}
|
|
|
|
(label :text ""))
|
2023-10-26 18:26:39 -07:00
|
|
|
(box
|
2023-10-29 19:20:10 -07:00
|
|
|
:class {current-idx == "8" ? "active-workspace" : "regular"}
|
|
|
|
(label :text ""))
|
2023-10-26 18:26:39 -07:00
|
|
|
(box
|
2023-10-29 19:20:10 -07:00
|
|
|
:class {current-idx == "9" ? "active-workspace" : "regular"}
|
|
|
|
(label :text ""))))
|
2023-10-24 18:31:26 -07:00
|
|
|
|
2023-10-26 18:26:39 -07:00
|
|
|
(defwidget info []
|
|
|
|
(box
|
|
|
|
:class "side-stuff"
|
|
|
|
:halign "end"
|
|
|
|
:space-evenly false
|
|
|
|
:spacing "25"
|
|
|
|
(box
|
|
|
|
:space-evenly false
|
|
|
|
:spacing "10"
|
|
|
|
(_volume :volume volume)
|
2023-10-29 18:27:21 -07:00
|
|
|
(_battery :status {EWW_BATTERY == "" ? "" : EWW_BATTERY.BAT0.status} :battery {EWW_BATTERY == "" ? "" : EWW_BATTERY.BAT0.capacity}))
|
2023-10-26 18:26:39 -07:00
|
|
|
(_network :strength net-strength :name net-name)
|
|
|
|
(sep)
|
|
|
|
(buttons)))
|
|
|
|
|
|
|
|
(defvar eww "eww -c $HOME/.config/eww")
|
|
|
|
|
|
|
|
(defwidget revealer-on-hover [toggle togglename ?transition ?duration]
|
|
|
|
(eventbox
|
|
|
|
:onhover "${eww} update ${togglename}=true"
|
|
|
|
:onhoverlost "${eww} update ${togglename}=false"
|
|
|
|
(box
|
|
|
|
:space-evenly false
|
|
|
|
(children :nth 0)
|
|
|
|
(revealer
|
|
|
|
:reveal toggle
|
|
|
|
:transition {transition ?: "slideright"}
|
|
|
|
:duration {duration ?: "300ms"}
|
|
|
|
(children :nth 1)))))
|
|
|
|
|
|
|
|
(defvar volume-visible false)
|
|
|
|
(defwidget _volume [volume]
|
|
|
|
(box
|
|
|
|
:hexpand false
|
|
|
|
:class {volume > 100 ? "alert" : "regular"}
|
|
|
|
(revealer-on-hover
|
|
|
|
:toggle volume-visible
|
|
|
|
:togglename "volume-visible"
|
|
|
|
(label :text {volume <= 0 ? " " :
|
|
|
|
volume < 33 ? " " :
|
|
|
|
volume < 66 ? " " :
|
|
|
|
volume < 99 ? " " : " "})
|
|
|
|
(label :text "${volume}%"))))
|
2023-10-24 18:31:26 -07:00
|
|
|
|
|
|
|
|
2023-10-26 18:26:39 -07:00
|
|
|
(defvar battery-visible false)
|
|
|
|
(defwidget _battery [status battery]
|
|
|
|
(box
|
|
|
|
:hexpand false
|
2023-10-29 18:27:21 -07:00
|
|
|
:class {status == "" ? "regular" : battery < 20 ? "alert" : "regular"}
|
2023-10-26 18:26:39 -07:00
|
|
|
(revealer-on-hover
|
|
|
|
:toggle battery-visible
|
|
|
|
:togglename "battery-visible"
|
2023-10-29 18:27:21 -07:00
|
|
|
(label :text {status == 'Charging' || status == "" ? "" :
|
2023-10-26 18:26:39 -07:00
|
|
|
battery < 20 ? "" :
|
|
|
|
battery < 40 ? "" :
|
|
|
|
battery < 60 ? "" :
|
|
|
|
battery < 80 ? "" : ""})
|
|
|
|
(label :text "${battery}%"))))
|
2023-10-24 18:31:26 -07:00
|
|
|
|
2023-10-26 18:26:39 -07:00
|
|
|
(defvar network-visible false)
|
|
|
|
(defwidget _network [strength name]
|
|
|
|
(box
|
|
|
|
:hexpand false
|
|
|
|
:vexpand true
|
|
|
|
:class "regular"
|
|
|
|
(revealer-on-hover
|
|
|
|
:toggle network-visible
|
|
|
|
:togglename "network-visible"
|
|
|
|
:ransition "slidedown"
|
|
|
|
(label :text {strength == "" ? " " :
|
|
|
|
strength < 26 ? " " :
|
|
|
|
strength < 51 ? " " :
|
|
|
|
strength < 76 ? " " : " "})
|
|
|
|
(label :text "${name} (${strength})"))))
|
|
|
|
|
|
|
|
(defwidget buttons []
|
|
|
|
(box
|
|
|
|
:halign "end"
|
|
|
|
:hexpand false
|
|
|
|
:space-evenly true
|
|
|
|
:spacing "15"
|
|
|
|
(box (button :onclick `hyprctl dispatch exit` " "))
|
|
|
|
(box (button :onclick `reboot` " "))
|
|
|
|
(box (button :onclick `shutdown now` " "))))
|
|
|
|
|
|
|
|
(defwidget sep [] (box :hexpand false (label :class "sep" :text "|")))
|
|
|
|
|
|
|
|
(defpoll net-strength :interval "5s" :initial `N/A`
|
|
|
|
`nmcli -t -f SIGNAL,ACTIVE device wifi | awk -F':' '{if($2=="yes")print$1}'`)
|
|
|
|
(defpoll net-name :interval "60s" :initial "N/A" "nmcli -t -f NAME c show --active | head -n 1")
|
2023-10-24 18:31:26 -07:00
|
|
|
|
|
|
|
(deflisten music :initial ""
|
|
|
|
"playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true")
|
|
|
|
|
2023-10-26 18:26:39 -07:00
|
|
|
(defwidget music []
|
|
|
|
(box :class "music"
|
|
|
|
:orientation "h"
|
|
|
|
:space-evenly false
|
|
|
|
:halign "center"
|
|
|
|
{music != "" ? "🎵${music}" : ""}))
|
|
|
|
|
2023-10-24 18:31:26 -07:00
|
|
|
(defpoll volume :interval "1s"
|
2023-10-29 18:27:21 -07:00
|
|
|
"pw-volume status | jq '.percentage'")
|
2023-10-24 18:31:26 -07:00
|
|
|
|
|
|
|
(defpoll time :interval "10s"
|
|
|
|
"date '+%H:%M %b %d, %Y'")
|
|
|
|
|
|
|
|
(defwindow bar
|
2023-10-28 13:46:56 -07:00
|
|
|
:monitor 1
|
2023-10-26 18:26:39 -07:00
|
|
|
:exclusive true
|
2023-10-24 18:31:26 -07:00
|
|
|
:windowtype "dock"
|
|
|
|
:geometry (geometry :x "0%"
|
|
|
|
:y "0%"
|
|
|
|
:width "90%"
|
|
|
|
:height "10px"
|
|
|
|
:anchor "top center")
|
|
|
|
:reserve (struts :side "top" :distance "4%")
|
|
|
|
(bar))
|