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
|
||||
#+BEGIN_SRC sh :tangle generated/.config/waybar/scripts/hypr-workspaces.sh :noweb yes :mkdirp yes :eval never
|
||||
#!/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
|
||||
for ws in $(echo "$workspaces" | jq -r '.[] | @base64'); do
|
||||
_jq() { echo "$ws" | base64 --decode | jq -r "$1"; }
|
||||
# Count windows
|
||||
win_count=$(echo "$clients" | wc -l | tr -d ' ')
|
||||
|
||||
ws_id=$(_jq '.id')
|
||||
ws_name=$(_jq '.name')
|
||||
# Build tooltip string (each window on a new line)
|
||||
tooltip=$(echo "$clients" | sed 's/^/• /')
|
||||
|
||||
# Count windows in this workspace
|
||||
win_count=$(hyprctl clients -j | jq "[.[] | select(.workspace.id==$ws_id)] | length")
|
||||
|
||||
# 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"
|
||||
# Output JSON for Waybar
|
||||
jq -n --arg count "$win_count" --arg tooltip "$tooltip" '{text: $count, tooltip: $tooltip}'
|
||||
#+END_SRC
|
||||
|
||||
** =.config/waybar/scripts/hypr-workspacesmenu.sh=
|
||||
|
||||
@@ -1,29 +1,17 @@
|
||||
#!/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
|
||||
for ws in $(echo "$workspaces" | jq -r '.[] | @base64'); do
|
||||
_jq() { echo "$ws" | base64 --decode | jq -r "$1"; }
|
||||
# Count windows
|
||||
win_count=$(echo "$clients" | wc -l | tr -d ' ')
|
||||
|
||||
ws_id=$(_jq '.id')
|
||||
ws_name=$(_jq '.name')
|
||||
# Build tooltip string (each window on a new line)
|
||||
tooltip=$(echo "$clients" | sed 's/^/• /')
|
||||
|
||||
# Count windows in this workspace
|
||||
win_count=$(hyprctl clients -j | jq "[.[] | select(.workspace.id==$ws_id)] | length")
|
||||
|
||||
# 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"
|
||||
# Output JSON for Waybar
|
||||
jq -n --arg count "$win_count" --arg tooltip "$tooltip" '{text: $count, tooltip: $tooltip}'
|
||||
|
||||
Reference in New Issue
Block a user