From 5dd6372c7c740d27da505a67fd5c04df1793425c Mon Sep 17 00:00:00 2001 From: Penelope Gwen Date: Tue, 11 Mar 2025 22:00:02 -0700 Subject: [PATCH] New backup 2025-03-11 22:00:02 --- de/home/.config/eww/scripts/bar/scratchpad | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/de/home/.config/eww/scripts/bar/scratchpad b/de/home/.config/eww/scripts/bar/scratchpad index 54e4d2d..31f76c4 100755 --- a/de/home/.config/eww/scripts/bar/scratchpad +++ b/de/home/.config/eww/scripts/bar/scratchpad @@ -1,4 +1,5 @@ #!/bin/bash +#appropriated from https://gitlab.com/wef/dotfiles/-/blob/master/bin/sway-select-window for use with eww declare -A icons=( ) @@ -92,17 +93,14 @@ get_icon() { [[ "$verbose" ]] && echo "using hardcoded icon '$icon'" >&2 return } - # let's go poke in the .desktop files: icon_name="" dt=$( get_desktop "$app" ) - # sometimes we get the 'class' rather than the exe - so try this: [[ "$dt" ]] || { app=$( tr '\0' '\n' < "/proc/$pid/cmdline" | head -n 1 ) dt=$( get_desktop "$( basename "$app" )" ) } - [[ "$dt" ]] && { icon_name=$( awk -v IGNORECASE="set" -F"=" '/^icon/ {print $2}' "$dt" ) [[ -r "$icon_name" ]] && { @@ -137,15 +135,12 @@ get_icon() { } } } - - # desperation street: icon=$( find /usr/share/icons /usr/share/pixmaps | grep -E -i "/$app.(png|svg)" | head -n 1 ) [[ "$icon" && -r "$icon" ]] && { echo "$icon" [[ "$verbose" ]] && echo "using found icon '$icon'" >&2 return } - # failed: icon="/usr/share/gtk-doc/html/gtk2/image-missing.png" [[ "$verbose" ]] && echo "using missing icon '$icon'" >&2 @@ -157,29 +152,18 @@ function get_scratchpad() { applist="" shopt -s lastpipe swaymsg -t get_tree | - # get list of windows as tab-separated columns 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 shopt -s extglob app_name="${app_name%%*( )}" icon=$( get_icon "$app_name" "$pid" ) [[ "$verbose" ]] && printf "[%s]=%s\n" "$app_name" "$icon" >&2 - # shellcheck disable=SC2059 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}') -# echo "${applist_array_item}" applist_array+=("${applist_array_item}") -# echo "${applist_array[@]}" done applist=$(printf '%s\n' "${applist_array[@]}" | jq -s .) echo ${applist} } -#echo "${applist_array[@]}" -#printf '%s\n' "${applist_array[@]}" -#echo "${applist_array[@]}" -#applist=$(printf '%s\n' "${applist_array[@]}" | jq -s .) -#echo ${applist} -#sort -k3 -k2 -#wofi --cache-file=/dev/null --insensitive --allow-images --show dmenu --prompt='Focus a window' get_scratchpad swaymsg -t subscribe '["window"]' --monitor | {