diff options
| -rw-r--r-- | modules/desktop/eww/activate-windows.py | 14 | ||||
| -rw-r--r-- | modules/desktop/eww/eww.mustache.scss | 12 | ||||
| -rw-r--r-- | modules/desktop/eww/yuck.nix | 9 |
3 files changed, 24 insertions, 11 deletions
diff --git a/modules/desktop/eww/activate-windows.py b/modules/desktop/eww/activate-windows.py index b0dba4a..5773d64 100644 --- a/modules/desktop/eww/activate-windows.py +++ b/modules/desktop/eww/activate-windows.py @@ -66,6 +66,17 @@ def emit_active_windows(): active_ws = next((w for w in workspaces if w.get("is_active")), None) active_id = active_ws["id"] if active_ws else None + on_workspace = [w for w in windows if w.get("workspace_id") == active_id] + + def sort_key(w): + pos = (w.get("layout") or {}).get("pos_in_scrolling_layout") + if pos is not None: + return (0, pos[0], pos[1]) + # floating / positionless windows: push to the end, stable by id + return (1, w["id"], 0) + + on_workspace.sort(key=sort_key) + result = [ { "id": w["id"], @@ -74,8 +85,7 @@ def emit_active_windows(): "is_focused": w.get("is_focused", False), "icon": resolve_icon_path(w.get("app_id") or ""), } - for w in windows - if w.get("workspace_id") == active_id + for w in on_workspace ] print(json.dumps(result), flush=True) diff --git a/modules/desktop/eww/eww.mustache.scss b/modules/desktop/eww/eww.mustache.scss index a24b71e..a546aaf 100644 --- a/modules/desktop/eww/eww.mustache.scss +++ b/modules/desktop/eww/eww.mustache.scss @@ -13,16 +13,14 @@ window#eww-bar { margin: 3px 5px; border: 1px solid #{{base07}}; color: #{{base07}}; - padding: 5px; } -.workspaces { - background: #{{base00}}; - padding: 0; - margin: 0; +.workspaces, .windows { + padding: 5px; + border-bottom: 1px solid #{{base07}}; } -.workspace-btn { +.workspace-button, .window-button { padding: 8px; color: #{{base07}}; font-size: 24px; @@ -34,6 +32,6 @@ window#eww-bar { outline: none; } -.workspace-btn.active { +.workspace-button.active, .window-button.focused { border-color: #{{base07}}; } diff --git a/modules/desktop/eww/yuck.nix b/modules/desktop/eww/yuck.nix index df688fe..b4757b8 100644 --- a/modules/desktop/eww/yuck.nix +++ b/modules/desktop/eww/yuck.nix @@ -79,14 +79,19 @@ (eventbox :onclick "niri msg action focus-workspace ''${ws.idx}" :cursor "pointer" :halign "fill" - (box :halign "fill" :class "workspace-btn ''${ws.is_active ? 'active' : '''}" + (box :halign "fill" :class "workspace-button ''${ws.is_active ? 'active' : '''}" (label :text "''${ws.idx}")))))) (defwidget windows-widget [] (box :orientation "v" :space-evenly false :spacing 4 :halign "center" :class "windows" (for w in active-windows - (image :class "win-icon" :path "''${w.icon != ''' ? w.icon : '${../../../assets/icons/obs.svg}'}" :image-width 20 :image-height 20)))) + (eventbox :onclick "niri msg action focus-window --id ''${w.id}" + :cursor "pointer" + :halign "fill" + :tooltip "''${w.app_id}: ''${w.title != ''' ? ' ' : '''}''${w.title}" + (box :halign "fill" :class "window-button ''${w.is_focused ? 'focused' : '''}" + (image :class "window-icon" :path "''${w.icon != ''' ? w.icon : '${../../../assets/icons/obs.svg}'}" :image-width 20 :image-height 20)))))) ''; }; } |
