Regenerated
This commit is contained in:
+322
-316
File diff suppressed because it is too large
Load Diff
+14
-8
@@ -3049,23 +3049,29 @@ printf '{"text": "%s", "tooltip": "%s"}\n' "$icon" "$tooltip"
|
|||||||
These are config files for waybar
|
These are config files for waybar
|
||||||
#+BEGIN_SRC sh :tangle generated/.config/waybar/scripts/hypr-workspaces.sh :noweb yes :mkdirp yes :eval never
|
#+BEGIN_SRC sh :tangle generated/.config/waybar/scripts/hypr-workspaces.sh :noweb yes :mkdirp yes :eval never
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Get active workspace ID
|
# Get active workspace ID
|
||||||
active_ws=$(hyprctl activeworkspace -j | jq -r '.id')
|
active_ws=$(hyprctl activeworkspace -j | jq -r '.id')
|
||||||
|
|
||||||
# Get clients in active workspace
|
# Get clients in active workspace
|
||||||
clients=$(hyprctl clients -j | jq -r \
|
clients=$(hyprctl clients -j | jq -r \
|
||||||
".[] | select(.workspace.id==$active_ws) | \"\(.title)\"")
|
".[] | select(.workspace.id==$active_ws) | .title")
|
||||||
|
|
||||||
# Count clients
|
# Count clients
|
||||||
count=$(echo "-$clients" | grep -c .)
|
count=$(echo "$clients" | grep -c .)
|
||||||
# If no clients → hide module
|
|
||||||
if [ "$count" -eq 0 ]; then
|
# If less than 2 clients → hide module
|
||||||
jq -c -n '{text:"", class:"hidden"}'
|
if [ "$count" -lt 2 ]; then
|
||||||
exit 0
|
jq -c -n '{text:"", class:"hidden"}'
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build tooltip (newline separated)
|
# Build tooltip (newline separated)
|
||||||
tooltip=$(echo "$clients" | sed 's/^/• /' | paste -sd '\n' -)
|
tooltip=$(echo "$clients" | sed 's/^/• /' | paste -sd '\n' -)
|
||||||
# Output JSON
|
|
||||||
|
# Output JSON with dash
|
||||||
jq -c -n \
|
jq -c -n \
|
||||||
--arg text "$count" \
|
--arg text "-$count" \
|
||||||
--arg tooltip "$tooltip" \
|
--arg tooltip "$tooltip" \
|
||||||
--arg class "active" \
|
--arg class "active" \
|
||||||
'{text:$text, tooltip:$tooltip, class:$class}'
|
'{text:$text, tooltip:$tooltip, class:$class}'
|
||||||
|
|||||||
@@ -1,21 +1,27 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Get active workspace ID
|
# Get active workspace ID
|
||||||
active_ws=$(hyprctl activeworkspace -j | jq -r '.id')
|
active_ws=$(hyprctl activeworkspace -j | jq -r '.id')
|
||||||
|
|
||||||
# Get clients in active workspace
|
# Get clients in active workspace
|
||||||
clients=$(hyprctl clients -j | jq -r \
|
clients=$(hyprctl clients -j | jq -r \
|
||||||
".[] | select(.workspace.id==$active_ws) | \"\(.title)\"")
|
".[] | select(.workspace.id==$active_ws) | .title")
|
||||||
|
|
||||||
# Count clients
|
# Count clients
|
||||||
count=$(echo "-$clients" | grep -c .)
|
count=$(echo "$clients" | grep -c .)
|
||||||
# If no clients → hide module
|
|
||||||
if [ "$count" -eq 0 ]; then
|
# If less than 2 clients → hide module
|
||||||
jq -c -n '{text:"", class:"hidden"}'
|
if [ "$count" -lt 2 ]; then
|
||||||
exit 0
|
jq -c -n '{text:"", class:"hidden"}'
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build tooltip (newline separated)
|
# Build tooltip (newline separated)
|
||||||
tooltip=$(echo "$clients" | sed 's/^/• /' | paste -sd '\n' -)
|
tooltip=$(echo "$clients" | sed 's/^/• /' | paste -sd '\n' -)
|
||||||
# Output JSON
|
|
||||||
|
# Output JSON with dash
|
||||||
jq -c -n \
|
jq -c -n \
|
||||||
--arg text "$count" \
|
--arg text "-$count" \
|
||||||
--arg tooltip "$tooltip" \
|
--arg tooltip "$tooltip" \
|
||||||
--arg class "active" \
|
--arg class "active" \
|
||||||
'{text:$text, tooltip:$tooltip, class:$class}'
|
'{text:$text, tooltip:$tooltip, class:$class}'
|
||||||
|
|||||||
Reference in New Issue
Block a user