diff --git a/Droidnix/README.html b/Droidnix/README.html index f97b9b702..924ea3ed4 100644 --- a/Droidnix/README.html +++ b/Droidnix/README.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Droidnix: A Dendritic NixOS + Home Manager Configuration NixOS Configuration Structure @@ -204,114 +204,114 @@

Table of Contents

-
-

Shortcuts

-
+
+

Shortcuts

+

Introduction The Assets Folder @@ -327,26 +327,26 @@

Introduction   intro

-
-

What is Droidnix

-
+
+

What is Droidnix

+

Droidnix is a modular, declarative NixOS + Home Manager configuration system. It allows users to choose between Hyprland and Mangowc as their window manager, with shared and WM-specific configurations managed via Emacs Org and Nix Flakes. The project is designed for reproducibility, maintainability, and cross-machine compatibility.

-
-

Installed components:

-
+
+

Installed components:

+
    -
  • Core
  • -
  • Hyprland
  • -
  • Mangowc
  • +
  • Core
  • +
  • Hyprland
  • +
  • Mangowc
-
-

Goals, project Structure, import hierarchy

-
+
+

Goals, project Structure, import hierarchy

+

This project uses a modular NixOS configuration with Hyprland and MangoWC support, designed for literate programming and cross-device reusability. The Droidnix repository is organized into two main parts: @@ -359,9 +359,9 @@ The Droidnix repository is organized into two main parts:

-
-

Root Level

-
+
+

Root Level

+
  • flake.nix is the entry point and imports:
      @@ -372,16 +372,16 @@ The Droidnix repository is organized into two main parts:
-
-

Generated Structure

-
+
+

Generated Structure

+

The generated/ directory contains all generated configurations, divided into three main groups: system, hyprland, and mangowc.

-
-

First Setup

-
+
+

First Setup

+
  1. Clone this repository.
  2. Run the setup script: ./setup_droid.
  3. @@ -411,9 +411,9 @@ The .assets/ folder contains all static files, such as configs, scr This section contains the Org blocks for tangling Nix code into the generated folders.

-
-

flake.nix

-
+
+

flake.nix

+

The Nix flake definition for Droidnix.

@@ -482,9 +482,9 @@ The Nix flake definition for Droidnix.
-
-

generated/hosts/traveldroid/host.nix

-
+
+

generated/hosts/traveldroid/host.nix

+
{ lib, config, pkgs, flakeRoot, import-tree, home-manager, ... }:
 
@@ -542,9 +542,9 @@ in
 
-
-

generated/hosts/traveldroid/hardware-configuration.nix

-
+
+

generated/hosts/traveldroid/hardware-configuration.nix

+
  1. Boot into NixOS Live ISO or your installed system.
  2. Open a terminal.
  3. @@ -602,9 +602,9 @@ in
-
-

generated/hosts/traveldroid/boot.nix

-
+
+

generated/hosts/traveldroid/boot.nix

+
{ config, pkgs, lib, flakeRoot, ... }:
 
@@ -653,17 +653,17 @@ in
 
-
-

Following are the imported modules

+
+

Following are the imported modules

-
-

generated/traveldroid/modules/apps

-
+
+

generated/traveldroid/modules/apps

+
-
-

generated/modules/traveldroid/apps/2_b_installed.nix

-
+
+

generated/modules/traveldroid/apps/2_b_installed.nix

+

This installs a list of apps

