From e47fea8adcfdbe8a3c38204d448918ad2868d273 Mon Sep 17 00:00:00 2001 From: Ahurac Date: Mon, 4 Nov 2024 15:49:10 +0100 Subject: [PATCH] feat: base eww config --- ahrc-laptop/eww/eww.scss | 21 ++++++++ ahrc-laptop/eww/eww.yuck | 67 ++++++++++++++++++++++---- ahrc-laptop/eww/listen/niri/workspaces | 4 ++ 3 files changed, 83 insertions(+), 9 deletions(-) create mode 100644 ahrc-laptop/eww/eww.scss create mode 100755 ahrc-laptop/eww/listen/niri/workspaces diff --git a/ahrc-laptop/eww/eww.scss b/ahrc-laptop/eww/eww.scss new file mode 100644 index 0000000..0fb8e86 --- /dev/null +++ b/ahrc-laptop/eww/eww.scss @@ -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; +} diff --git a/ahrc-laptop/eww/eww.yuck b/ahrc-laptop/eww/eww.yuck index 75c2295..7d49bc7 100644 --- a/ahrc-laptop/eww/eww.yuck +++ b/ahrc-laptop/eww/eww.yuck @@ -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 :geometry (geometry - :x "0%" - :y "20px" - :width "90%" + :x "0" + :y "0" + :width "100%" :height "30px" - :anchor "top center" + :anchor "bottom center" ) :stacking "fg" - :reserve (struts :distance "40px" :side "top") - :windowtype "dock" - :wm-ignore false - "ni" + :exclusive true + + (centerbox + (box + :class "left" + :halign "start" + :space-evenly false + + (workspaces) + ) + + (box + :class "middle" + + (time) + ) + + (box + :class "right" + ) + ) ) diff --git a/ahrc-laptop/eww/listen/niri/workspaces b/ahrc-laptop/eww/listen/niri/workspaces new file mode 100755 index 0000000..2070a28 --- /dev/null +++ b/ahrc-laptop/eww/listen/niri/workspaces @@ -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