From ead971c06653220b33e201e0a752e72bb1847f3d Mon Sep 17 00:00:00 2001 From: Penelope Gwen Date: Sat, 29 Nov 2025 11:15:01 -0800 Subject: [PATCH] New backup 2025-11-29 11:15:01 --- de/home/.config/eww/modules/bar/scratchpad.yuck | 6 +++--- de/home/.config/eww/scripts/bar/scratchpad | 13 ++++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/de/home/.config/eww/modules/bar/scratchpad.yuck b/de/home/.config/eww/modules/bar/scratchpad.yuck index 8e0f95d..8ce7a44 100644 --- a/de/home/.config/eww/modules/bar/scratchpad.yuck +++ b/de/home/.config/eww/modules/bar/scratchpad.yuck @@ -17,9 +17,9 @@ :class "reveal-children" :space-evenly false (for entry in array - (button :onclick 'swaymsg [con_id=${entry.win_id}] focus' - :tooltip "${entry.name} -${entry.title}" + (button :onclick 'swaymsg [con_id=${entry.win_id}] scratchpad show' + :class "${(entry.visible == 'true') ? visible : hidden}" + :tooltip "${entry.name}\n${entry.title}" (image :path {entry.icon} :image-width 20 :image-height 20) diff --git a/de/home/.config/eww/scripts/bar/scratchpad b/de/home/.config/eww/scripts/bar/scratchpad index 31509d9..5b93cbb 100755 --- a/de/home/.config/eww/scripts/bar/scratchpad +++ b/de/home/.config/eww/scripts/bar/scratchpad @@ -6,7 +6,7 @@ declare -A icons=( jq_get_windows=' # descend to workspace or scratchpad - .nodes[0].nodes[0] + .nodes[].nodes[] # save workspace name as .w | {"w": .name} + ( if (.nodes|length) > 0 then # workspace @@ -18,7 +18,8 @@ jq_get_windows=' | .[] # select nodes with no children (windows) # | select(.nodes==[]) - | select(.scratchpad!="fresh") +# | select(.scratchpad!="none") + | select(.scratchpad_state=="fresh") )' jq_windows_to_tsv=' @@ -29,7 +30,8 @@ jq_windows_to_tsv=' # get app name (or window class if xwayland) (.app_id // .window_properties.class), (.name), - (.pid) + (.pid), + (.visible) ] | @tsv' @@ -176,12 +178,13 @@ function get_scratchpad() { shopt -s lastpipe swaymsg -t get_tree | jq -r "$jq_get_windows | $jq_windows_to_tsv" | - column -s $'\t' -o $'\t' -t | while IFS=$'\t' read -r win_id ws_name app_name win_title pid; do + column -s $'\t' -o $'\t' -t | while IFS=$'\t' read -r win_id ws_name app_name win_title pid visible; do shopt -s extglob app_name="${app_name%%*( )}" icon=$( get_icon "$app_name" "$pid" ) + visible=${visible} [[ "$verbose" ]] && printf "[%s]=%s\n" "$app_name" "$icon" >&2 - applist_array_item=$(jq -n --arg icon "${icon}" --arg name "${app_name##*.}" --arg title "${win_title}" --arg win_id "${win_id}" '{icon: $icon,name: $name,title: $title,win_id: $win_id}') + applist_array_item=$(jq -n --arg icon "${icon}" --arg name "${app_name##*.}" --arg title "${win_title}" --arg win_id "${win_id}" --arg visible "${visible}" '{icon: $icon,name: $name,title: $title,win_id: $win_id,visible: $visible}') applist_array+=("${applist_array_item}") done applist=$(printf '%s\n' "${applist_array[@]}" | jq -s .)