Regenerated
This commit is contained in:
+316
-339
File diff suppressed because it is too large
Load Diff
+12
-33
@@ -2685,7 +2685,7 @@ These are config files for waybar
|
||||
"exec": "~/.config/waybar/scripts/hypr-workspaces.sh",
|
||||
"interval": 2,
|
||||
"return-type": "json",
|
||||
"format": "{name}",
|
||||
"format": "{text}",
|
||||
"on-click": "~/.config/waybar/scripts/hypr-workspacesmenu.sh",
|
||||
"tooltip": true
|
||||
},
|
||||
@@ -2836,7 +2836,7 @@ window#waybar {
|
||||
linear-gradient(45deg, @blue, @green) border-box;
|
||||
}
|
||||
|
||||
/* Hyprland Workspaces module */
|
||||
/* Hyprland workspaces with transparency */
|
||||
#custom-hypr-workspaces {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
@@ -2847,17 +2847,13 @@ window#waybar {
|
||||
border-radius: 10px;
|
||||
min-width: 50px;
|
||||
text-align: center;
|
||||
background: linear-gradient(45deg, @blue, @green);
|
||||
background: linear-gradient(45deg, rgba(51,204,255,0.5), rgba(0,255,153,0.5)); /* @blue with 50% opacity */
|
||||
color: @text;
|
||||
font-weight: bold;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
#custom-hypr-workspaces > *:hover {
|
||||
background: linear-gradient(45deg, @green, @blue);
|
||||
}
|
||||
|
||||
#clock,
|
||||
#idle_inhibitor,
|
||||
#battery,
|
||||
@@ -2943,45 +2939,28 @@ printf '{"text": "%s", "tooltip": "%s"}\n' "$icon" "$tooltip"
|
||||
** =.config/waybar/scripts/hypr-workspaces.sh=
|
||||
These are config files for waybar
|
||||
#+BEGIN_SRC sh :tangle generated/.config/waybar/scripts/hypr-workspaces.sh :noweb yes :mkdirp yes :eval never
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Outputs JSON for Waybar showing workspace name + number of windows
|
||||
|
||||
# Get all workspaces
|
||||
# Using hyprctl JSON output
|
||||
workspaces=$(hyprctl workspaces -j)
|
||||
|
||||
# Initialize output JSON
|
||||
json="["
|
||||
|
||||
index=0
|
||||
for ws in $(echo "$workspaces" | jq -r '.[] | @base64'); do
|
||||
_jq() {
|
||||
echo "$ws" | base64 --decode | jq -r "$1"
|
||||
}
|
||||
_jq() { echo "$ws" | base64 --decode | jq -r "$1"; }
|
||||
|
||||
ws_id=$(_jq '.id')
|
||||
ws_name=$(_jq '.name')
|
||||
|
||||
# Get windows in this workspace
|
||||
windows=$(hyprctl clients -j | jq -r ".[] | select(.workspace.id==$ws_id) | \"\(.id): \(.title)\"")
|
||||
# Count windows in this workspace
|
||||
win_count=$(hyprctl clients -j | jq "[.[] | select(.workspace.id==$ws_id)] | length")
|
||||
|
||||
# Format tooltip: sequential numbering
|
||||
tooltip=""
|
||||
count=1
|
||||
while read -r win; do
|
||||
tooltip+="$count. $win\n"
|
||||
count=$((count+1))
|
||||
done <<< "$windows"
|
||||
|
||||
# If no windows
|
||||
if [ -z "$tooltip" ]; then
|
||||
tooltip="No windows"
|
||||
fi
|
||||
|
||||
# Output JSON for Waybar
|
||||
# Output JSON
|
||||
json+=$(jq -n \
|
||||
--arg name "$ws_name" \
|
||||
--arg tooltip "$tooltip" \
|
||||
'{text: $name, tooltip: $tooltip}')
|
||||
--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+=","
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
"exec": "~/.config/waybar/scripts/hypr-workspaces.sh",
|
||||
"interval": 2,
|
||||
"return-type": "json",
|
||||
"format": "{name}",
|
||||
"format": "{text}",
|
||||
"on-click": "~/.config/waybar/scripts/hypr-workspacesmenu.sh",
|
||||
"tooltip": true
|
||||
},
|
||||
|
||||
@@ -1,42 +1,25 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
# Outputs JSON for Waybar showing workspace name + number of windows
|
||||
|
||||
# Get all workspaces
|
||||
# Using hyprctl JSON output
|
||||
workspaces=$(hyprctl workspaces -j)
|
||||
|
||||
# Initialize output JSON
|
||||
json="["
|
||||
|
||||
index=0
|
||||
for ws in $(echo "$workspaces" | jq -r '.[] | @base64'); do
|
||||
_jq() {
|
||||
echo "$ws" | base64 --decode | jq -r "$1"
|
||||
}
|
||||
_jq() { echo "$ws" | base64 --decode | jq -r "$1"; }
|
||||
|
||||
ws_id=$(_jq '.id')
|
||||
ws_name=$(_jq '.name')
|
||||
|
||||
# Get windows in this workspace
|
||||
windows=$(hyprctl clients -j | jq -r ".[] | select(.workspace.id==$ws_id) | \"\(.id): \(.title)\"")
|
||||
# Count windows in this workspace
|
||||
win_count=$(hyprctl clients -j | jq "[.[] | select(.workspace.id==$ws_id)] | length")
|
||||
|
||||
# Format tooltip: sequential numbering
|
||||
tooltip=""
|
||||
count=1
|
||||
while read -r win; do
|
||||
tooltip+="$count. $win\n"
|
||||
count=$((count+1))
|
||||
done <<< "$windows"
|
||||
|
||||
# If no windows
|
||||
if [ -z "$tooltip" ]; then
|
||||
tooltip="No windows"
|
||||
fi
|
||||
|
||||
# Output JSON for Waybar
|
||||
# Output JSON
|
||||
json+=$(jq -n \
|
||||
--arg name "$ws_name" \
|
||||
--arg tooltip "$tooltip" \
|
||||
'{text: $name, tooltip: $tooltip}')
|
||||
--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+=","
|
||||
|
||||
Reference in New Issue
Block a user