New backup 2025-03-11 21:00:06

This commit is contained in:
Penelope Gwen 2025-03-11 21:00:06 -07:00
parent 3fe005b4d2
commit 0fc4ce4573
3 changed files with 33 additions and 17 deletions

View file

@ -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"

View file

@ -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,".*:","")}'))))

View file

@ -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'