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"
|
:class "reveal-children"
|
||||||
:space-evenly false
|
:space-evenly false
|
||||||
(for entry in array
|
(for entry in array
|
||||||
(button :onclick 'swaymsg [con_id=${entry.win_id}] focus'
|
(button :onclick 'swaymsg [con_id=${entry.win_id}] scratchpad show'
|
||||||
:tooltip "${entry.name}
|
:class "${(entry.visible == 'true') ? visible : hidden}"
|
||||||
${entry.title}"
|
:tooltip "${entry.name}\n${entry.title}"
|
||||||
(image :path {entry.icon}
|
(image :path {entry.icon}
|
||||||
:image-width 20
|
:image-width 20
|
||||||
:image-height 20)
|
:image-height 20)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ declare -A icons=(
|
||||||
|
|
||||||
jq_get_windows='
|
jq_get_windows='
|
||||||
# descend to workspace or scratchpad
|
# descend to workspace or scratchpad
|
||||||
.nodes[0].nodes[0]
|
.nodes[].nodes[]
|
||||||
# save workspace name as .w
|
# save workspace name as .w
|
||||||
| {"w": .name} + (
|
| {"w": .name} + (
|
||||||
if (.nodes|length) > 0 then # workspace
|
if (.nodes|length) > 0 then # workspace
|
||||||
|
|
@ -18,7 +18,8 @@ jq_get_windows='
|
||||||
| .[]
|
| .[]
|
||||||
# select nodes with no children (windows)
|
# select nodes with no children (windows)
|
||||||
# | select(.nodes==[])
|
# | select(.nodes==[])
|
||||||
| select(.scratchpad!="fresh")
|
# | select(.scratchpad!="none")
|
||||||
|
| select(.scratchpad_state=="fresh")
|
||||||
)'
|
)'
|
||||||
|
|
||||||
jq_windows_to_tsv='
|
jq_windows_to_tsv='
|
||||||
|
|
@ -29,7 +30,8 @@ jq_windows_to_tsv='
|
||||||
# get app name (or window class if xwayland)
|
# get app name (or window class if xwayland)
|
||||||
(.app_id // .window_properties.class),
|
(.app_id // .window_properties.class),
|
||||||
(.name),
|
(.name),
|
||||||
(.pid)
|
(.pid),
|
||||||
|
(.visible)
|
||||||
]
|
]
|
||||||
| @tsv'
|
| @tsv'
|
||||||
|
|
||||||
|
|
@ -176,12 +178,13 @@ function get_scratchpad() {
|
||||||
shopt -s lastpipe
|
shopt -s lastpipe
|
||||||
swaymsg -t get_tree |
|
swaymsg -t get_tree |
|
||||||
jq -r "$jq_get_windows | $jq_windows_to_tsv" |
|
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
|
shopt -s extglob
|
||||||
app_name="${app_name%%*( )}"
|
app_name="${app_name%%*( )}"
|
||||||
icon=$( get_icon "$app_name" "$pid" )
|
icon=$( get_icon "$app_name" "$pid" )
|
||||||
|
visible=${visible}
|
||||||
[[ "$verbose" ]] && printf "[%s]=%s\n" "$app_name" "$icon" >&2
|
[[ "$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}")
|
applist_array+=("${applist_array_item}")
|
||||||
done
|
done
|
||||||
applist=$(printf '%s\n' "${applist_array[@]}" | jq -s .)
|
applist=$(printf '%s\n' "${applist_array[@]}" | jq -s .)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue