feat: base eww config

This commit is contained in:
Ahurac 2024-11-04 15:49:10 +01:00
parent a7da574e28
commit e47fea8adc
3 changed files with 83 additions and 9 deletions

21
ahrc-laptop/eww/eww.scss Normal file
View file

@ -0,0 +1,21 @@
window {
font-weight: bold;
background-color: rgba(0, 0, 0, 0);
}
.left {
padding-left: 5px;
}
.workspaces {
font-family: Hack Nerd Font;
}
.workspace-button:hover {
color: #c0ffc0;
transition: color 0.2s;
}
.workspace-active {
color: #20ff20;
}

View file

@ -1,15 +1,64 @@
(defwindow bar (deflisten workspaces
:initial "[]"
"./listen/niri/workspaces"
)
(defvar workspace-icon '{
"admin": "",
"everything": "",
"apps": ""
}')
(defwidget workspaces []
(box
:class "workspaces"
(for workspace in {workspaces}
(eventbox
:onclick "niri msg action focus-workspace ${workspace.idx}"
:width 25
:class "workspace-button${workspace.is_active ? " workspace-active" : ""}"
"${"${workspace-icon?.[workspace.name]}" ?: ""} "
)
)
)
)
(defwidget time []
"${formattime(EWW_TIME, "%Y-%m-%d")} ${formattime(EWW_TIME, "%H:%M:%S")}"
)
(defwindow dock
:monitor 0 :monitor 0
:geometry (geometry :geometry (geometry
:x "0%" :x "0"
:y "20px" :y "0"
:width "90%" :width "100%"
:height "30px" :height "30px"
:anchor "top center" :anchor "bottom center"
) )
:stacking "fg" :stacking "fg"
:reserve (struts :distance "40px" :side "top") :exclusive true
:windowtype "dock"
:wm-ignore false (centerbox
"ni" (box
:class "left"
:halign "start"
:space-evenly false
(workspaces)
)
(box
:class "middle"
(time)
)
(box
:class "right"
)
)
) )

View file

@ -0,0 +1,4 @@
#!/usr/bin/env sh
niri msg event-stream | grep --extended-regexp --line-buffered '^Workspace( focused|s changed): ' | while read -r _line; do
niri msg --json workspaces | jq --compact-output 'sort_by(.idx)'
done