Regenerated
This commit is contained in:
+315
-327
File diff suppressed because it is too large
Load Diff
+11
-23
@@ -2940,34 +2940,22 @@ 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
|
||||||
# Outputs JSON for Waybar showing workspace name + number of windows
|
# ~/.config/waybar/scripts/active-workspace-wincount-json.sh
|
||||||
|
|
||||||
workspaces=$(hyprctl workspaces -j)
|
# Get active workspace ID
|
||||||
|
active_ws_id=$(hyprctl activewindow | grep "workspace: " | cut -d' ' -f2)
|
||||||
|
|
||||||
json="["
|
# Get all clients on that workspace
|
||||||
|
clients=$(hyprctl clients -j | jq -r ".[] | select(.workspace.id==$active_ws_id) | .title")
|
||||||
|
|
||||||
index=0
|
# Count windows
|
||||||
for ws in $(echo "$workspaces" | jq -r '.[] | @base64'); do
|
win_count=$(echo "$clients" | wc -l | tr -d ' ')
|
||||||
_jq() { echo "$ws" | base64 --decode | jq -r "$1"; }
|
|
||||||
|
|
||||||
ws_id=$(_jq '.id')
|
# Build tooltip string (each window on a new line)
|
||||||
ws_name=$(_jq '.name')
|
tooltip=$(echo "$clients" | sed 's/^/• /')
|
||||||
|
|
||||||
# Count windows in this workspace
|
# Output JSON for Waybar
|
||||||
win_count=$(hyprctl clients -j | jq "[.[] | select(.workspace.id==$ws_id)] | length")
|
jq -n --arg count "$win_count" --arg tooltip "$tooltip" '{text: $count, tooltip: $tooltip}'
|
||||||
|
|
||||||
# Output JSON
|
|
||||||
json+=$(jq -n \
|
|
||||||
--arg text "$ws_name ($win_count)" \
|
|
||||||
--arg tooltip "$(bash ~/.config/waybar/scripts/hypr-workspacesmenu.sh $ws_id)" \
|
|
||||||
'{text: $text, tooltip: $tooltip}')
|
|
||||||
|
|
||||||
index=$((index+1))
|
|
||||||
[ $index -lt $(echo "$workspaces" | jq length) ] && json+=","
|
|
||||||
done
|
|
||||||
|
|
||||||
json+="]"
|
|
||||||
echo "$json"
|
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
** =.config/waybar/scripts/hypr-workspacesmenu.sh=
|
** =.config/waybar/scripts/hypr-workspacesmenu.sh=
|
||||||
|
|||||||
@@ -1,29 +1,17 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Outputs JSON for Waybar showing workspace name + number of windows
|
# ~/.config/waybar/scripts/active-workspace-wincount-json.sh
|
||||||
|
|
||||||
workspaces=$(hyprctl workspaces -j)
|
# Get active workspace ID
|
||||||
|
active_ws_id=$(hyprctl activewindow | grep "workspace: " | cut -d' ' -f2)
|
||||||
|
|
||||||
json="["
|
# Get all clients on that workspace
|
||||||
|
clients=$(hyprctl clients -j | jq -r ".[] | select(.workspace.id==$active_ws_id) | .title")
|
||||||
|
|
||||||
index=0
|
# Count windows
|
||||||
for ws in $(echo "$workspaces" | jq -r '.[] | @base64'); do
|
win_count=$(echo "$clients" | wc -l | tr -d ' ')
|
||||||
_jq() { echo "$ws" | base64 --decode | jq -r "$1"; }
|
|
||||||
|
|
||||||
ws_id=$(_jq '.id')
|
# Build tooltip string (each window on a new line)
|
||||||
ws_name=$(_jq '.name')
|
tooltip=$(echo "$clients" | sed 's/^/• /')
|
||||||
|
|
||||||
# Count windows in this workspace
|
# Output JSON for Waybar
|
||||||
win_count=$(hyprctl clients -j | jq "[.[] | select(.workspace.id==$ws_id)] | length")
|
jq -n --arg count "$win_count" --arg tooltip "$tooltip" '{text: $count, tooltip: $tooltip}'
|
||||||
|
|
||||||
# Output JSON
|
|
||||||
json+=$(jq -n \
|
|
||||||
--arg text "$ws_name ($win_count)" \
|
|
||||||
--arg tooltip "$(bash ~/.config/waybar/scripts/hypr-workspacesmenu.sh $ws_id)" \
|
|
||||||
'{text: $text, tooltip: $tooltip}')
|
|
||||||
|
|
||||||
index=$((index+1))
|
|
||||||
[ $index -lt $(echo "$workspaces" | jq length) ] && json+=","
|
|
||||||
done
|
|
||||||
|
|
||||||
json+="]"
|
|
||||||
echo "$json"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user