@@ -771,9 +771,9 @@ in {
-
-

generated/assets/2_b_installed.conf

-
+
+

generated/assets/2_b_installed.conf

+

This is a list of additional apps to install

@@ -827,9 +827,9 @@ com.todoist.Todoist
-
-

generated/modules/traveldroid/apps/kitty.nix

-
+
+

generated/modules/traveldroid/apps/kitty.nix

+

This file sets up Kitty terminal

@@ -887,9 +887,9 @@ in
-
-

generated/modules/traveldroid/apps/starship.nix

-
+
+

generated/modules/traveldroid/apps/starship.nix

+

This file sets up starship prompt

@@ -928,9 +928,9 @@ in
-
-

.config/starship.toml

-
+
+

.config/starship.toml

+

These are config files for .config

@@ -1219,9 +1219,9 @@ crust = "#181926"
-
-

generated/modules/traveldroid/apps/thunar.nix

-
+
+

generated/modules/traveldroid/apps/thunar.nix

+

This is top file of this level which contains just an import statement for all relevant files and/or the subfolder in this folder

@@ -1261,9 +1261,9 @@ in
-
-

generated/modules/traveldroid/apps/wofi.nix

-
+
+

generated/modules/traveldroid/apps/wofi.nix

+

This is the install for Wofi, the launcher

@@ -1296,9 +1296,9 @@ in
-
-

.config/wofi/config

-
+
+

.config/wofi/config

+

These are config files for .config/wofi

@@ -1345,9 +1345,9 @@ prompt = >
-
-

.config/wofi/style.css

-
+
+

.config/wofi/style.css

+

These are config files for .config/wofi

@@ -1436,9 +1436,9 @@ These are config files for .config/wofi
-
-

generated/modules/traveldroid/apps/zenbrowser.nix

-
+
+

generated/modules/traveldroid/apps/zenbrowser.nix

+

This installs zen browser

@@ -1458,9 +1458,9 @@ in
-
-

generated/modules/traveldroid/apps/zsh.nix

-
+
+

generated/modules/traveldroid/apps/zsh.nix

+

This sets up the zsh in the terminal

@@ -1523,9 +1523,9 @@ in
-
-

=generated/.config/zsh/.zshrc

-
+
+

=generated/.config/zsh/.zshrc

+

This sets up the zsh in the terminal

@@ -1546,9 +1546,9 @@ fi
-
-

generated/modules/traveldroid/apps/emacs/emacs.nix

-
+
+

generated/modules/traveldroid/apps/emacs/emacs.nix

+

This installs emacs

@@ -1644,9 +1644,9 @@ in
-
-

generated/.config/emacs/early-init.el

-
+
+

generated/.config/emacs/early-init.el

+

This contaions emacs

@@ -1747,9 +1747,9 @@ package-archive-priorities '(("gnu" . 99)
-
-

generated/.config/emacs/init.el

-
+
+

generated/.config/emacs/init.el

+

This contaions emacs

@@ -2160,13 +2160,13 @@ the top of the file."
-
-

generated/modules/traveldroid/desktop

-
+
+

generated/modules/traveldroid/desktop

+
-
-

generated/modules/traveldroid/desktop/fonts.nix

-
+
+

generated/modules/traveldroid/desktop/fonts.nix

+

This file installs and configures fonts

@@ -2184,9 +2184,9 @@ This file installs and configures fonts
-
-

generated/modules/traveldroid/desktop/gtk.nix

-
+
+

generated/modules/traveldroid/desktop/gtk.nix

+

Setting up GTK

@@ -2212,9 +2212,9 @@ in
-
-

generated/modules/traveldroid/desktop/hyprland.nix

-
+
+

generated/modules/traveldroid/desktop/hyprland.nix

+

Setting up Hyprland

@@ -2261,9 +2261,9 @@ in
-
-

.config/hypr/animations.conf

-
+
+

.config/hypr/animations.conf

+

These are config files for .config/hypr

@@ -2284,9 +2284,9 @@ animations {
-
-

.config/hypr/behaviour.conf

-
+
+

.config/hypr/behaviour.conf

+

These are config files for .config/hypr

@@ -2328,9 +2328,9 @@ misc {
-
-

.config/hypr/bindings.conf

-
+
+

.config/hypr/bindings.conf

+

These are config files for .config/hypr

@@ -2493,9 +2493,9 @@ bind = $mainMod, W, exec, zen
-
-

.config/hypr/exec-once.conf

-
+
+

.config/hypr/exec-once.conf

+

These are config files for .config/hypr

@@ -2511,9 +2511,9 @@ exec-once = sh ~/Wallpapers/scripts/wallpaper.sh &
-
-

.config/hypr/hypridle.conf

-
+
+

.config/hypr/hypridle.conf

+

These are config files for .config/hypr

@@ -2538,9 +2538,9 @@ listener {
-
-

.config/hypr/hyprland.conf

-
+
+

.config/hypr/hyprland.conf

+

These are config files for .config/hypr

@@ -2587,9 +2587,9 @@ misc {
-
-

.config/hypr/hyprlock.conf

-
+
+

.config/hypr/hyprlock.conf

+

These are config files for .config/hypr

@@ -2630,9 +2630,9 @@ label {
-
-

.config/hypr/layer-rules.conf

-
+
+

.config/hypr/layer-rules.conf

+

These are config files for .config/hypr

@@ -2647,9 +2647,9 @@ layerrule = blur on, ignore_alpha 1, match:namespace swaync-notification-window
-
-

.config/hypr/layout.conf

-
+
+

.config/hypr/layout.conf

+

These are config files for .config/hypr

@@ -2659,9 +2659,9 @@ These are config files for .config/hypr
-
-

.config/hypr/monitor-rules.conf

-
+
+

.config/hypr/monitor-rules.conf

+

These are config files for .config/hypr

@@ -2672,9 +2672,9 @@ monitor=DP-1,3840x1080@144,1920x0,1
-
-

.config/hypr/scripts/layout-selector.sh

-
+
+

.config/hypr/scripts/layout-selector.sh

+

These are config files for .config/hypr/scripts

@@ -2717,9 +2717,9 @@ hyprctl dispatch oSD "Layout: $LAYOUT_NAME" 2000
-
-

.config/hypr/theming.css

-
+
+

.config/hypr/theming.css

+

These are config files for .config/hypr

@@ -2768,9 +2768,9 @@ decoration {
-
-

.config/hypr/window-rules.conf

-
+
+

.config/hypr/window-rules.conf

+

These are config files for .config/hypr

@@ -2799,9 +2799,9 @@ windowrulev2 = floatclass:Wofi,opacity:0.9,blur:15
-
-

.config/hypr/workspace-rules.conf

-
+
+

.config/hypr/workspace-rules.conf

+

These are config files for .config/hypr

@@ -2827,9 +2827,9 @@ workspace = 10
-
-

generated/modules/traveldroid/desktop/wallpaper.nix

-
+
+

generated/modules/traveldroid/desktop/wallpaper.nix

+

Setting up wallpaper engine + wallpaper gui

@@ -2923,9 +2923,9 @@ in
-
-

generated/modules/traveldroid/desktop/stylix.nix

-
+
+

generated/modules/traveldroid/desktop/stylix.nix

+
{ lib, config, pkgs, flakeRoot, stylix, ... }:
 
@@ -3012,9 +3012,9 @@ in
 
-
-

.config/stylix/stylix.conf

-
+
+

.config/stylix/stylix.conf

+

These are config files for .config/stylix

@@ -3051,9 +3051,9 @@ icons = {
-
-

.config/stylix/palette.json

-
+
+

.config/stylix/palette.json

+

These are config files for .config/stylix

@@ -3083,9 +3083,9 @@ These are config files for .config/stylix
-
-

.config/stylix/palette.html

-
+
+

.config/stylix/palette.html

+

These are config files for .config/stylix

@@ -3163,9 +3163,9 @@ These are config files for .config/stylix
-
-

generated/modules/traveldroid/desktop/waybar.nix

-
+
+

generated/modules/traveldroid/desktop/waybar.nix

+

This file installs and configures waybar

@@ -3231,14 +3231,14 @@ in
-
-

.config/waybar/config

-
+
+

.config/waybar/config

+

These are config files for waybar

-
{
+
{
   "layer": "top",
   "height": 34,
 
@@ -3262,16 +3262,17 @@ These are  config files for waybar
     "battery",
     "tray",
     "clock",
-    "custom/notifications",
+  #  "custom/notifications",
   ],
 
   "custom/hyprscroll_overflow": {
     "exec": "~/.config/waybar/scripts/hyprscroll-overflow.sh",
     "interval": 2,
     "return-type": "json",
+    "format": "{}",
     "on-click": "~/.config/waybar/scripts/hyprscroll-menu.sh",
     "tooltip": true
-  },
+  },,
 
  /*
  "custom/notifications": {
@@ -3372,14 +3373,13 @@ These are  config files for waybar
     "format-icons": ["󰁺", "󰁼", "󰁾", "󰂀", "󱈏 "],
   },
 }
-
 
-
-

.config/waybar/style.css

-
+
+

.config/waybar/style.css

+

These are config files for waybar

@@ -3613,9 +3613,9 @@ window#waybar {
-
-

.config/waybar/scripts/bluetooth-status.sh

-
+
+

.config/waybar/scripts/bluetooth-status.sh

+

These are config files for waybar

@@ -3641,46 +3641,53 @@ printf '{"text": "%s", "tooltip": "%s"}\n' "$icon" "$tooltip"
-
-

.config/waybar/scripts/hyprscroll-overflow.sh

-
+
+

.config/waybar/scripts/hyprscroll-overflow.sh

+

These are config files for waybar

#!/usr/bin/env bash
+set -euo pipefail
+# Fallback output
+fallback='{"text":" ","class":"hidden"}'
 # Get active workspace
-active_ws=$(hyprctl activeworkspace -j | jq -r '.id')
+active_ws=$(hyprctl activeworkspace -j 2>/dev/null | jq -r '.id' 2>/dev/null) || {
+  echo "$fallback"
+  exit 0
+}
 # Get workspace info
-ws=$(hyprctl workspaces -j | jq ".[] | select(.id==$active_ws)")
-# Layout (requires hyprscroll plugin)
-layout=$(echo "$ws" | jq -r '.layout // "unknown"')
-# Window count
-clients=$(hyprctl clients -j | jq "[.[] | select(.workspace.id==$active_ws)]")
-count=$(echo "$clients" | jq 'length')
-# Visible windows (heuristic: fullscreen or floating doesn't matter, we count all)
-# If you use hyprscroll, visible windows ≈ 1 (current focus)
+ws=$(hyprctl workspaces -j 2>/dev/null | jq ".[] | select(.id==$active_ws)" 2>/dev/null) || {
+  echo "$fallback"
+  exit 0
+}
+# Layout
+layout=$(echo "$ws" | jq -r '.layout // "unknown"' 2>/dev/null)
+# Clients
+clients=$(hyprctl clients -j 2>/dev/null | jq "[.[] | select(.workspace.id==$active_ws)]" 2>/dev/null) || {
+  echo "$fallback"
+  exit 0
+}
+count=$(echo "$clients" | jq 'length' 2>/dev/null)
+# In scrolling layout, only 1 is visible
 visible=1
-# Build tooltip (list all windows)
-tooltip=$(echo "$clients" | jq -r '.[].title' | sed ':a;N;$!ba;s/\n/\\n/g')
 # Conditions
-if [[ "$layout" != "scrolling" ]]; then
-  echo '{"text": "", "class": "hidden"}'
+if [[ "$layout" != "scrolling" ]] || (( count <= visible )); then
+  echo "$fallback"
   exit 0
 fi
-if (( count <= visible )); then
-  echo '{"text": "", "class": "hidden"}'
-  exit 0
-fi
-# Output star + count
-echo "{\"text\": \"★ $count\", \"tooltip\": \"$tooltip\", \"class\": \"overflow\"}"
+# Tooltip (safe escaping)
+tooltip=$(echo "$clients" | jq -r '.[].title' 2>/dev/null | sed ':a;N;$!ba;s/\n/\\n/g')
+# Final output
+echo "{\"text\":\"★ $count\",\"tooltip\":\"$tooltip\",\"class\":\"overflow\"}"
 
-
-

.config/waybar/scripts/hyprscroll-menu.sh

-
+
+

.config/waybar/scripts/hyprscroll-menu.sh

+

These are config files for waybar

@@ -3697,9 +3704,9 @@ hyprctl dispatch focuswindow address:$addr
-
-

.config/waypaper/config.ini

-
+
+

.config/waypaper/config.ini

+

These are config files for waypaper

@@ -3736,9 +3743,9 @@ keybindings = ~/.config/waypaper/keybindings.ini
-
-

generated/modules/traveldroid/desktop/wayland.nix

-
+
+

generated/modules/traveldroid/desktop/wayland.nix

+
{ lib, config, pkgs, ... }:
 
@@ -3768,9 +3775,9 @@ keybindings = ~/.config/waypaper/keybindings.ini
 
-
-

generated/modules/traveldroid/desktop/xdg.nix

-
+
+

generated/modules/traveldroid/desktop/xdg.nix

+

This sets the XDG implementation

@@ -3824,13 +3831,13 @@ in
-
-

generated/modules/traveldroid/system

-
+
+

generated/modules/traveldroid/system

+
-
-

generated/modules/traveldroid/system/bluetooth.nix

-
+
+

generated/modules/traveldroid/system/bluetooth.nix

+
{ lib, config, pkgs, home-manager, ... }:
 
@@ -3851,9 +3858,9 @@ in
 
-
-

generated/modules/traveldroid/system/dbus.nix

-
+
+

generated/modules/traveldroid/system/dbus.nix

+

This sets the dbus implementation

@@ -3880,9 +3887,9 @@ This sets the dbus implementation
-
-

generated/modules/traveldroid/system/login-tuigreet.nix

-
+
+

generated/modules/traveldroid/system/login-tuigreet.nix

+

This sets up tuigreeter which is not fancy but imo fits the aesthetic I am aiming for

@@ -3936,9 +3943,9 @@ in
-
-

generated/modules/traveldroid/system/networking.nix

-
+
+

generated/modules/traveldroid/system/networking.nix

+

This sets the networking.

@@ -4000,9 +4007,9 @@ This sets the networking.
-
-

generated/modules/traveldroid/system/nix.nix

-
+
+

generated/modules/traveldroid/system/nix.nix

+
{ lib, config, ... }:
 
@@ -4019,13 +4026,13 @@ This sets the networking.
 
-
-

generated/users

-
+
+

generated/users

+
-
-

generated/users/henrov.nix

-
+
+

generated/users/henrov.nix

+

This is the default user, just search and replace henrov another name if you want to change

@@ -4083,9 +4090,9 @@ in

These are all the prepared config files

-
-

.config/waybar/style.css

-
+
+

.config/waybar/style.css

+

These are config files for .config/waybar

@@ -4319,9 +4326,9 @@ window#waybar {
-
-

.config/waypaper/config.ini

-
+
+

.config/waypaper/config.ini

+

These are config files for .config/waypaper

@@ -4358,9 +4365,9 @@ keybindings = ~/.config/waypaper/keybindings.ini
-
-

.config/zed/settings.json

-
+
+

.config/zed/settings.json

+

These are config files for .config/zed

@@ -4400,7 +4407,7 @@ These are config files for .config/zed

Author: Henro Veijer

-

Created: 2026-04-01 wo 19:02

+

Created: 2026-04-01 wo 19:09

Validate

diff --git a/Droidnix/README.org b/Droidnix/README.org index 098360867..240425e0d 100644 --- a/Droidnix/README.org +++ b/Droidnix/README.org @@ -2635,7 +2635,7 @@ in ** =.config/waybar/config= These are config files for waybar -#+BEGIN_SRC conf :tangle generated/.config/waybar/config :noweb yes :mkdirp yes :eval never +#+BEGIN_SRC json :tangle generated/.config/waybar/config :noweb yes :mkdirp yes :eval never { "layer": "top", "height": 34, @@ -2660,16 +2660,17 @@ These are config files for waybar "battery", "tray", "clock", - "custom/notifications", + # "custom/notifications", ], "custom/hyprscroll_overflow": { "exec": "~/.config/waybar/scripts/hyprscroll-overflow.sh", "interval": 2, "return-type": "json", + "format": "{}", "on-click": "~/.config/waybar/scripts/hyprscroll-menu.sh", "tooltip": true - }, + },, /* "custom/notifications": { @@ -2770,7 +2771,6 @@ These are config files for waybar "format-icons": ["󰁺", "󰁼", "󰁾", "󰂀", "󱈏 "], }, } - #+END_SRC ** =.config/waybar/style.css= @@ -3029,31 +3029,38 @@ printf '{"text": "%s", "tooltip": "%s"}\n' "$icon" "$tooltip" These are config files for waybar #+BEGIN_SRC sh :tangle generated/.config/waybar/scripts/hyprscroll-overflow.sh :noweb yes :mkdirp yes :eval never #!/usr/bin/env bash +set -euo pipefail +# Fallback output +fallback='{"text":" ","class":"hidden"}' # Get active workspace -active_ws=$(hyprctl activeworkspace -j | jq -r '.id') +active_ws=$(hyprctl activeworkspace -j 2>/dev/null | jq -r '.id' 2>/dev/null) || { + echo "$fallback" + exit 0 +} # Get workspace info -ws=$(hyprctl workspaces -j | jq ".[] | select(.id==$active_ws)") -# Layout (requires hyprscroll plugin) -layout=$(echo "$ws" | jq -r '.layout // "unknown"') -# Window count -clients=$(hyprctl clients -j | jq "[.[] | select(.workspace.id==$active_ws)]") -count=$(echo "$clients" | jq 'length') -# Visible windows (heuristic: fullscreen or floating doesn't matter, we count all) -# If you use hyprscroll, visible windows ≈ 1 (current focus) +ws=$(hyprctl workspaces -j 2>/dev/null | jq ".[] | select(.id==$active_ws)" 2>/dev/null) || { + echo "$fallback" + exit 0 +} +# Layout +layout=$(echo "$ws" | jq -r '.layout // "unknown"' 2>/dev/null) +# Clients +clients=$(hyprctl clients -j 2>/dev/null | jq "[.[] | select(.workspace.id==$active_ws)]" 2>/dev/null) || { + echo "$fallback" + exit 0 +} +count=$(echo "$clients" | jq 'length' 2>/dev/null) +# In scrolling layout, only 1 is visible visible=1 -# Build tooltip (list all windows) -tooltip=$(echo "$clients" | jq -r '.[].title' | sed ':a;N;$!ba;s/\n/\\n/g') # Conditions -if [[ "$layout" != "scrolling" ]]; then - echo '{"text": "", "class": "hidden"}' +if [[ "$layout" != "scrolling" ]] || (( count <= visible )); then + echo "$fallback" exit 0 fi -if (( count <= visible )); then - echo '{"text": "", "class": "hidden"}' - exit 0 -fi -# Output star + count -echo "{\"text\": \"★ $count\", \"tooltip\": \"$tooltip\", \"class\": \"overflow\"}" +# Tooltip (safe escaping) +tooltip=$(echo "$clients" | jq -r '.[].title' 2>/dev/null | sed ':a;N;$!ba;s/\n/\\n/g') +# Final output +echo "{\"text\":\"★ $count\",\"tooltip\":\"$tooltip\",\"class\":\"overflow\"}" #+END_SRC ** =.config/waybar/scripts/hyprscroll-menu.sh= diff --git a/Droidnix/generated/.config/waybar/config b/Droidnix/generated/.config/waybar/config index ebadef218..3f7d662bd 100644 --- a/Droidnix/generated/.config/waybar/config +++ b/Droidnix/generated/.config/waybar/config @@ -22,16 +22,17 @@ "battery", "tray", "clock", - "custom/notifications", + # "custom/notifications", ], "custom/hyprscroll_overflow": { "exec": "~/.config/waybar/scripts/hyprscroll-overflow.sh", "interval": 2, "return-type": "json", + "format": "{}", "on-click": "~/.config/waybar/scripts/hyprscroll-menu.sh", "tooltip": true - }, + },, /* "custom/notifications": { diff --git a/Droidnix/generated/.config/waybar/scripts/hyprscroll-overflow.sh b/Droidnix/generated/.config/waybar/scripts/hyprscroll-overflow.sh index 0af06215d..03b83a62e 100644 --- a/Droidnix/generated/.config/waybar/scripts/hyprscroll-overflow.sh +++ b/Droidnix/generated/.config/waybar/scripts/hyprscroll-overflow.sh @@ -1,26 +1,33 @@ #!/usr/bin/env bash +set -euo pipefail +# Fallback output +fallback='{"text":" ","class":"hidden"}' # Get active workspace -active_ws=$(hyprctl activeworkspace -j | jq -r '.id') +active_ws=$(hyprctl activeworkspace -j 2>/dev/null | jq -r '.id' 2>/dev/null) || { + echo "$fallback" + exit 0 +} # Get workspace info -ws=$(hyprctl workspaces -j | jq ".[] | select(.id==$active_ws)") -# Layout (requires hyprscroll plugin) -layout=$(echo "$ws" | jq -r '.layout // "unknown"') -# Window count -clients=$(hyprctl clients -j | jq "[.[] | select(.workspace.id==$active_ws)]") -count=$(echo "$clients" | jq 'length') -# Visible windows (heuristic: fullscreen or floating doesn't matter, we count all) -# If you use hyprscroll, visible windows ≈ 1 (current focus) +ws=$(hyprctl workspaces -j 2>/dev/null | jq ".[] | select(.id==$active_ws)" 2>/dev/null) || { + echo "$fallback" + exit 0 +} +# Layout +layout=$(echo "$ws" | jq -r '.layout // "unknown"' 2>/dev/null) +# Clients +clients=$(hyprctl clients -j 2>/dev/null | jq "[.[] | select(.workspace.id==$active_ws)]" 2>/dev/null) || { + echo "$fallback" + exit 0 +} +count=$(echo "$clients" | jq 'length' 2>/dev/null) +# In scrolling layout, only 1 is visible visible=1 -# Build tooltip (list all windows) -tooltip=$(echo "$clients" | jq -r '.[].title' | sed ':a;N;$!ba;s/\n/\\n/g') # Conditions -if [[ "$layout" != "scrolling" ]]; then - echo '{"text": "", "class": "hidden"}' +if [[ "$layout" != "scrolling" ]] || (( count <= visible )); then + echo "$fallback" exit 0 fi -if (( count <= visible )); then - echo '{"text": "", "class": "hidden"}' - exit 0 -fi -# Output star + count -echo "{\"text\": \"★ $count\", \"tooltip\": \"$tooltip\", \"class\": \"overflow\"}" +# Tooltip (safe escaping) +tooltip=$(echo "$clients" | jq -r '.[].title' 2>/dev/null | sed ':a;N;$!ba;s/\n/\\n/g') +# Final output +echo "{\"text\":\"★ $count\",\"tooltip\":\"$tooltip\",\"class\":\"overflow\"}"