From 0fc4ce4573a1e62ab27c097fd2f9e5da92dc3bd4 Mon Sep 17 00:00:00 2001 From: Penelope Gwen Date: Tue, 11 Mar 2025 21:00:06 -0700 Subject: [PATCH] New backup 2025-03-11 21:00:06 --- de/home/.config/eww/modules/bar.yuck | 25 ++++++++++++------- .../.config/eww/modules/bar/workspaces.yuck | 2 +- de/home/.config/eww/scripts/bar/scratchpad | 23 +++++++++++------ 3 files changed, 33 insertions(+), 17 deletions(-) diff --git a/de/home/.config/eww/modules/bar.yuck b/de/home/.config/eww/modules/bar.yuck index a433c6b..def1ad2 100644 --- a/de/home/.config/eww/modules/bar.yuck +++ b/de/home/.config/eww/modules/bar.yuck @@ -16,19 +16,26 @@ (profile) (workspaces :array workspacesArray) (windowtitle) - (scratchpad))) + (scratchpad :array scratchpadArray))) -(defwidget scratchpad [] +(defpoll scratchpadArray :interval 5s + 'scripts/bar/scratchpad') +(defwidget scratchpad [array] (box :orientation "v" :space-evenly false (box :space-evenly false - (image :path "/usr/share/icons/hicolor/scalable/apps/org.kde.dolphin.svg" - :image-width 25 - :image-height 25) - (image :path "/usr/share/icons/hicolor/32x32/apps/librewolf.png" - :image-width 25 - :image-height 25 - )))) + (for entry in array + (image :path "${entry.icon}" + :image-width 25 + :image-height 25) + ${entry.name} +; (image :path "/usr/share/icons/hicolor/scalable/apps/org.kde.dolphin.svg" +; :image-width 25 +; :image-height 25) +; (image :path "/usr/share/icons/hicolor/32x32/apps/librewolf.png" +; :image-width 25 +; :image-height 25 + ))) (defwidget centergroup [] (box :class "centergroup" :orientation "h" :space-evenly false :halign "start" diff --git a/de/home/.config/eww/modules/bar/workspaces.yuck b/de/home/.config/eww/modules/bar/workspaces.yuck index b5f89a3..9ae4c97 100644 --- a/de/home/.config/eww/modules/bar/workspaces.yuck +++ b/de/home/.config/eww/modules/bar/workspaces.yuck @@ -7,7 +7,7 @@ :space-evenly true :halign "start" - (for entry in array + (for entry in array (button :onclick `swaymsg workspace "${entry.name}"` :class {entry.focused ? "focused" : ""} '${replace(entry.name,".*:","")}')))) diff --git a/de/home/.config/eww/scripts/bar/scratchpad b/de/home/.config/eww/scripts/bar/scratchpad index 4757ef7..29501e8 100755 --- a/de/home/.config/eww/scripts/bar/scratchpad +++ b/de/home/.config/eww/scripts/bar/scratchpad @@ -157,6 +157,7 @@ ws_fmt='%s' app_fmt='%-15.15s' title_fmt='%s' +applist_array=() swaymsg -t get_tree | # get list of windows as tab-separated columns jq -r "$jq_get_windows | $jq_windows_to_tsv" | @@ -166,11 +167,19 @@ column -s $'\t' -o $'\t' -t | while IFS=$'\t' read -r win_id ws_name app_name wi icon=$( get_icon "$app_name" "$pid" ) [[ "$verbose" ]] && printf "[%s]=%s\n" "$app_name" "$icon" >&2 # shellcheck disable=SC2059 - printf "img:$icon:text:${id_fmt}\t${app_fmt}\t${ws_fmt}\t${title_fmt}\n" \ - "$win_id" \ - "${app_name##*.}" \ - "$ws_name" \ - "$win_title" -done | -sort -k3 -k2 + applist_array_item=$(jq -n --arg icon "${icon}" --arg name "${app_name##*.}}" '{icon: $icon,name: $name}') +# echo "${applist_array_item}" + applist_array+=("${applist_array_item}") +# echo "${applist_array[@]}" +# jq -n --arg icon "${icon}" --arg name "${app_name##*.}" '{icon: $icon,name: $name}' +# printf "img:$icon:text:${id_fmt}\t${app_fmt}\t${ws_fmt}\t${title_fmt}\n" \ +# "$win_id" \ +# "${app_name##*.}" \ +# "$ws_name" \ +# "$win_title" +done +printf '%s\n' "${applist_array[@]}" +applist=$(printf '%s\n' "${applist_array[@]}" | jq -s .) +echo ${applist_array[@]} +#sort -k3 -k2 #wofi --cache-file=/dev/null --insensitive --allow-images --show dmenu --prompt='Focus a window'