New backup 2025-11-29 11:15:01
This commit is contained in:
parent
65e358980a
commit
ead971c066
2 changed files with 11 additions and 8 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 .)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue